List of usage examples for javax.xml.parsers SAXParserFactory getFeature
public abstract boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException;
From source file:Main.java
public static void main(String[] argv) throws Exception { SAXParserFactory factory = SAXParserFactory.newInstance(); String features[] = { "http://xml.org/sax/features/namespaces", "http://xml.org/sax/features/namespace-prefixes", "http://xml.org/sax/features/string-interning", "http://xml.org/sax/features/validation", "http://xml.org/sax/features/external-general-entities", "http://xml.org/sax/features/external-parameter-entities", "http://xml.org/sax/features/lexical-handler/parameter-entities", }; for (int i = 0; i < features.length; i++) { System.out.print("\t- '" + features[i] + "' is "); System.out.println("'" + factory.getFeature(features[i]) + "'"); }//from ww w .java2 s . c o m }
From source file:Main.java
private static boolean canDisableExternalDtds(SAXParserFactory parserFactory) { if (canDisableExternalDtds == null) { try {/* w ww.ja va 2 s. c om*/ parserFactory.getFeature(XERCES_LOAD_EXTERNAL_DTD); canDisableExternalDtds = Boolean.TRUE; } catch (Exception ex) { canDisableExternalDtds = Boolean.FALSE; } } return canDisableExternalDtds.booleanValue(); }