You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2003/03/05 22:55:44 UTC

DO NOT REPLY [Bug 17696] New: - DOMStreamer.NamespaceNormalizingDOMStreamer outputs xml declarations on node types other than Document

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=17696>.
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=17696

DOMStreamer.NamespaceNormalizingDOMStreamer outputs xml declarations on node types other than Document

           Summary: DOMStreamer.NamespaceNormalizingDOMStreamer outputs xml
                    declarations on node types other than Document
           Product: Cocoon 2
           Version: Current CVS
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: general components
        AssignedTo: cocoon-dev@xml.apache.org
        ReportedBy: unico@hippo.nl


NamespaceNormalizingDOMStreamer is outputting xml declarations during all stream
( Node ) calls, irrespective of whether the node is a document or not. It 
should only output such a declaration if the Node to stream is of type Document.

I haven't tested, but I figure the following will help:

Index: DOMStreamer.java
===================================================================
RCS file: /home/cvspublic/xml-
cocoon2/src/java/org/apache/cocoon/xml/dom/DOMStreamer.java,v
retrieving revision 1.9
diff -u -r1.9 DOMStreamer.java
--- DOMStreamer.java	28 Feb 2003 00:23:13 -0000	1.9
+++ DOMStreamer.java	5 Mar 2003 21:52:20 -0000
@@ -215,7 +215,10 @@
          */
         protected void stream(Node pos) throws SAXException {
 
-            contentHandler.startDocument();
+			if ( pos.getNodeType() == Node.DOCUMENT_NODE )
+			{
+            	contentHandler.startDocument();
+			}
 
             Node top = pos;
 
@@ -248,7 +251,11 @@
 
                 pos = nextNode;
             }
-            contentHandler.endDocument();
+
+			if ( pos.getNodeType() == Node.DOCUMENT_NODE )
+			{
+            	contentHandler.endDocument();
+			}
         }
 
         private final void dispatachChars(Node node) throws SAXException {