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
if (prefix.length() == 0 && uri.length() > 0 &&
cName != null &&
cName.getNamespaceURI().length() > 0)
from SVN history, it was added in r110897
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
which is incorrect, since the default namespace was redeclared in element b, the correct return should be
The proposed fix is to comment out that "if" block. I have tested that fix to pass checkintest.