M
mark
I've been having a lot of trouble trying to create an XML file from a
DOM tree. My code works fine inside of netbeans, but I get lots of
erros when I try to run it independantly.
The error message I keep getting is
[java] java.lang.RuntimeException:
org.apache.xml.utils.WrappedRuntimeException: The output format must
have a '{http://xml.apache.org/xalan}content-handler' property!
Both Xerces and crimson are in my classpath, and I've tried using both
Java 1.5 and 1.4.2. Any ideas what I'm doing wrong?
This is the code I'm trying to write the file with:
public void writeXML(Document doc, OutputStream ostream)
{
try
{
//Format & write output
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
DOMSource ds = new DOMSource(doc);
StreamResult sr = new StreamResult(ostream);
t.transform(ds, sr);
}
catch (Exception e)
{
e.printStackTrace();
}
}
Mark McKay
DOM tree. My code works fine inside of netbeans, but I get lots of
erros when I try to run it independantly.
The error message I keep getting is
[java] java.lang.RuntimeException:
org.apache.xml.utils.WrappedRuntimeException: The output format must
have a '{http://xml.apache.org/xalan}content-handler' property!
Both Xerces and crimson are in my classpath, and I've tried using both
Java 1.5 and 1.4.2. Any ideas what I'm doing wrong?
This is the code I'm trying to write the file with:
public void writeXML(Document doc, OutputStream ostream)
{
try
{
//Format & write output
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
DOMSource ds = new DOMSource(doc);
StreamResult sr = new StreamResult(ostream);
t.transform(ds, sr);
}
catch (Exception e)
{
e.printStackTrace();
}
}
Mark McKay