java - SAX Parser having parent and child tags similar -
i using sax parser parse xml has parent , children tags this:
<a name="parent" level="0"> <a name="child" level="0"> <a name="subchild01" level="1"> <a name="subchild11" level="1"> </a> </a> <a name="subchild11" level="1"> </a> </a> <a name="child2" level="0"> <a name="subchild02" level="1"> </a> </a> </a>
code
class node{ list<integer> childnodeid=new arraylist<integer>(); }
to save childnodes
id immediate subsequent parent. how can achieved?
with vast majority of sax applications, have maintain stack. push information onto stack when notified of startelement, , pop stack on endelement events. can find information relevant parent of current element peek() @ top of stack.
Comments
Post a Comment