01: package uk.org.ponder.saxalizer;
02:
03: import org.xml.sax.Parser;
04:
05: /** A tiny utility class to unify the process of obtaining SaxParsers from whatever
06: * peculiar scheme the author created. At present it is designed for the Sun version
07: * 1.0 JAXP parsers.
08: */
09:
10: public class SAXParserFactory {
11: private static javax.xml.parsers.SAXParserFactory spf = javax.xml.parsers.SAXParserFactory
12: .newInstance();
13: static {
14: spf.setValidating(false);
15: }
16:
17: /** Returns a new SAX Parser object.
18: * @return a new parser object.
19: */
20:
21: public static Parser newParser() {
22: try {
23: javax.xml.parsers.SAXParser saxparser = spf.newSAXParser();
24: // unwrap the crap that jaxp puts around the parser
25: return saxparser.getParser();
26: } catch (Exception e) {
27: e.printStackTrace();
28: }
29: return null;
30:
31: // return new com.jclark.xml.sax.Driver();
32: }
33: }
|