Code example for SAXParserFactory

Methods: setFeature, setNamespaceAware

0
  public W3cDomHelper(TreeLogger logger, ResourceOracle resourceOracle) {
    this.logger = logger;
    this.resourceOracle = resourceOracle;
    factory = SAXParserFactory.newInstance();
    try { 
      factory.setFeature(LOAD_EXTERNAL_DTD, true);
    } catch (ParserConfigurationException e) {
      throw new RuntimeException(e);
    } catch (SAXException e) {
      // ignore since parser doesn't know about this feature 
    } 
    factory.setNamespaceAware(true);
  } 
 
  /** 
   * Creates an XML document model with the given contents. 
   */ 
  public Document documentFor(String string, String resourcePath)
      throws SAXParseException { 
    try { 
      // laaglu