[jdom-interest] Default namespace / getChild()

Matthew MacKenzie matt at xmlglobal.com
Fri May 11 17:26:41 PDT 2001


Is there a reason why I have to do the following, given:

<Envelope xmlns="http://schemas.xmlsoap.org/someschema">
    <Body>
        <businessList />
    </Body>
</Envelope>

Code in question:

Element envelope = getSoapEnvelope(Element requestEnvelope);
Element body = envelope.getChild("Body", envelope.getNamespace());

Shouldn't getChild() check to see if there are children without explicitly declared namespaces and automatically pick them up if I were to just use

Element body = envelope.getChild("Body");

??

The behaviour that I think would be most intuitive would be if children were assumed to be in the same namespace as their parent UNLESS they declare otherwise.  Element does work this way already, as evidenced by the Namespace-less signature not working on my sample XML, but Element.getChild() does not work in a way consistent with this.  




-Matt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20010511/1a0ac103/attachment.htm


More information about the jdom-interest mailing list