tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r820843 - /tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java
Date Thu, 01 Oct 2009 23:24:48 GMT
Author: lresende
Date: Thu Oct  1 23:24:48 2009
New Revision: 820843

URL: http://svn.apache.org/viewvc?rev=820843&view=rev
Log:
Removing dependency on implementation class and moving to use StAXHelper

Modified:
    tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java

Modified: tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java?rev=820843&r1=820842&r2=820843&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java
(original)
+++ tuscany/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java
Thu Oct  1 23:24:48 2009
@@ -24,7 +24,8 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.tuscany.sca.common.xml.stax.impl.XMLStreamSerializer;
+import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.PullTransformer;
 import org.apache.tuscany.sca.databinding.TransformationContext;
 import org.apache.tuscany.sca.databinding.TransformationException;
@@ -36,7 +37,13 @@
  */
 public class XMLStreamReader2JSON extends BaseTransformer<XMLStreamReader, Object>
implements
     PullTransformer<XMLStreamReader, Object> {
-    
+	
+	private StAXHelper staxHelper;
+	 
+	public XMLStreamReader2JSON(ExtensionPointRegistry registry) {
+		staxHelper = StAXHelper.getInstance(registry);
+    }
+	
     @Override
     protected Class<XMLStreamReader> getSourceType() {
         return XMLStreamReader.class;
@@ -51,8 +58,7 @@
         try {
             StringWriter writer = new StringWriter();
             XMLStreamWriter jsonWriter = new BadgerFishXMLStreamWriter(writer);
-            XMLStreamSerializer serializer = new XMLStreamSerializer();
-            serializer.serialize(source, jsonWriter);
+            staxHelper.save(source, jsonWriter);
             source.close();
             Class type = null;
             if (context != null && context.getTargetDataType() != null) {



Mime
View raw message