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;
  }
Exemple #2
0
 private static SAXParser getParser(boolean validate)
     throws SAXException, ParserConfigurationException {
   SAXParserFactory factory = SAXParserFactory.newInstance();
   factory.setValidating(validate);
   return factory.newSAXParser();
 }