cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1303078 - in /cxf/branches/2.4.x-fixes: ./ common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Date Tue, 20 Mar 2012 18:37:24 GMT
Author: dkulp
Date: Tue Mar 20 18:37:24 2012
New Revision: 1303078

URL: http://svn.apache.org/viewvc?rev=1303078&view=rev
Log:
Merged revisions 1303011 via  svn merge from
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

........
  r1303011 | dkulp | 2012-03-20 13:14:31 -0400 (Tue, 20 Mar 2012) | 9 lines
  
  Merged revisions 1302997 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1302997 | dkulp | 2012-03-20 13:01:42 -0400 (Tue, 20 Mar 2012) | 2 lines
  
    [CXF-4183] Use our own DOM writer to avoid issues with Sun's.
  
  ........
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=1303078&r1=1303077&r2=1303078&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
(original)
+++ cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Tue Mar 20 18:37:24 2012
@@ -52,6 +52,7 @@ import javax.xml.stream.events.StartElem
 import javax.xml.stream.events.XMLEvent;
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
@@ -247,6 +248,19 @@ public final class StaxUtils {
     }
     
     public static XMLStreamWriter createXMLStreamWriter(Result r) {
+        if (r instanceof DOMResult) {
+            //use our own DOM writer to avoid issues with Sun's 
+            //version that doesn't support getNamespaceContext
+            DOMResult dr = (DOMResult)r;
+            Node nd = dr.getNode();
+            if (nd instanceof Document) {
+                return new W3CDOMStreamWriter((Document)nd);
+            } else if (nd instanceof Element) {
+                return new W3CDOMStreamWriter((Element)nd);
+            } else if (nd instanceof DocumentFragment) {
+                return new W3CDOMStreamWriter((DocumentFragment)nd);
+            }
+        }
         XMLOutputFactory factory = getXMLOutputFactory();
         try {
             return factory.createXMLStreamWriter(r);



Mime
View raw message