You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Bardman, Jody" <JB...@Liquent.com> on 2001/08/10 21:25:14 UTC

another Xerces question

Thanks Tom Myers for your last response.

I would like to get a group of nodes that are several nodes from the top:

<Level1>
	<Level2>
		<Level3>
			<Stuff name="stuff1"/>
			<Stuff name="stuff2"/>
			<Stuff name="stuff3"/>
		</Level3>
	</Level2>
</Level1>


I was using doc.getElementsByTagName("Stuff") but that is only good if that grouping of "Stuff" is unique to the whole XML document.
If there are other "Stuff"s in other nodes I am screwed.

What is the best way to just get the group I desire?

Thanks
Jody


Re: another Xerces question

Posted by Gavin Stokes <ga...@AmbitiousProductions.com>.
What is unique about the particular group you are seeking?  Are you just 
looking for all groups of consecutive STUFFs that have a common parent, 
processing these groups one at a time?  Are you always looking for STUFFs 
that are indented under the a third-level node?

I think that to help, we need to know what you're using to logically 
discriminate between bunches of STUFF.

If you're only looking for STUFFs under the third level, for example, you 
could write a routine to count how many parents a node has.  The result 
will tell you the level of indentation, so you could select all STUFFs in 
the doc and iterate through them, processing the ones at the proper level 
with a common parent as a group, and then skipping those that aren't at the 
proper level of indentation.

Regards,
Gavin


Re: another Xerces question

Posted by Gavin Stokes <ga...@AmbitiousProductions.com>.
What is unique about the particular group you are seeking?  Are you just 
looking for all groups of consecutive STUFFs that have a common parent, 
processing these groups one at a time?  Are you always looking for STUFFs 
that are indented under the a third-level node?

I think that to help, we need to know what you're using to logically 
discriminate between bunches of STUFF.

If you're only looking for STUFFs under the third level, for example, you 
could write a routine to count how many parents a node has.  The result 
will tell you the level of indentation, so you could select all STUFFs in 
the doc and iterate through them, processing the ones at the proper level 
with a common parent as a group, and then skipping those that aren't at the 
proper level of indentation.

Regards,
Gavin