Author: dkulp
Date: Wed Feb 13 11:22:39 2008
New Revision: 627567
URL: http://svn.apache.org/viewvc?rev=627567&view=rev
Log:
Merged revisions 627510 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r627510 | dkulp | 2008-02-13 11:24:12 -0500 (Wed, 13 Feb 2008) | 2 lines
Updates to allow the xml printing to honor any encoding flag set in the
Document object.
........
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java?rev=627567&r1=627566&r2=627567&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
Wed Feb 13 11:22:39 2008
@@ -64,6 +64,7 @@
import org.xml.sax.SAXException;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
public final class XMLUtils {
@@ -154,10 +155,18 @@
writeTo(new DOMSource(node), os);
}
public static void writeTo(Node node, OutputStream os, int indent) {
- writeTo(new DOMSource(node), os, indent, "utf-8", "no");
+ writeTo(new DOMSource(node), os, indent);
}
public static void writeTo(Source src, OutputStream os) {
- writeTo(src, os, -1, "utf-8", "no");
+ writeTo(src, os, -1);
+ }
+ public static void writeTo(Source src, OutputStream os, int indent) {
+ String enc = null;
+ if (src instanceof DOMSource
+ && ((DOMSource)src).getNode() instanceof Document) {
+ enc = ((Document)((DOMSource)src).getNode()).getXmlEncoding();
+ }
+ writeTo(src, os, indent, enc, "no");
}
public static void writeTo(Source src,
OutputStream os,
@@ -166,6 +175,10 @@
String omitXmlDecl) {
Transformer it;
try {
+ if (StringUtils.isEmpty(charset)) {
+ charset = "utf-8";
+ }
+
it = newTransformer();
it.setOutputProperty(OutputKeys.METHOD, "xml");
if (indent > -1) {
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=627567&r1=627566&r2=627567&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Wed Feb 13 11:22:39 2008
@@ -47,6 +47,7 @@
import javax.wsdl.xml.WSDLWriter;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -215,8 +216,8 @@
el.setAttribute("location", base + "?wsdl=" + sl);
}
}
-
- XMLUtils.writeTo(doc, os);
+ doc.setXmlStandalone(true);
+ XMLUtils.writeTo(new DOMSource(doc), os);
} catch (WSDLException wex) {
throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
LOG,