[jdom-interest] API instability?

Jason Hunter jhunter at collab.net
Sun Sep 3 13:26:08 PDT 2000


> >When you say parent.getChild("child") it's kinda natural for the
> >unspecified namespace of "child" to be the same as the parent, 
> 
> Bugs or no bugs, this just doesn't seem obvious to me. I'd rather
> explicitly specify my namespaces. I think this is going to cause big,
> unexpected problems for programmers when they encounter documents
> where the children don't have the same namespaces as the parent.

To argue against myself and with Elliotte, another problem with
getChild("child") using the parent's namespace is that

Element kid = new Element("kid");
parent.addContent(kid);
parent.getChild("kid");

*wouldn't work* if the parent was in a namespace.  That's pretty
confusing.  With the current code it would work because kid would be in
no namespace.  With namespaces it'd work too:

Element kid = new Element("kid", ns);
parent.addContent(kid);
parent.getChild("kid", ns);

-jh-





More information about the jdom-interest mailing list