Question about Document.getElementsByTagName(String) in org.w3c.dom

M

mynamehere

Take the sample xml:

<a>
<b>
123
<c>
<b>xyz</b>
<c>
</b>

<b>
456
</b>
</a>

With Document.getElementsByTagName("b"), I will be given
a NodeList containing the Nodes that have "123", "xyz", and "456".

How do I get a NodeList containing only "123" and "456"? If the
standard
stuff can't do it, I'll write my own extension that will work...

NodeList n=MyDocument.getNodeList("b",int)

....with the "int" indicating the depth of that tag name. Is this a
stupid solution? Is there a standard way?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top