Class XercesParser
java.lang.Object
org.apache.commons.digester.parser.XercesParser
Create a
SAXParser based on the underlying Xerces version.
Currently, Xerces 2.3 and up doesn't implement schema validation the same way
2.1 was. In other to support schema validation in a portable way between
parser, some features/properties need to be set.- Since:
- 1.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static StringThe JAXP 1.2 property to set up the schemaLanguage used.private static final StringThe JAXP 1.2 property required to set up the schema location.protected static LogThe Log to which all SAX event related logging calls will be made.protected static floatAfloatrepresenting the underlying Xerces versionprotected static StringThe current Xerces version.protected static StringXerces dynamic validation propertyprotected static StringXerces schema validation property -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidconfigureOldXerces(SAXParser parser, Properties properties) Configure schema validation as recommended by the JAXP 1.2 spec.private static voidconfigureXerces(SAXParserFactory factory) Configure schema validation as recommended by the Xerces spec.private static StringReturn the current Xerces version.static SAXParsernewSAXParser(Properties properties) Create aSAXParserbased on the underlyingXercesversion.
-
Field Details
-
log
protected static Log logThe Log to which all SAX event related logging calls will be made. -
JAXP_SCHEMA_SOURCE
The JAXP 1.2 property required to set up the schema location.- See Also:
-
JAXP_SCHEMA_LANGUAGE
The JAXP 1.2 property to set up the schemaLanguage used. -
XERCES_DYNAMIC
Xerces dynamic validation property -
XERCES_SCHEMA
Xerces schema validation property -
version
protected static float versionAfloatrepresenting the underlying Xerces version -
versionNumber
The current Xerces version.
-
-
Constructor Details
-
XercesParser
public XercesParser()
-
-
Method Details
-
getXercesVersion
Return the current Xerces version.- Returns:
- the current Xerces version.
-
newSAXParser
public static SAXParser newSAXParser(Properties properties) throws ParserConfigurationException, SAXException, SAXNotSupportedException Create aSAXParserbased on the underlyingXercesversion.- Parameters:
properties- parser specific properties/features- Returns:
- an XML Schema/DTD enabled
SAXParser - Throws:
ParserConfigurationExceptionSAXExceptionSAXNotSupportedException
-
configureOldXerces
private static void configureOldXerces(SAXParser parser, Properties properties) throws ParserConfigurationException, SAXNotSupportedException Configure schema validation as recommended by the JAXP 1.2 spec. Thepropertiesobject may contains information about the schema local and language.- Parameters:
properties- parser optional info- Throws:
ParserConfigurationExceptionSAXNotSupportedException
-
configureXerces
private static void configureXerces(SAXParserFactory factory) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException Configure schema validation as recommended by the Xerces spec. Both DTD and Schema validation will be enabled simultaneously.NOTE: This method is broken. It is supposed to set up validation against the schema specified in property "schemaLocation", but it doesn't.
- Parameters:
factory- SAXParserFactory to be configured- Throws:
ParserConfigurationExceptionSAXNotRecognizedExceptionSAXNotSupportedException
-