You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Clement Pellerin (JIRA)" <ji...@apache.org> on 2015/12/21 17:28:46 UTC

[jira] [Created] (SANTUARIO-436) XmlWriterToTree calls DOM with invalid global namespace URI

Clement Pellerin created SANTUARIO-436:
------------------------------------------

             Summary: XmlWriterToTree calls DOM with invalid global namespace URI
                 Key: SANTUARIO-436
                 URL: https://issues.apache.org/jira/browse/SANTUARIO-436
             Project: Santuario
          Issue Type: Bug
          Components: Java
    Affects Versions: Java 2.0.6
            Reporter: Clement Pellerin
            Assignee: Colm O hEigeartaigh
            Priority: Minor


The javadoc of javax.xml.stream.XMLStreamWriter.writeStartElement() says:
ocalName - local name of the tag, may not be null
prefix - the prefix of the tag, may not be null
namespaceURI - the uri to bind the prefix to, may not be null

In StAX the global namespace is the empty string.

The Javadoc for org.w3c.dom.Document.createElementNS() says:
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

In the DOM, the global namespace is null.

The same observation can be made when creating attributes in namespaces.

XmlWriterToTree mimicks the API of javax.xml.stream.XMLStreamWriter, therefore it should accept the empty string for the global namespace. On the other hand, when it calls the DOM, it should pass null for the global namespace as recommended in the DOM documentation.

This bug is not visible because despite the harsh words in the DOM documentation, the empty string is accepted in many implementations of the DOM. Since DOM is an interface, not an implementation, it is not possible to prove all implementations have this work-around.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)