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

Discussion in 'Java' started by mynamehere, Dec 14, 2003.

  1. mynamehere

    mynamehere Guest

    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?
     
    mynamehere, Dec 14, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wendy S
    Replies:
    1
    Views:
    6,462
    Darren Davison
    Aug 5, 2003
  2. Daniel Pitts
    Replies:
    6
    Views:
    725
    Arne Vajhøj
    Jun 25, 2008
  3. Alan
    Replies:
    6
    Views:
    1,695
  4. Ion Freeman
    Replies:
    17
    Views:
    864
    Tom Anderson
    Jul 11, 2009
  5. Adam Funk
    Replies:
    11
    Views:
    6,267
    Adam Funk
    Jan 21, 2010
Loading...

Share This Page