diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-30 04:14:28 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-30 04:14:28 +0000 |
commit | f05c9422b3e5212d88384c141a0825c15b94a795 (patch) | |
tree | 14512d81af7117809f13780af2b49d3a87803749 /java/sca/modules | |
parent | 3d7c9633329afd0e0f8648ceb74584bb0872fdca (diff) |
Use the XMLInputFactory from the registry instead of a local one
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@700332 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
4 files changed, 11 insertions, 7 deletions
diff --git a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java index eb276a1908..105b3da7fa 100644 --- a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java +++ b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java @@ -21,10 +21,11 @@ package org.apache.tuscany.sca.interfacedef.wsdl.xml; import java.net.URL; +import javax.xml.stream.XMLInputFactory; + import junit.framework.Assert; import org.apache.tuscany.sca.xsd.xml.XMLDocumentHelper; - import org.junit.Before; import org.junit.Test; @@ -45,7 +46,7 @@ public class XMLDocumentHelperTestCase { @Test public void testReadTNS() throws Exception { - String tns = XMLDocumentHelper.readTargetNamespace(wsdl, XMLDocumentHelper.WSDL11, true, "targetNamespace"); + String tns = XMLDocumentHelper.readTargetNamespace(wsdl, XMLDocumentHelper.WSDL11, true, "targetNamespace", XMLInputFactory.newInstance()); Assert.assertEquals("http://helloworld", tns); } diff --git a/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java b/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java index 595795a2d9..a057bbe155 100644 --- a/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java +++ b/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java @@ -150,9 +150,7 @@ public class XMLDocumentHelper { return inputSource; } - private final static XMLInputFactory inputFactory = XMLInputFactory.newInstance(); - - public static String readTargetNamespace(URL doc, QName element, boolean rootOnly, String attribute) + public static String readTargetNamespace(URL doc, QName element, boolean rootOnly, String attribute, XMLInputFactory inputFactory) throws IOException, XMLStreamException { if (attribute == null) { attribute = "targetNamespace"; diff --git a/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java b/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java index f54212de9a..66e2e46148 100644 --- a/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java +++ b/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java @@ -23,6 +23,7 @@ import java.net.URI; import java.net.URL; import javax.xml.namespace.QName; +import javax.xml.stream.XMLInputFactory; import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; @@ -44,10 +45,12 @@ import org.apache.tuscany.sca.xsd.XSDefinition; public class XSDDocumentProcessor implements URLArtifactProcessor<XSDefinition> { private XSDFactory factory; + private XMLInputFactory inputFactory; private Monitor monitor; public XSDDocumentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { this.factory = modelFactories.getFactory(XSDFactory.class); + this.inputFactory = modelFactories.getFactory(XMLInputFactory.class); this.monitor = monitor; } @@ -91,7 +94,7 @@ public class XSDDocumentProcessor implements URLArtifactProcessor<XSDefinition> protected XSDefinition indexRead(URL doc) throws Exception { XSDefinition xsd = factory.createXSDefinition(); xsd.setUnresolved(true); - xsd.setNamespace(XMLDocumentHelper.readTargetNamespace(doc, XSD, true, "targetNamespace")); + xsd.setNamespace(XMLDocumentHelper.readTargetNamespace(doc, XSD, true, "targetNamespace", inputFactory)); xsd.setLocation(doc.toURI()); xsd.setUnresolved(false); return xsd; diff --git a/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.java b/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.java index fbcdf3d861..f245377d87 100644 --- a/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.java +++ b/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.java @@ -21,6 +21,8 @@ package org.apache.tuscany.sca.xsd.xml; import java.net.URL; +import javax.xml.stream.XMLInputFactory; + import junit.framework.Assert; import org.junit.Before; @@ -42,7 +44,7 @@ public class XMLDocumentHelperTestCase { @Test public void testReadTNS() throws Exception { - String tns = XMLDocumentHelper.readTargetNamespace(xsd, XMLDocumentHelper.XSD, true, null); + String tns = XMLDocumentHelper.readTargetNamespace(xsd, XMLDocumentHelper.XSD, true, null, XMLInputFactory.newInstance()); Assert.assertEquals("http://greeting", tns); } |