[ 
https://issues.apache.org/jira/browse/XERCESJ-1586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14594299#comment-14594299
 ] 

Hudson commented on XERCESJ-1586:
---------------------------------

SUCCESS: Integrated in axiom-trunk #2133 (See 
[https://builds.apache.org/job/axiom-trunk/2133/])
Ensure that DOOM doesn't have the same issue as XERCESJ-1586. (veithen: rev 
1686516)
* 
/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj
* 
/webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
* 
/webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURIXercesJ1586.java
* 
/webservices/axiom/trunk/testing/dom-testsuite/src/test/java/org/apache/axiom/ts/dom/XercesTest.java


> lookupNamespaceURI may return unexpected result when looking up default 
> namespace
> ---------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1586
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1586
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1, 2.11.0
>            Reporter: Andreas Veithen
>            Priority: Minor
>
> Consider the following XML document:
> <root xmlns="urn:test"><child xmlns=""/></root>
> Assume that the document is constructed programmatically without explicitly 
> adding the namespace declarations:
>         Document document = 
> DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>         Element root = document.createElementNS("urn:test", "root");
>         document.appendChild(root);
>         Element child = document.createElementNS(null, "child");
>         root.appendChild(child);
> The expectation is that when looking up the default namespace on the child 
> element, the result is null. However, this is not the case, as demonstrated 
> by the following code:
>         System.out.println("uri=" + child.lookupNamespaceURI(null));
> In fact, the output is:
>         uri=urn:test
> Moreover, the result changes after normalizing the document:
>         document.normalizeDocument();
>         System.out.println("uri=" + child.lookupNamespaceURI(null));
> The output with Xerces 2.9.1 is now (Note that the result is still not 
> correct because one would expect uri=null, but this has been fixed in recent 
> Xerces versions; see XERCESJ-1394):
>         uri=
> The reason is that normalizeDocument adds xmlns="" to the child node (as 
> expected).
> Actually, the behavior of lookupNamespaceURI shown here strictly conforms to 
> the DOM Level 3 Core specification, as described in appendix B.4. That is 
> because of the namespace != null condition in the following part of the 
> pseudo code:
>          if ( Element's namespace != null and Element's prefix == prefix ) 
>          { 
>                // Note: prefix could be "null" in this case we are looking 
> for default namespace 
>                return (Element's namespace);
>          } 
> However, if one strictly follows the specification, then normalizeDocument 
> should also not add xmlns="" to the child element. In fact, the action taken 
> by normalizeDocument to fixup the namespace of that element is described by 
> the following part of the pseudo code in appendix B.1:
>       // Element has no pseudo-prefix
>       if ( there's a conflicting local default namespace declaration
>            already present )
>       {
>         ==> change its value to use this empty namespace.
>       }
>       // NOTE that this may break other nodes within this Element's
>       // subtree, if they're already using the default namespaces.
>       // They will be repaired when we reach them.
> Since there is no conflicting _local_ default namespace declaration on the 
> child element, according to the specification, nothing should be done. This 
> is obviously not what one wants in this case, and Xerces ignores that aspect 
> of the specification. However, for consistency, Xerces should then also 
> ignore the namespace != null condition in appendix B.4.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-dev-h...@xerces.apache.org

Reply via email to