[jdom-interest] How to travers deeply?

Roman Rytov rrytov at entopia.com
Fri Oct 4 14:19:27 PDT 2002


In the following example how should I find a street of a client whose ID is 2? 


<root>
	<client id="1">
		<address>
			<street> Burgen </street>
		</address>
	</client>
	<client id="2">
		<address>
			<street> Durgen </street>
		</address>
	</client>

	<other tags>...

</root>

The straightforward way came to me is:
1. Find root
2. Get a list of all children
3. Filter it by client's ID (I found the proposed way to do it is to use FilterIterator from jakarta/common?)
4. Find all address
5. Find all street

It seems to me too complicated and a lot of manual work. Did I miss somethig? Now way to find all/one element(s) satisfying a XPath criteria?

Roman Rytov



More information about the jdom-interest mailing list