Class SAXHelper
java.lang.Object
org.dom4j.io.SAXHelper
SAXHelper
contains some helper methods for working with SAX
and XMLReader objects.
- Version:
- $Revision: 1.18 $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XMLReader
createXMLReader
(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 XMLReader
createXMLReaderViaJAXP
(boolean validating, boolean namespaceAware) This method attempts to use JAXP to locate the SAX2 XMLReader implementation.protected static boolean
static boolean
setParserFeature
(XMLReader reader, String featureName, boolean value) static boolean
setParserProperty
(XMLReader reader, String propertyName, Object value)
-
Field Details
-
loggedWarning
private static boolean loggedWarning
-
-
Constructor Details
-
SAXHelper
protected SAXHelper()
-
-
Method Details
-
setParserProperty
-
setParserFeature
-
createXMLReader
Creats 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:
SAXException
- DOCUMENT ME!
-
createXMLReaderViaJAXP
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()
-