[jdom-interest] xmlns="" in children elements of root
jhunter at collab.net
Wed Aug 29 09:38:56 PDT 2001
> When I give my root element (using XMLOutputter) a namespace of just
> "xmlns=http://www.someplace.com" I do not explicitly assign a namespace to
> any of the children elements at any level, but the first level children of
> the root are assigned a namespace of 'xmlns=""' which I can not figure out
> why and can not get ride of it. This should not be happening and makes it
> invalid against the schema.
The xmlns="" is an indicator that the element is in *no* namespace. See
the Namespaces spec and search for xmlns="". It should not be illegal
in DOM to receive such input.
Since your child element was created in memory without a namespace, the
outputter faithfully indicates that. Namespaces are not inherited in
the JDOM memory model, because if they were then elements moving in the
tree would have their namespaces change. As Philip says, it's been
heavily discussed. And as Alex says, there's a FAQ entry on this.
More information about the jdom-interest