Incorrect default namespace serialization for un-prefixed attribute.
--------------------------------------------------------------------
Key: WSCOMMONS-99
URL: http://issues.apache.org/jira/browse/WSCOMMONS-99
Project: WS-Commons
Issue Type: Bug
Components: AXIOM
Environment: Windows
Reporter: Toshiro Takase
Priority: Critical
Current serialization prints default namespace declaration for un-prefixed
attributes.
According to "Namespaces in XML 1.0",
http://www.w3.org/TR/REC-xml-names/#defaulting
"Default namespace declarations do not apply directly to attribute
names."
"The namespace name for an unprefixed attribute name always has no
value."
So the default namespace declaration should not be printed.
I am afraid that this serialization sometimes breaks XML signature and XML
Infoset.
This is my test code.
----------
OMFactory factory = OMAbstractFactory.getOMFactory();
OMDocument doc = factory.createOMDocument();
OMElement elem1 = factory.createOMElement("local1", "ns1", "");
doc.addChild(elem1);
OMElement elem2 = factory.createOMElement("local2", "ns2", "pre2");
elem1.addChild(elem2);
elem2.addAttribute("attrLocal", "attrValue", null);
OMElement elem3 = factory.createOMElement("local3",
elem1.getNamespace());
elem2.addChild(elem3);
doc.serialize(System.out);
----------
The result is here. (indented for readability)
----------
<?xml version="1.0" encoding="utf-8"?>
<local1 xmlns="ns1">
<pre2:local2 xmlns="" xmlns:pre2="ns2" attrLocal="attrValue">
<local3 xmlns="ns1"/>
</pre2:local2>
</local1>
----------
In my understanding, this should be the following.
----------
<?xml version="1.0" encoding="utf-8"?>
<local1 xmlns="ns1">
<pre2:local2 xmlns:pre2="ns2" attrLocal="attrValue">
<local3/>
</pre2:local2>
</local1>
----------
--
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]