Package org.dom4j.io
Class SAXHelper
- java.lang.Object
-
- org.dom4j.io.SAXHelper
-
class SAXHelper extends java.lang.ObjectSAXHelpercontains some helper methods for working with SAX and XMLReader objects.- Version:
- $Revision: 1.18 $
-
-
Field Summary
Fields Modifier and Type Field Description private static booleanloggedWarning
-
Constructor Summary
Constructors Modifier Constructor Description protectedSAXHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.xml.sax.XMLReadercreateXMLReader(boolean validating)Creats a default XMLReader via the org.xml.sax.driver system property or JAXP if the system property is not set.protected static org.xml.sax.XMLReadercreateXMLReaderViaJAXP(boolean validating, boolean namespaceAware)This method attempts to use JAXP to locate the SAX2 XMLReader implementation.protected static booleanisVerboseErrorReporting()static booleansetParserFeature(org.xml.sax.XMLReader reader, java.lang.String featureName, boolean value)static booleansetParserProperty(org.xml.sax.XMLReader reader, java.lang.String propertyName, java.lang.Object value)
-
-
-
Method Detail
-
setParserProperty
public static boolean setParserProperty(org.xml.sax.XMLReader reader, java.lang.String propertyName, java.lang.Object value)
-
setParserFeature
public static boolean setParserFeature(org.xml.sax.XMLReader reader, java.lang.String featureName, boolean value)
-
createXMLReader
public static org.xml.sax.XMLReader createXMLReader(boolean validating) throws org.xml.sax.SAXExceptionCreats a default XMLReader via the org.xml.sax.driver system property or JAXP if the system property is not set. This method internally callsSAXParserFactory.newInstance().newSAXParser().getXMLReader()orXMLReaderFactory.createXMLReader(). Be sure to configure returned reader if the default configuration does not suit you. Consider setting the following properties:reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); reader.setFeature("http://xml.org/sax/features/external-general-entities", false); reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);- Parameters:
validating- DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
org.xml.sax.SAXException- DOCUMENT ME!
-
createXMLReaderViaJAXP
protected static org.xml.sax.XMLReader createXMLReaderViaJAXP(boolean validating, boolean namespaceAware)This method attempts to use JAXP to locate the SAX2 XMLReader implementation. This method uses reflection to avoid being dependent directly on the JAXP classes.- Parameters:
validating- DOCUMENT ME!namespaceAware- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
isVerboseErrorReporting
protected static boolean isVerboseErrorReporting()
-
-