summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/common-xml
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-08-06 23:55:35 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-08-06 23:55:35 +0000
commitc36cfa99af46d380b7c856797945311c1c661839 (patch)
treedd14549de53aa0bdc3053045682a5886556db2fe /java/sca/modules/common-xml
parent7f4602c41b68994b3e9cf1bdb24c82fa20bbc329 (diff)
Add constructors that take factories
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@801846 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/common-xml')
-rw-r--r--java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/dom/DOMHelper.java12
-rw-r--r--java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/sax/SAXHelper.java12
-rw-r--r--java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/stax/StAXHelper.java17
3 files changed, 37 insertions, 4 deletions
diff --git a/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/dom/DOMHelper.java b/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/dom/DOMHelper.java
index cc2460b8f9..90b49b9f5b 100644
--- a/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/dom/DOMHelper.java
+++ b/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/dom/DOMHelper.java
@@ -52,7 +52,7 @@ import org.xml.sax.ext.LexicalHandler;
*
* @version $Rev$ $Date$
*/
-public final class DOMHelper {
+public class DOMHelper {
private DocumentBuilderFactory documentBuilderFactory;
private TransformerFactory transformerFactory;
@@ -63,6 +63,16 @@ public final class DOMHelper {
transformerFactory = factories.getFactory(TransformerFactory.class);
}
+ /**
+ * @param documentBuilderFactory
+ * @param transformerFactory
+ */
+ public DOMHelper(DocumentBuilderFactory documentBuilderFactory, TransformerFactory transformerFactory) {
+ super();
+ this.documentBuilderFactory = documentBuilderFactory;
+ this.transformerFactory = transformerFactory;
+ }
+
public Document newDocument() {
return newDocumentBuilder().newDocument();
diff --git a/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/sax/SAXHelper.java b/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/sax/SAXHelper.java
index 55635a258c..e8aa9605c9 100644
--- a/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/sax/SAXHelper.java
+++ b/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/sax/SAXHelper.java
@@ -34,10 +34,18 @@ import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
/**
- *
+ * Helper class for SAX parsing
*/
public class SAXHelper {
- private SAXParserFactory saxParserFactory;
+ private final SAXParserFactory saxParserFactory;
+
+ /**
+ * @param saxParserFactory
+ */
+ public SAXHelper(SAXParserFactory saxParserFactory) {
+ super();
+ this.saxParserFactory = saxParserFactory;
+ }
public SAXHelper(ExtensionPointRegistry registry) {
FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
diff --git a/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/stax/StAXHelper.java b/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/stax/StAXHelper.java
index 5283de272d..e5bf05a657 100644
--- a/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/stax/StAXHelper.java
+++ b/java/sca/modules/common-xml/src/main/java/org/apache/tuscany/sca/common/xml/stax/StAXHelper.java
@@ -46,7 +46,10 @@ import org.w3c.dom.Node;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
-public final class StAXHelper {
+/**
+ * Helper class for StAX
+ */
+public class StAXHelper {
private final XMLInputFactory inputFactory;
private final XMLOutputFactory outputFactory;
private final DOMHelper domHelper;
@@ -60,6 +63,18 @@ public final class StAXHelper {
domHelper = utilities.getUtility(DOMHelper.class);
}
+ /**
+ * @param inputFactory
+ * @param outputFactory
+ * @param domHelper
+ */
+ public StAXHelper(XMLInputFactory inputFactory, XMLOutputFactory outputFactory, DOMHelper domHelper) {
+ super();
+ this.inputFactory = inputFactory;
+ this.outputFactory = outputFactory;
+ this.domHelper = domHelper;
+ }
+
public XMLStreamReader createXMLStreamReader(InputStream inputStream) throws XMLStreamException {
return inputFactory.createXMLStreamReader(inputStream);
}