[jdom-interest] Turning off validation against a DTD
Indrayan, Rahul
rindrayan at ets.org
Tue Sep 10 16:14:17 PDT 2002
I have the following code: -
import java.io.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
public class Spike {
public static void main(String args[]) {
try {
SAXBuilder builder = new SAXBuilder(false);
builder.setExpandEntities(false);
String xml = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><!DOCTYPE root SYSTEM \"foo.dtd\"><root><proof>This is
á foofoo ó stuff!</proof></root>";
new XMLOutputter().output(
builder.build(new StringReader(xml)),
new PrintWriter(new
FileWriter("c:\\proof.xml")));
}
catch (Exception e) { e.printStackTrace(); }
}
}
I do not want to validate the XML in this case, and therefore I do:
SAXBuilder builder = new SAXBuilder(false). However, initializing builder
with the false parameter, it still validates it against the DTD.
How can I turn off validation and just make it write the XML to a file?
Thanks!
**************************************************************************
This e-mail and any files transmitted with it may contain privileged or
confidential information. It is solely for use by the individual for whom
it is intended, even if addressed incorrectly. If you received this e-mail
in error, please notify the sender; do not disclose, copy, distribute, or
take any action in reliance on the contents of this information; and delete
it from your system. Any other use of this e-mail is prohibited. Thank you
for your compliance.
More information about the jdom-interest
mailing list