Hello,

some days ago, I wrote to dom4j's James Strachan concerning a problem with the DOMWriter class. Unfortunately, James hasn't found the time to reply yet, so I am taking the issue to this list.

I am using the class to convert XML documents read by dom4j to the w3c.dom interface, then to use them with the Apache Batik project.

After beginning implementation of said features, I faced problems with namespaces in Batik, which I finally was able to track down to
a different treatment of the empty namespace in dom4j and the W3C dom:

While dom4j returns an empty string for an unset namespace, the W3C dom expects an undefined or empty namespace to be 'null'. While the dom4j treatment is in the letter of the XML definition of namespaces, where it is stated that

"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."

the DOM level 2 core specification[1] on namespaces is more strict, declaring that

"[..] the empty string will be treated as a real namespace URI in DOM Level 2 methods. Applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace."

Originally, I asked James as the classes author, but maybe there is someone here who can help: Are there specific reasons why the empty string is not changed to a value of 'null' before using it as a namespace in a w3c.dom.Document?
If so, which?
If not, could dom4j's behaviour be changed to comply with the specifications quoted above?

Thanks for your assistance,
-Urs
-----
[1] Dom Level 2 Core Specification Section 1.1.8
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#Namespaces-Considerations#
[2] XML Namespaces
http://www.w3.org/TR/1999/REC-xml-names-19990114/#defaulting



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to