Ejemplo n.º 1
0
  private static SAXParserFactory makeParserFactory(boolean validating, boolean ns) {
    SAXParserFactory factory = null;

    // create factory according to javax.xml.parsers.SAXParserFactory property
    // or platform default (i.e. com.sun...)
    try {
      factory = SAXParserFactory.newInstance();
      factory.setValidating(validating);
      factory.setNamespaceAware(ns);

    } catch (FactoryConfigurationError err) {
      notifyFactoryErr(err, "javax.xml.parsers.SAXParserFactory"); // NOI18N
      throw err;
    }

    return factory;
  }
Ejemplo n.º 2
0
 private static SAXParser getParser(boolean validate)
     throws SAXException, ParserConfigurationException {
   SAXParserFactory factory = SAXParserFactory.newInstance();
   factory.setValidating(validate);
   return factory.newSAXParser();
 }