Author: dkulp
Date: Mon Jul  7 10:41:51 2008
New Revision: 674562

URL: http://svn.apache.org/viewvc?rev=674562&view=rev
Log:
[CXF-1687] Fix to make the fastinfoset versions work correctly.  Get comments 
and processing instructions at the start of XML docs to work correctly

Modified:
    
cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java

Modified: 
cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java?rev=674562&r1=674561&r2=674562&view=diff
==============================================================================
--- 
cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
 (original)
+++ 
cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
 Mon Jul  7 10:41:51 2008
@@ -159,15 +159,27 @@
     }
 
     public void writeComment(String value) throws XMLStreamException {
-        currentNode.appendChild(document.createComment(value));
+        if (currentNode == null) {
+            document.appendChild(document.createComment(value));
+        } else {
+            currentNode.appendChild(document.createComment(value));
+        }
     }
 
     public void writeProcessingInstruction(String target) throws 
XMLStreamException {
-        currentNode.appendChild(document.createProcessingInstruction(target, 
null));
+        if (currentNode == null) {
+            document.appendChild(document.createProcessingInstruction(target, 
null));
+        } else {
+            
currentNode.appendChild(document.createProcessingInstruction(target, null));
+        }
     }
 
     public void writeProcessingInstruction(String target, String data) throws 
XMLStreamException {
-        currentNode.appendChild(document.createProcessingInstruction(target, 
data));
+        if (currentNode == null) {
+            document.appendChild(document.createProcessingInstruction(target, 
data));
+        } else {
+            
currentNode.appendChild(document.createProcessingInstruction(target, data));
+        }
     }
 
     public void writeCData(String data) throws XMLStreamException {
@@ -186,11 +198,11 @@
     }
 
     public void writeStartDocument(String version) throws XMLStreamException {
-        writeStartDocument();
+        document.setXmlVersion(version);
     }
 
     public void writeStartDocument(String encoding, String version) throws 
XMLStreamException {
-        writeStartDocument();
+        document.setXmlVersion(version);
     }
 
     public void writeCharacters(String text) throws XMLStreamException {


Reply via email to