Jump to content

Stuck with traversing a tree


Recommended Posts

Hello, I am a little stuck on something... I have a XML document and I want to traverse it. Here is the XML code:

	<root>  <item id="intro"> 	 <caption>Introduction</caption> 	 <link>introduction.htm</link>    <icons>   	 <inactive>images/doc.gif</inactive>   	 <hover>images/doc_ovr.gif</hover>   	 <highlighted>images/doc_on.gif</highlighted>    </icons>  </item>  <folder collapsed="true" id="folder1"> 	 <icons>    <inactive>images/doc.gif</inactive>    <hover>images/doc_ovr.gif</hover>    <highlighted>images/doc_on.gif</highlighted> 	 </icons> 	 <item id="intro">    <caption>Introduction</caption>    <link>introduction.htm</link>   	 <icons>      <inactive>images/doc.gif</inactive>      <hover>images/doc_ovr.gif</hover>      <highlighted>images/doc_on.gif</highlighted>   	 </icons> 	 </item>  </folder>	</root>

What I am stuck on is how to access all of the nodes at one level only. So for example from the ROOT node I would want the following nodes in order of how they appear in the XML document : ITEM, FOLDER. I do not want the child Nodes of the first FOLDER tag, as I would recursion to get to these. Thanks a lotAdam

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...