camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r783704 - /camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfUtils.java
Date Thu, 11 Jun 2009 09:04:39 GMT
Author: ningjiang
Date: Thu Jun 11 09:04:39 2009
New Revision: 783704

URL: http://svn.apache.org/viewvc?rev=783704&view=rev
Log:
Removed the import of the com.sun package

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfUtils.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfUtils.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfUtils.java?rev=783704&r1=783703&r2=783704&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfUtils.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfUtils.java
Thu Jun 11 09:04:39 2009
@@ -34,9 +34,7 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import com.sun.org.apache.xml.internal.serialize.OutputFormat;
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
-
+import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CachedOutputStream;
@@ -63,7 +61,8 @@
         visitNodesForNameSpace(element, namespaces);
         W3CDOMStreamWriter writer = new W3CDOMStreamWriter();
         writeElement(element, writer, namespaces);
-        return getStringFromDoc(writer.getDocument());
+        XmlConverter converter = new XmlConverter();
+        return converter.toString(converter.toSource(writer.getDocument()));
         
     }
     
@@ -164,20 +163,6 @@
         
     }
 
-    private static String getStringFromDoc(Document document) throws IOException {
-        //Serialize DOM
-        OutputFormat format    = new OutputFormat(document);
-        format.setOmitXMLDeclaration(true);
-        // as a String
-        StringWriter stringOut = new StringWriter();    
-        XMLSerializer serial   = new XMLSerializer(stringOut, 
-                                                    format);
-        serial.serialize(document);
-       
-        return stringOut.toString(); 
-       
-    }
-
     private static void visitNodesForNameSpace(Node node, Map<String, String> namespaces)
{
         if (node instanceof Element) {
             Element element = (Element)node;



Mime
View raw message