Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

recursive xml parsing solution - help needed

807605Sep 10 2007 — edited Sep 10 2007
FYI, I'm not the best with words, so here it goes.

I have an xml document of which I am iterating through the nodes. When I discover a node of a specific type (i.e. <box>) I begin to iterate through it's child nodes.
The problem is, that a <box> element can contain multiple <box> elements as it's children. So a possible structure is:

<box>
<node1>
<box>
<nestedBoxNode>
</box>
<node2>
<box>
<nestedBoxNode2>
</box>
</box>

In the method that handles the <box> element, if it discovers another <box> element as a child, it calls itself.
However, I need to do some processing on each <box> element separately.

My question is, what are some possible methods of determining if a parent<box> element contains other <box> elements as children?

How can I determine when to call my processing functions for each child <box> node?

Forgive me for the vagueness of my questions, this is most detail that I am able to give.

Any help whatsoever is greatly appreciated...
Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2007
Added on Sep 10 2007
12 comments
874 views