Hi Thomas,

   Thanks for taking the time to track this all down.

It is the least I can do to pay back for all the greatness Batik has brought to our project and for your excellent support since the beginning.

The problem resulted from dom4j.Attribute returning the empty string as namespace URI if none is set, where as Batik expects a value of 'null' in such a case. Unfortunately, it appears to me that the dom4j version is correct in this case.
   If you read the DOM level 2 Core spec it says
(3rd para of 1.1.8 [1]):

    Note that because the DOM does no lexical checking, 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.

Thus I believe Batik's behavior is the correct one.

The XML Namespace document you quote (Section 2)[1] describes a namespace as consisting of two parts: NS prefix and NS name. If I am not mistaken, we're talking about the prefix, not the name, as it is the prefix by which batik looks for. Thus, I am not sure if my previous posts concerning this were entirely applicable.

Your claim derived from the DOM specification is strengthened by Javas
implementation of the org.w3c.dom.Document interface, which states in it's documentation:

  <br>Per XML Namespaces [[The document [2] in your message]],
  applications must use the value null as the
  namespaceURI parameter for methods if they wish to have
  no namespace.

I was not able to find this as an explicit definition in the document,
but the grammar given for namespace creation does not allow an empty string as a result - there has to be at least a single character in all possible productions.
The two paragraphs you quoted negate that exlusion, but from

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.[2]

it becomes clear that the empty string is not intended to be the declaration for 'no default namespace' but is just treated as such.

Luckily, the DOM Level 2 specification is less tolerant and makes quite clear what is required of a namespace. Looks like my late night research yesterday was too low in level.
I apologize.

  I think that dom4j is wrong to use the empty string for no namespace.
What do you think?

I think you are correct. I have contacted the author of the offending DOMWriter, maybe he has some evidence to the contrary. If not, I will remove my modification from the batik code and apply it to dom4j instead.

I will keep you up to date.

Have a nice weekend
-Urs

---------------------------------------------------------------------
[1]
http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-decl
[2]
http://www.w3.org/TR/1999/REC-xml-names-19990114/#defaulting



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to