File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Creating multiple Elements-Iterations in xml

Mohan Vinukonda
Ranch Hand

Joined: Jul 28, 2005
Posts: 32
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: 466

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 | Shikshanirman | Guftgu
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?

Salil Verma
I agree. Here's the link:
subject: Creating multiple Elements-Iterations in xml
It's not a secret anymore!