wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes Writing linked list to an XML file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Writing linked list to an XML file." Watch "Writing linked list to an XML file." New topic
Author

Writing linked list to an XML file.

phillip nash
Greenhorn

Joined: Feb 08, 2011
Posts: 21
Hello. I'm trying to find out how I can write this data structure to an XML file?



I dunno how I should be setting up my XML database. Within my loop. I've managed to create the above BUT i'm having to create a new Employee node every time i.e Employee1, employee2. I'm unable to use a single element i.e Employee and
add the various employees using that element. I'm new to XML, so please be nice.

Thanks

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18715
    
    8

phillip nash wrote:Within my loop. I've managed to create the above BUT i'm having to create a new Employee node every time i.e Employee1, employee2. I'm unable to use a single element i.e Employee and add the various employees using that element.


Okay... so what's the problem? There are several Employee nodes in the document, so why wouldn't you expect to be creating several Employee nodes in your program? That seems perfectly normal to me. So maybe I'm misunderstanding what you said there.
phillip nash
Greenhorn

Joined: Feb 08, 2011
Posts: 21


Thats currently what my code looks like. My list is being passsed from a method. I'm confused how I can keep on adding employees names to employee
phillip nash
Greenhorn

Joined: Feb 08, 2011
Posts: 21
phillip nash wrote:Hello. I'm trying to find out how I can write this data structure to an XML file?



I dunno how I should be setting up my XML database. Within my loop. I've managed to create the above BUT i'm having to create a new Employee node every time i.e Employee1, employee2. I'm unable to use a single element i.e Employee and
add the various employees using that element. I'm new to XML, so please be nice.

Thanks



Sorted it!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18715
    
    8

phillip nash wrote:Sorted it!


Excellent!

Would it be fair for me to guess that you changed the contents of that for-loop to create multiple Employee elements? What I'm trying to say is, posting your correct code could be helpful to other people who stumble across this thread in the future.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing linked list to an XML file.