[jdom-interest] Namespace issues, et al.
panmanphil at yahoo.com
Mon Feb 24 07:54:58 PST 2003
> Using your design, you would have to call
> createAttribute(element.getNamespace()) every
> single call -- even though what you want to show up in the actual textual
> should NEVER have "xmlns='anything'" in it.
We can all see the point, it was argued endlessly a long long time ago. It was
determined the tradeoff of having to walk up the tree to find the context the
object was in to determine the namespace so it acts the more intuitive way, was
too expensive. The implementation, while not as elegant from a coding
standpoint, is however very easy to explain and exactly correct. The simple
story is, you must always provide the namespace for the node or JDOM will
assume it's in the no namespace namespace. Remember that and it will always do
what you expect on output.
More information about the jdom-interest