aspose file tools*
The moose likes XML and Related Technologies and the fly likes Process multiple node occurences using JAXB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Process multiple node occurences using JAXB" Watch "Process multiple node occurences using JAXB" New topic
Author

Process multiple node occurences using JAXB

Tariq Ahsan
Ranch Hand

Joined: Nov 03, 2003
Posts: 116
Hello All,

I am quite new to JAXB. Wondering if I could get some pointers how I could go about processing a XML which would be something like -

<Group>
<Family>
<Person>
<Name>John Doe</Name>
<Address>100 Main Street, Chicago, IL, 60000</Address
<Age>40</Age>
</Person>
<Children>
<Name>John Doe Jr.</Name>
<Age>7</Age>
</Children>
</Family>
<Family>
<Person>
<Name>Jack Doe</Name>
<Address>200 Main Street, Chicago, IL, 60000</Address
<Age>42</Age>
</Person>
<Children>
<Name>Jack Moe Jr.</Name>
<Age>8</Age>
</Children>
</Family>
</Group>

The <Family> nodes need to be recursively process. Is there a easy way to generate a schema file based of any xml file? Would the JAXB compiler while generating the Java object model based of the schema would also generate the required class to handle lists of these individual nodes (here it is the Children node, I guess) of that sort or it's the developer who has to implement separately to handle this kind of lists?
Would really appreciate if I could some lead on this.
Some sample code would be great too! By the way I already have codes using JAXP APIs to do what I need to have. But I am bound to use JAXB because of existing application uses that.

Thanking you all.
Tariq Ahsan
Ranch Hand

Joined: Nov 03, 2003
Posts: 116
correction should be (here it is the Family node, I guess) instead of (here it is the Children node, I guess) in my earlier posting.
Sorry!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Process multiple node occurences using JAXB