Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Product and Other Certifications and the fly likes Creating multiple Elements-Iterations in xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Creating multiple Elements-Iterations in xml" Watch "Creating multiple Elements-Iterations in xml" New topic
Author

Creating multiple Elements-Iterations in xml

Mohan Vinukonda
Ranch Hand

Joined: Jul 28, 2005
Posts: 32
Hi,
I am trying to create a xml having iterations. for example Employee would have name,designation,sal. I need to create a an xml for multiple employees. can you please give me suggestion. I am reading data from multiple xmls and writing into one xml. So I would have iterations of same element. Thanks in advance!
Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 459
    
    1
Here employee node is complex element having name,designation, sal in it; which all are simple element and employee node may repeat multiple times. Have you created XSD or DTD for this???


Vinod Tiwari | Twitter
Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 255

Hey Nani,

As you are able to read the XML files, you can get the information of each employee using xpath. After that, in the same loop (in which you would be processing the individual employee's XML file one by one), you can add code to add the same elements in the newly created XML file.

Can you please pin point, at which step you are facing a problem?

Regards
Salil Verma
 
jQuery in Action, 2nd edition
 
subject: Creating multiple Elements-Iterations in xml