DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
docFactory.setNamespaceAware(true);
docFactory.setValidating(true);
try {
docBuilder_ = docFactory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
}
Document doc = docBuilder_.parse(f);
Shouldn't enabling validation here work?
It definitely does something because I don't get the "grammar not found" error when validation is set to false.
Also, the validation "feature" has "sax" in the feature name. I would think that means it's a SAX specific feature.
Thanks
Ian Roberts wrote:
On Wed, 21 Feb 2001, Alex Neth wrote:Also, does validation have to be enabled in order to get the parser to load
the schema and apply fixed/default attribute values?
To get the parser to do schema validation at all, you need to set the
validation, validation/schema and namespaces features (see the Features
page of the xerces-j website for the exact feature URIs).
Ian
