[Yanel-dev] Namespace Workaround
Michael Wechner
michael.wechner at wyona.com
Thu Jan 24 12:01:22 CET 2008
Hi
It seems that with Java 1.4 the serializer has a namespace problem,
whereas this doesn't appear with Java 1.5.
One can do the following workaround when creating a DOM document or
rather a root Element with a namespace:
Element rootElement = doc.createElementNS(NAMESPACE, "my-root-element");
//Workaround for serializer bug
root.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", NAMESPACE);
doc.appendChild(root);
The important thing is that a namespace is not only assigned to a
document or rather an element, but also that such a namespace attribute
is being set.
It seems like Java 1.5 is doing this automagically.
Cheers
Michi
--
Michael Wechner
Wyona - Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael.wechner at wyona.com, michi at apache.org
+41 44 272 91 61
More information about the Yanel-development
mailing list