Axiom add unparsable namespace elements when there is an empty namespace in an
XML message
------------------------------------------------------------------------------------------
Key: AXIOM-386
URL: https://issues.apache.org/jira/browse/AXIOM-386
Project: Axiom
Issue Type: Bug
Components: API
Affects Versions: 1.2.9
Environment: Ubuntu, Linux
Reporter: Amila Jayasekara
I have following XML,
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<soapenv:Body
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="Id-687052362">
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>For input string: "1er"</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
When this is parsed through AXIOM-API, i get following,
<?xml version="1.0" encoding="UTF-8"?>
<fragment
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<faultcode xmlns:axis2ns34="">soapenv:Server</faultcode>
<faultstring xmlns:axis2ns35="">For input string: "1er"</faultstring>
<detail xmlns:axis2ns36=""></detail>
</soapenv:Fault>
</fragment>
Note that some empty namespaces (xmlns:axis2ns34="") are added to <faultcode>
elements. These elements cannot be parsed using a SAX parser.
When parse through SAX we get following exception,
[Fatal Error] :1:493: The value of the attribute
"prefix="xmlns",localpart="axis2ns34",rawname="xmlns:axis2ns34"" is invalid.
Prefixed namespace bindings may not be empty.
org.xml.sax.SAXParseException: The value of the attribute
"prefix="xmlns",localpart="axis2ns34",rawname="xmlns:axis2ns34"" is invalid.
Prefixed namespace bindings may not be empty.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.wso2.my.Client.main(Client.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
We should not re-declare namespaces for elements with empty namespaces.
Thanks
AmilaJ
--
This message is automatically generated by JIRA.
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]