I want to get the number of elements in an xml, which have specific name eg. name="while")
The problem is that if I use the following code- I only get top level elements that have this name--
for ( Iterator i = root.elementIterator( "while" ); i.hasNext(); ) {
Element foo = (Element) i.next();
But any lower level "while" element is not part of the iterator...
What is the most efficient way of obtaining all elements (whether top level or lower level) that have name="while"? Do I have to parse through all elements in document for this purpose?