Code example for SAXParser

Methods: getParser

0
    ParserAdapter pa = new ParserAdapter(sp.getParser());
    pa.setContentHandler(handler);
    pa.parse(new InputSource(reader));
  } 
 
  private SAXParser createSaxParser() {
    try { 
      return parserFactory.newSAXParser();
    } catch (ParserConfigurationException e) {
      // The parser factory failing for any reasons should be considered 
      // a bug in this class, since the parser configuration is hardcoded. 
      throw new IllegalStateException("Invalid parser configuration", e);
    } catch (SAXException e) {
      throw new IllegalStateException("Failed to create a SAX parser", e);
    } 
  } 
 
}