[jdom-interest] cannot create xmlns namespace?

Bradley S. Huffman hip at a.cs.okstate.edu
Sun Jul 21 18:02:32 PDT 2002


Jason Hunter writes:

> > Here is what is happening now:
> > <html xmlns="http://www.w3.org/1999/xhtml">
> >     <head xmlns="" xmlns="http://www.w3.org/1999/xhtml">
> >        <title xmlns="" xmlns="http://www.w3.org/1999/xhtml">Test</title>
> >     </head>
> 
> That's not valid XML, and I'm surprised XMLOutputter would emit that. 
> Could you send some sample code (as simple as possible) that generates
> that document?

Yuck, I didn't notice that at first, but sure enough one way you can currently
do it is:

    Element e1 = new Element("html);
    e1.addNamespaceDeclaration(
            Namespace.getNamespace("http://www.w3.org/1999/xhtml"));

Hmmm, guess this fails the "uniqueness of attributes" constraint. I'll work
up the patch.

Brad




More information about the jdom-interest mailing list