[jdom-interest] elem.getChildren()

waynesdavis at netscape.net waynesdavis at netscape.net
Mon Jan 29 09:26:57 PST 2001

I am trying to retrieve the children of an element of an XML document.  

I am able to retrieve the root and the namespace that is present.  When I step through the elements by name, all is happy.

    Element root = doc.getRootElement();             
    Namespace ns = root.getNamespace();              
    Element headerTag = root.getChild("Header", ns);   

I then want to retrieve all children of first level.  The elements are found. When I display through XMLOutputter, the namespace is added to every element.  Not what I want.

    chidren = headerTag.getChildren();

If I try to get all children of the root, of which there is at least one (1), I get a zero (0) length list.
    List chidren = root.getChildren();

If I try to get all children of the Header so I can specify the namespace, I get a zero (0) length list.
    chidren = root.getChildren ("Header", ns);

What am I missing?

Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/

More information about the jdom-interest mailing list