Unprefixed namespaces serializing as xmlns:xmlns in AXIOM DOM implementation
----------------------------------------------------------------------------

                 Key: WSCOMMONS-105
                 URL: http://issues.apache.org/jira/browse/WSCOMMONS-105
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
         Environment: Windows XP, JRE 1.4.2, AXIOM1.1.1
            Reporter: C Corvin
            Priority: Minor


When transforming an AXIOM DOM document and outputting to another DOM format, 
an attribute with prefix 'xmlns' and NCName 'xmlns' (creating a QName 
representation 'xmlns:xmlns') is created.  For example my input:-
<soapenv:Body...>
   <element xmlns="http://example.com/...";> </element>
</soapenv:Body>

is seraialized to:-
<soapenv:Body...>
   <element xmlns:xmlns="http://example.com/...";> </element>
</soapenv:Body>

This appears to be caused by the following two steps:-
1. In org.apache.axiom.om.impl.dom.ElementImpl - getAttributes(), when setting 
the default attributes at line 1309 an attribute is created with name xmlns and 
an OMNamespace added with prefix xmlns
2. In org.apache.axiom.om.impl.dom.AttrImpl - getName(), since OMNamespace is 
not null, the code OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName generates 
the incorrect output.

I have patched my version of org.apache.axiom.om.impl.dom.AttrImpl with the 
following code:-
    public String getName() {
        return (this.namespace == null) ? this.attrName
                : (OMConstants.XMLNS_NS_PREFIX.equals(this.attrName) ? 
this.attrName : OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName);
    }

That seemed to me to be the right thing to do.

I am not sure if anything needs to be done with getQName().  I don't have 
enough knowledge of the whole chain to know.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to