Win a copy of Rust Web Development this week in the Other Languages forum!

Kirsty Beaton

Greenhorn
+ Follow
since Dec 06, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kirsty Beaton

Hello all,

I am creating a simple Web Service. For the time being, I just want to have 3 or 4 Java object instances that will persist, that I can perform queries on. I want to have these instances stored in an XML file which I can read and write to.
Right now my problem is writing the objects to XML.
It seems like the best way to go about doing this is to create a class for each object in Java, then in a driver of some sort create instances of these objects, and write them to XML using JAXB.

I've read some tutorials on JAXB and with the help of Netbeans' generated code for marshalling, I have managed to write one instance to XML. My question is, what is the best way to write a group of instances into one XML file? Do I need to write a class for an object that represents a collection of the objects (for example, I want to store a group of "Book" objects, do I need to write a "BookList" class, and write one instance of "BookList" using JAXB)?

I have also read that for JAXB to work I need to have an XML schema, an "xsd" file. Is this something I write myself?

I am fairly new to XML so any help would be appreciated.
Thank you.
9 years ago
Thank you all for your helpful responses.

Java's starting to come back to me now.
10 years ago
Hi there,
I have been programming in C++ for the last while and am once again using Java. I don't have a lot of experience in Java in the first place so there's a few things that aren't coming back to me right away.

What I am unsure about at the moment is Java's automatic copying of objects.

DocIDFrequencyList is essentially a HashMap.
Is there any difference between the following code snippets?
A:


B:


Thank you for any help.
10 years ago
Interesting, I had no idea. I will read up on that. Thank you.
11 years ago
I didn't realise it would compile like that (with one "=").

I'll take your word for it.
11 years ago

Campbell Ritchie wrote:

mohamed sanaullah wrote:Change This


to this
. . .

Surely you mean if (isFullStack) . . . You should never use == true or == false.



Mind if I ask the reasoning behind this? Is it simply a style issue?
11 years ago
All The Pretty Horses by Cormac McCarthy.

I'd avoid the movie though.

In fact, I'd recommend reading anything by Cormac McCarthy.
11 years ago
As someone that is also new to Java, would it be correct to say that lines 2-4 are allocating space for Players? And lines 7-9 are filling that space?
11 years ago
I just started reading the comic book. I've heard the episodes correspond very closely to the book's storyline. I'm waiting to finish reading before I start watching the show, but I'm looking forward to it... the comic has been so addictive. I'd recommend it if you like the show. The illustrations of the zombies are awesome.
11 years ago