This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
Joined: Nov 03, 2003
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!