Top Description Fields Constructors Methods
org.dom4j.io

pack-priv Class SAXHelper

extends Object
Class Inheritance
Imports
org.xml.sax.SAXException, .SAXNotRecognizedException, .SAXNotSupportedException, .XMLReader, org.xml.sax.helpers.XMLReaderFactory, javax.xml.parsers.SAXParserFactory

SAXHelper contains some helper methods for working with SAX and XMLReader objects.

Author
James Strachan
Version
$Revision: 1.18 $

Field Summary

Modifier and TypeField and Description
private static boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static XMLReader

Returns:

DOCUMENT ME!
createXMLReader
(boolean
DOCUMENT ME!
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

Returns:

DOCUMENT ME!
createXMLReaderViaJAXP
(boolean
DOCUMENT ME!
validating
,
boolean
DOCUMENT ME!
namespaceAware
)

This method attempts to use JAXP to locate the SAX2 XMLReader implementation.

protected static boolean
public static boolean
setParserFeature(XMLReader reader, String featureName, boolean value)

public static boolean
setParserProperty(XMLReader reader, String propertyName, Object value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggedWarningback to summary
private static boolean loggedWarning

Constructor Detail

SAXHelperback to summary
protected SAXHelper()

Method Detail

createXMLReaderback to summary
public static XMLReader createXMLReader(boolean validating) throws SAXException

Creats a default XMLReader via the org.xml.sax.driver system property or JAXP if the system property is not set. This method internally calls SAXParserFactory.newInstance().newSAXParser().getXMLReader() or XMLReaderFactory#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:boolean

DOCUMENT ME!

Returns:XMLReader

DOCUMENT ME!

Exceptions
SAXException:
DOCUMENT ME!
createXMLReaderViaJAXPback to summary
protected static 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:boolean

DOCUMENT ME!

namespaceAware:boolean

DOCUMENT ME!

Returns:XMLReader

DOCUMENT ME!

isVerboseErrorReportingback to summary
protected static boolean isVerboseErrorReporting()
setParserFeatureback to summary
public static boolean setParserFeature(XMLReader reader, String featureName, boolean value)
setParserPropertyback to summary
public static boolean setParserProperty(XMLReader reader, String propertyName, Object value)