You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/09/10 12:20:03 UTC

DO NOT REPLY [Bug 23059] New: - DOM2Writer generates invalid XML (missing namespaces)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23059>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23059

DOM2Writer generates invalid XML (missing namespaces)

           Summary: DOM2Writer generates invalid XML (missing namespaces)
           Product: Axis
           Version: 1.1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: nmoyere@calendra.com


When I use org.apache.axis.utils.DOM2Writer.serializeAsXML to print a node,
some namespaces are missing in the generated XML, making it invalid.

The problem occurs when I try to serialize a Node that is not the root node of
the DOM document.
DOM2Writer prints all the namespaces that are not declared in the parents of
each serialized node. This cause a problem when call serializeAsXML without
the root node.

For example
<ns1:a xmlns:ns1="aa"><ns1:b><ns2:c xmlns:ns2="cc"/></ns1:b></ns1:a>
if you call serializeAsXML on the ns1:b element, DOM2Writer prints
<?xml version="1.0" encoding="UTF-8"?>
<ns1:b><ns2:c xmlns:ns2="cc"/></ns1:b>
instead of
<?xml version="1.0" encoding="UTF-8"?>
<ns1:b xmlns:ns1="aa"><ns2:c xmlns:ns2="cc"/></ns1:b>
to make it a valid document because it found the ns1 namespace declaration
in the parent of the ns1:b element.
DOM2Writer should stop the namespace lookup to the node given to serializeAsXML.