You first define an element with a default namespace...
> Element element1 = document.addElement("tag1");
> element1.addAttribute("name","test");
> element1.addNamespace("","http://aaa.bbb");
The second step adds a child element (to the element with the
default namespace) that is not in a namespace.
> Element element2 = element1.addElement( "tag2");
This means that when it is written to XML the default namespace
of the parent node needs to be undeclared using xmlns="".
That is what you see in the output:
> <tag2 xmlns=""/>
If you want element2 to be in the same namespace as element1,
make sure to specify this in your code:
Element element2 = element1.addElement( "tag2");
element2.addNamespace("","http://aaa.bbb");
Regards,
Edwin
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
dom4j-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dom4j-user