How can I get the Xerces 2 (1.1.4) DOM parser to validate against a local DTD? When I run my basic
test app, it does not throw any exceptions when running through an xml that contains elements not described in the DTD, therefore no validation is occuring.
The closest thing I found on forums was
here, which does not work, reference the parser.setFeature(...) method. I was confused by this anyway since this is a SAX call. Other similar forum posts were not answered or had bad links.
(Note that the DTD is structured properly and is successfully loaded by the XML file being parsed. To be sure, I renamed/moved the DTD, which threw an exception on debug when parsing, proving the DTD was originally being loaded)
code snippet:
I did recall using setValidating(boolean) method on an older DOM parser implementation (XML4J, I think). I didn't find anything equivalent to it in Xerces 1.1.4
Thanks in advance.
---
[ October 17, 2002: Message edited by: Toby Davis ]