diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-19 05:27:58 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-19 05:27:58 +0000 |
commit | 5f3869c451e46aadc943d00087d6847877dd1c50 (patch) | |
tree | e22baaff1fb9ea42606b7d04af52e032e3bc03bc /java/sca/modules/xsd-xml/src | |
parent | 60744a36aae604ac3c4499ed54f1082ab8f5947d (diff) |
Merging the 1.x delta on top of the equinox based modules
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@718858 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/xsd-xml/src')
3 files changed, 8 insertions, 5 deletions
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 ef4b5aa0bc..1d84b6c0a0 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.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; @@ -43,10 +44,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(FactoryExtensionPoint modelFactories, Monitor monitor) { this.factory = modelFactories.getFactory(XSDFactory.class); + this.inputFactory = modelFactories.getFactory(XMLInputFactory.class); this.monitor = monitor; } @@ -90,7 +93,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); } |