[jdom-interest] xmlns="" in children elements of root
Alex Rosen
arosen at silverstream.com
Wed Aug 29 09:28:11 PDT 2001
> But, a "" namespace is illegal per w3c DOM.
The namespaces spec says:
The default namespace can be set to the empty string. This has the same
effect, within the scope of the declaration, of there being no default
namespace.
> I should NOT have to assign a namespace to every element. I
> am creating XML
> files that must be validated against a Schema and the schema
> works as I
> stated, that all children are in the same namespace as the
> parent unless explicitly changed.
Dont confuse a namespace with a namespace declaration. JDOM deals only with
namespaces. If you give each element a namespace, then this will result in
only one namespace declaration, at the root element. That sounds like its
what you want. (This is all in the FAQ.)
> So when I set the root element to xmlns="http://www.someplace.com"
> all it children are in that namespace, so for JDOM to add to
> the first level children an illegal namespace of "" this
> file is now invalid when I try to convert a JDOM
> document to a w3c DOM Document an exception is thrown stating
> that "" is illegal for a namespace.
That sounds like a bug. Which DOM implementation are you using (e.g. Xerces,
Crimson, etc)? Which verison? Can you send a stack trace? Maybe the
JDOM->DOM conversion code has a bug.
Alex
More information about the jdom-interest
mailing list