August 9th, 2011, 04:18 PM
SAX Parsing And Keeping Track Of Children
I'm trying to parse a document using SAX for Java. I need to keep track of the parent of the children in an XML format that allows for infinite decendants. I need to keep track of the parent as I go through. When I find the root phase object, I need to create an object in the database, retrieve the ID of the stored object. When I get to the children I need to know who their parent is so I can set their parentID in the database. How do I keep track of the parent? I included an XML file and a diagram showing the hierarchy. If I go all the way down to B_level4, how do I know that B_level2 is the child of A_level1 and not A_level3?
I was going to:
- find the first phase and set it to current
- Get the level below, set current to parent, and set the id to the current
How do I deal with the infinite depth (having phases within phases) and keeping track of who the parent is?
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!