[jdom-interest] Two namespace-questions
Kai Wörner
herrner at gmail.com
Fri May 11 02:00:54 PDT 2007
Thanks, that solved my problems. But wouldn't it be more plausible if
JDOM didn't add xmlns="" to elements without a namespace prefix?
Kai
> > Namespace svg2 = Namespace.getNamespace("http://www.w3.org/2000/svg");
> > svgRoot.setNamespace(svg2);
> >
> > , but using the second one adds a
> >
> > xmlns=""
> >
> > to every Element I create. Is there any comprehensible way to declare
> > the namespaces without getting this?
>
> You have to set the namespace on every element you create, for example using
> the constructor Element(java.lang.String name, Namespace namespace) or
> setNamespace(Namespace namespace).
> JDOM Elements are not linked to their parent and have a namespace of their
> own. Hence, they do not inherit the parent namespace when being added as children.
>
> Laurent
>
>
More information about the jdom-interest
mailing list