diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-01 23:24:48 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-01 23:24:48 +0000 |
commit | 25f532500e7a5ca82178cdb3085d588d09ed273e (patch) | |
tree | 313734ad042ecb545a2a8c0853eeb01606a63d50 /java/sca | |
parent | 4ce667626b177eee583a7b79d14ad433af3e7086 (diff) |
Removing dependency on implementation class and moving to use StAXHelper
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820843 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r-- | java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java index 3e5562e431..9a719fc743 100644 --- a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java +++ b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java @@ -24,7 +24,8 @@ import java.io.StringWriter; 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 @@ import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter; */ 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 @@ public class XMLStreamReader2JSON extends BaseTransformer<XMLStreamReader, Objec 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) { |