Andrew Welch wrote:
I'd like to validate an XML file before transforming it, and am wondering if there's an easy way to do it?
try:
parser.setFeature (
"http://xml.org/sax/features/validation",
true);
Hmm... How do I get a handle on the parser? I assume by parser you mean an XMLReader?
Also, does anyone know if the code fragment under "Explicitly working with SAX" at http://xml.apache.org/xalan-j/usagepatterns.html#sax is correct? After cutting and pasting that bit of code, cleaning it up and compiling it, I cannot seem to get it to work. I keep getting an error along the lines of "Warning: unrecognized element foo" where foo is my root element. The XSL and XML files I'm testing this with works perfectly fine with org.apache.xalan.xslt.Process.
Thanks, -Mark
