You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Jerry Sy (JIRA)" <xm...@xml.apache.org> on 2012/09/20 23:18:07 UTC
[jira] [Created] (XMLBEANS-489) Cursor getAllNamespaces not
returning default namespace
Jerry Sy created XMLBEANS-489:
---------------------------------
Summary: Cursor getAllNamespaces not returning default namespace
Key: XMLBEANS-489
URL: https://issues.apache.org/jira/browse/XMLBEANS-489
Project: XMLBeans
Issue Type: Bug
Components: Cursor
Affects Versions: Version 2.6
Reporter: Jerry Sy
the Cursor getAllNamespaces API is not returning the default namespace that is in scope for an element.
In org.apache.xmlbeans.impl.store.Locale class, line 2316 is this code, which intentionally omits the default namespace from the mapping.
// Here I check to see if there is a default namespace
// mapping which is not empty on a non root container which
// is in a namespace. This this case, I do not want to add
// this mapping because it could not be persisted out this
// way.
if (prefix.length() == 0 && uri.length() > 0 &&
cName != null &&
cName.getNamespaceURI().length() > 0)
{
continue;
}
from SVN history, it was added in r110897
http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java?revision=110897&view=markup&pathrev=1386853
As an example, given
<a xmln=""><b xmlns="namespaceb"><c xmlns:c1="namespacec"/></b></a>
Using Cursor API, navigate to element c then call getAllNamespaces, it returns
"",""
c1,"namespacec"
which is incorrect, since the default namespace was redeclared in element b, the correct return should be
"","namespaceb"
c1,"namespacec"
The proposed fix is to comment out that "if" block. I have tested that fix to pass checkintest.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org