Two questions (as I am new to Xerces):
1) Is the SAX Parser in Xerces capable of validation?
2) What is the preferred way to set this mechanism?
I know SAX2 and the Configurable interface say to do something like:
// Request core feature - validation
parser.setFeature("http://xml.org/....", true);
parser.parse(uri);
But to do this, the only way I seem to be able to get the parser is to
instantiate it directly. In other words:
Parser parser =
Class.forName("org.apache.xerces.parsers.SAXParser").newInstance();
// Do other things with this parser
But this seems to not be so great. I would much rather use the
ParserFactory from SAX:
Parser parser =
ParserFactory.makeParser("org.apache.xerces.parsers.SAXParser");
I know the differnce isn't much, but it seems to be the best way to do
this, as well as much more OO (IMHO). But it doesn't seem that
org.xml.sax.Parser implements Configurable. So is there a standard way
to get a SAX Parser and set it's validation feature, without resorting
to a "brute-force" newInstance() call on the class? Any help would be
appreciated.
Thanks,
Brett