summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules')
-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);
}