Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing linked list to an XML file.

 
phillip nash
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic