ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Unifiers Pega (JIRA)" <>
Subject [jira] [Created] (AXIOM-497) Removal of namespace declaration breaks type attribute
Date Thu, 09 May 2019 08:38:00 GMT
Unifiers Pega created AXIOM-497:

             Summary: Removal of namespace declaration breaks type attribute
                 Key: AXIOM-497
             Project: Axiom
          Issue Type: Bug
          Components: Core Model, OM Mixins
    Affects Versions: 1.2.13
         Environment: Weblogic version application server
            Reporter: Unifiers Pega
             Fix For: 1.2.13

When the following XML is converted to an OMElement, then written back out, the namespace
prefix used by the xsi:type attribute refers to the incorrect namespace URI. That is because
the local prefix mapping used in the type name reference is removed from the element that
contains the type attribute during parsing.

It appears to be caused by a null return value from the getNsBuilder method of AttributeCollector
when it thinks the namespace declaration is redundant.

Original XML:
<ns1:A xmlns:ns1="urn:foo">
<ns1:B xmlns:ns1="urn:bar">
<ns2:C xmlns:ns1="urn:foo" xmlns:ns2="urn:bar" xmlns:xsi="[]"

After conversion to OMElement, xsi:type name cannot be resolved because it is mapped to the
wrong namespace URI:
<ns1:A xmlns:ns1="urn:foo">
<ns1:B xmlns:ns1="urn:bar">
<ns2:C xmlns:ns2="urn:bar" xmlns:xsi="[]" xsi:type="ns1:TypeA"/>


Here's some sample code to reproduce the issue:


System.out.println("Before StAX parsing:\n"+xmlString);

try { stringReader = new; inputFactory =; streamReader = inputFactory.createXMLStreamReader(stringReader); builder = new;

xmlString = builder.getDocumentElement().toString();

} catch (Exception e) {

System.out.println("Caught exception " + e);


System.out.println("After StAX parsing:\n"+xmlString);



This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message