StAXOMBuilder is stripping off namspace prefix's from attributes that need 
namespace qualification
--------------------------------------------------------------------------------------------------

                 Key: AXIS2-2068
                 URL: https://issues.apache.org/jira/browse/AXIS2-2068
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: databinding
         Environment: Using Axis2-1.1.1 on Fedora Core 4.
            Reporter: Lucas Theisen
            Priority: Critical


Here is a code sample:

public class TestStAXOMBuilder {

    /**
     * @param args
     */
    public static void main( String[] args ) throws Exception {

        String xmlString = "<root xmlns='http://custom.com'><node cust:id='123' 
xmlns:cust='http://custom.com' /></root>";
        org.apache.xmlbeans.XmlObject param = 
org.apache.xmlbeans.XmlObject.Factory.parse( xmlString );
        
        // print out the object before it gets processed
        System.out.println( "before - '" + param.toString( ) + "'" );
        
        // copied code from the generated stub class toOM method
        org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new 
org.apache.axiom.om.impl.builder.StAXOMBuilder(
                org.apache.axiom.om.OMAbstractFactory.getOMFactory( ),
                new org.apache.axis2.util.StreamWrapper( param
                        .newXMLStreamReader( ) ) );
        org.apache.axiom.om.OMElement documentElement = builder
                .getDocumentElement( );

        ((org.apache.axiom.om.impl.OMNodeEx) documentElement).setParent( null );
        // end copied code

        // now print the object after it has been processed
        System.out.println( "after - '" + documentElement.toString( ) + "'" );

    }

}

The output I get from running this is:

before - '<root xmlns="http://custom.com";>
  <node cust:id="123" xmlns:cust="http://custom.com"/>
</root>'
after - '<root xmlns="http://custom.com";><node xmlns:cust="http://custom.com"; 
id="123" /></root>'

Notice that the namespace prefix "cust:" is removed from the "id" attribute 
therby making this an invalid xml.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to