[XOM-interest] XML Schema validation via JAXP

Elliotte Harold elharo at metalab.unc.edu
Sat Aug 11 19:40:25 EDT 2007


Peter Stibrany wrote:

> This works for me in Java 1.5, where it throws ParsingException when
> document isn't valid. Unfortunately, on Java 6 it returns parsed
> document even if it is invalid with respect to schema.
> 

1. I suggest using XMLReaderFactory instead of SAXParserFactory, though 
that likely won't fix the problem.

2. You probably need to install your own SAX ErrorHandler that throws an 
exception if the document is invalid.

-- 
Elliotte Rusty Harold  elharo at metalab.unc.edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/


More information about the XOM-interest mailing list