W3C dom api in Java, get child elements by name

Posted by Benju on Stack Overflow See other posts from Stack Overflow or by Benju
Published on 2010-04-14T19:01:45Z Indexed on 2010/04/14 19:13 UTC
Read the original article Hit count: 340

Filed under:
|
|

I just realized that the method Element.getElementsByTagName("someTagName") returns a nodelist of all elements in the document that have a given tagname. What if I just want to get all child elements by tag name?

For example...

<person>
<name>Bob</name>
<car>
<name>Toyota Corolla</name>
</car>
</person>

© Stack Overflow or respective owner

Related posts about w3c

Related posts about dom