Results 1 to 2 of 2
  1. #1
    poorni is offline Member
    Join Date
    Jul 2010
    Posts
    1
    Rep Power
    0

    Default How to get complete child nodes of an xml

    Hi,
    I am trying to parse an xml something like this given below.

    <root>

    <child1>
    <sub1-child1>text</sub1-child1>
    <sub1-child2>text</sub1-child2>
    <sub1-child3>text</sub1-child3>
    </child1>

    <child2>
    <sub2-child1>text</sub2-child1>
    <sub2-child2>text</sub2-child2>
    <sub2-child3>text</sub2-child3>
    </child2>

    <child3>
    <sub3-child1>text</sub3-child1>
    <sub3-child2>text</sub3-child2>
    <sub3-child3>text</sub3-child3>
    </child3>

    </root>


    If I am asking for the parser to get <child1> then I expect the output should be like this given below:

    <child1>
    <sub1-child1>text</sub1-child1>
    <sub1-child2>text</sub1-child2>
    <sub1-child3>text</sub1-child3>
    </child1>

    I dont want to get a nodelist for looping for all the sub child elements. But i saw DOM parser which is used only for getting one by one child element. I am not getting all the sub child elements along with the child element if i query for a child element.

    I hope you got my point and let me know your thoughts on this. Thanks for your help in Advance.

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,182
    Rep Power
    20

    Default

    What code do you have at the moment?

    What, exactly, is it you want the code to do?
    Because a NodeList is exactly what I'd expect from a search for a tag, which contains the relevant Elements and which I could then drill down into. That's XML.

Similar Threads

  1. Getting handler of child window
    By jhyd in forum AWT / Swing
    Replies: 0
    Last Post: 06-23-2010, 05:17 PM
  2. How to get value of specific child node
    By sito42 in forum New To Java
    Replies: 1
    Last Post: 07-13-2009, 01:00 PM
  3. Cannot add or update a child row....
    By Pierced1 in forum JDBC
    Replies: 2
    Last Post: 06-29-2009, 03:32 AM
  4. nodes
    By Dr Gonzo in forum New To Java
    Replies: 1
    Last Post: 12-08-2008, 05:22 PM
  5. Child Labor
    By freddieMaize in forum Forum Lobby
    Replies: 1
    Last Post: 11-16-2008, 09:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •