summaryrefslogtreecommitdiffstats
path: root/org/madore
diff options
context:
space:
mode:
Diffstat (limited to 'org/madore')
-rw-r--r--org/madore/damlengine/DamlEngine.java21
1 files changed, 8 insertions, 13 deletions
diff --git a/org/madore/damlengine/DamlEngine.java b/org/madore/damlengine/DamlEngine.java
index 696f509..80b1f2d 100644
--- a/org/madore/damlengine/DamlEngine.java
+++ b/org/madore/damlengine/DamlEngine.java
@@ -2,17 +2,15 @@ package org.madore.damlengine;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
import org.apache.xerces.dom.DOMImplementationSourceImpl;
import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl;
+import org.apache.xml.serialize.XHTMLSerializer;
+import org.apache.xml.serialize.OutputFormat;
+@SuppressWarnings("deprecation")
public final class DamlEngine {
private static Document doc;
@@ -29,6 +27,7 @@ public final class DamlEngine {
final Resolver resolver = new Resolver();
final DOMImplementationSourceImpl source
= new DOMImplementationSourceImpl();
+ @SuppressWarnings("unused")
final DOMImplementation impl
= source.getDOMImplementation("XML 3.0 Core 3.0 LS 3.0");
final DocumentBuilderFactory dbf = new DocumentBuilderFactoryImpl();
@@ -36,13 +35,6 @@ public final class DamlEngine {
dbf.setValidating(false);
final DocumentBuilder db = dbf.newDocumentBuilder();
db.setEntityResolver((EntityResolver)resolver);
- final TransformerFactory tf = TransformerFactory.newInstance();
- final Transformer t = tf.newTransformer();
- t.setOutputProperty(OutputKeys.METHOD, "xml");
- t.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,
- "-//W3C//DTD XHTML 1.0 Strict//EN");
- t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
if ( args.length == 0 ) {
System.err.println("expecting filename as argument");
@@ -51,7 +43,10 @@ public final class DamlEngine {
for (String fname : args) {
doc = db.parse(fname);
processDocument();
- t.transform(new DOMSource(doc), new StreamResult(System.out));
+ OutputFormat format = new OutputFormat(doc);
+ XHTMLSerializer serializer = new XHTMLSerializer(format);
+ serializer.setOutputByteStream(System.out);
+ serializer.serialize(doc);
}
}