org.apache.xerces.dom

Class DOMConfigurationImpl

Implemented Interfaces:
org.w3c.dom.DOMConfiguration, org.apache.xerces.xni.parser.XMLComponentManager, org.apache.xerces.xni.parser.XMLParserConfiguration

public class DOMConfigurationImpl
extends ParserConfigurationSettings
implements org.apache.xerces.xni.parser.XMLParserConfiguration, org.w3c.dom.DOMConfiguration

Xerces implementation of DOMConfiguration that maintains a table of recognized parameters.
Version:
$Id: DOMConfigurationImpl.java 354522 2005-12-06 19:46:23Z mrglavas $
Authors:
Elena Litani, IBM
Neeraj Bajaj, Sun Microsystems.

Field Summary

protected static String
BALANCE_SYNTAX_TREES
Feature identifier: balance syntax trees.
protected static short
CDATA
protected static short
COMMENTS
protected static String
DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: load external DTD.
protected static String
DTD_VALIDATOR_FACTORY_PROPERTY
Property identifier: datatype validator factory.
protected static String
DTD_VALIDATOR_PROPERTY
Property identifier: DTD validator.
protected static short
DTNORMALIZATION
protected static String
DYNAMIC_VALIDATION
protected static short
ENTITIES
protected static String
ENTITY_MANAGER
Property identifier: entity manager.
protected static String
ENTITY_RESOLVER
Property identifier: entity resolver.
protected static String
ERROR_HANDLER
Property identifier: error handler.
protected static String
ERROR_REPORTER
Property identifier: error reporter.
protected static String
GENERATE_SYNTHETIC_ANNOTATIONS
Feature: generate synthetic annotations
protected static String
GRAMMAR_POOL
Property id: Grammar pool
protected static String
HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations
protected static short
INFOSET_FALSE_PARAMS
protected static short
INFOSET_MASK
protected static short
INFOSET_TRUE_PARAMS
protected static String
JAXP_SCHEMA_LANGUAGE
Property identifier: JAXP schema language / DOM schema-type.
protected static String
JAXP_SCHEMA_SOURCE
Property identifier: JAXP schema source/ DOM schema-location.
protected static short
NAMESPACES
protected static String
NORMALIZE_DATA
protected static short
NSDECL
protected static short
PSVI
protected static String
SCHEMA
protected static String
SCHEMA_ELEMENT_DEFAULT
Feature identifier: send element default value via characters()
protected static String
SCHEMA_FULL_CHECKING
protected static String
SCHEMA_LOCATION
Property identifier: schema location.
protected static String
SCHEMA_NONS_LOCATION
Property identifier: no namespace schema location.
protected static String
SEND_PSVI
sending psvi in the pipeline
protected static short
SPLITCDATA
protected static String
SYMBOL_TABLE
Property identifier: symbol table.
protected static String
USE_GRAMMAR_POOL_ONLY
Feature identifier: use grammar pool only
protected static short
VALIDATE
protected static String
VALIDATE_ANNOTATIONS
Feature identifier: validate annotations
protected static String
VALIDATION_MANAGER
protected static String
WARN_ON_DUPLICATE_ATTDEF
Feature identifier: warn on duplicate attribute definition.
protected static short
WELLFORMED
protected static String
XERCES_NAMESPACES
Feature identifier: namespaces.
protected static String
XERCES_VALIDATION
Feature identifier: validation.
protected static String
XML11_DATATYPE_VALIDATOR_FACTORY
protected static String
XML_STRING
Property identifier: xml string.
protected ArrayList
fComponents
Components.
protected DTDDVFactory
fCurrentDVFactory
Current Datatype validator factory.
protected DTDDVFactory
fDatatypeValidatorFactory
The XML 1.0 Datatype validator factory.
protected DOMErrorHandlerWrapper
fErrorHandlerWrapper
protected XMLErrorReporter
fErrorReporter
Error reporter
protected Locale
fLocale
Locale.
protected SymbolTable
fSymbolTable
Symbol table.
protected ValidationManager
fValidationManager
protected DTDDVFactory
fXML11DatatypeFactory
The XML 1.1 Datatype validator factory.
protected short
features
Normalization features

Fields inherited from class org.apache.xerces.util.ParserConfigurationSettings

PARSER_SETTINGS, fFeatures, fParentSettings, fProperties, fRecognizedFeatures, fRecognizedProperties

Constructor Summary

DOMConfigurationImpl()
Default Constructor.
DOMConfigurationImpl(SymbolTable symbolTable)
Constructs a parser configuration using the specified symbol table.
DOMConfigurationImpl(SymbolTable symbolTable, org.apache.xerces.xni.parser.XMLComponentManager parentSettings)
Constructs a parser configuration using the specified symbol table and parent settings.

Method Summary

protected void
addComponent(org.apache.xerces.xni.parser.XMLComponent component)
boolean
canSetParameter(String name, Object value)
DOM Level 3 WD - Experimental.
protected void
checkProperty(String propertyId)
Check a property.
protected ValidationManager
createValidationManager()
org.apache.xerces.xni.XMLDTDContentModelHandler
getDTDContentModelHandler()
Returns the registered DTD content model handler.
org.apache.xerces.xni.XMLDTDHandler
getDTDHandler()
Returns the registered DTD handler.
org.apache.xerces.xni.XMLDocumentHandler
getDocumentHandler()
Returns the registered document handler.
org.apache.xerces.xni.parser.XMLEntityResolver
getEntityResolver()
Return the current entity resolver.
org.apache.xerces.xni.parser.XMLErrorHandler
getErrorHandler()
Return the current error handler.
boolean
getFeature(String featureId)
Returns the state of a feature.
Locale
getLocale()
Returns the locale.
Object
getParameter(String name)
DOM Level 3 WD - Experimental.
org.w3c.dom.DOMStringList
getParameterNames()
DOM Level 3 CR - Experimental.
void
parse(org.apache.xerces.xni.parser.XMLInputSource inputSource)
Parse an XML document.
protected void
reset()
reset all components before parsing
void
setDTDContentModelHandler(org.apache.xerces.xni.XMLDTDContentModelHandler handler)
Sets the DTD content model handler.
void
setDTDHandler(org.apache.xerces.xni.XMLDTDHandler dtdHandler)
Sets the DTD handler.
protected void
setDTDValidatorFactory(String version)
void
setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler documentHandler)
Sets the document handler on the last component in the pipeline to receive information about the document.
void
setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver resolver)
Sets the resolver used to resolve external entities.
void
setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Allow an application to register an error event handler.
void
setFeature(String featureId, boolean state)
Set the state of a feature.
void
setLocale(Locale locale)
Set the locale to use for messages.
void
setParameter(String name, Object value)
DOM Level 3 WD - Experimental.
void
setProperty(String propertyId, Object value)
setProperty

Methods inherited from class org.apache.xerces.util.ParserConfigurationSettings

addRecognizedFeatures, addRecognizedProperties, checkFeature, checkProperty, getFeature, getProperty, setFeature, setProperty

Field Details

BALANCE_SYNTAX_TREES

protected static final String BALANCE_SYNTAX_TREES
Feature identifier: balance syntax trees.

CDATA

protected static final short CDATA
Field Value:
8

COMMENTS

protected static final short COMMENTS
Field Value:
32

DISALLOW_DOCTYPE_DECL_FEATURE

protected static final String DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: load external DTD.

DTD_VALIDATOR_FACTORY_PROPERTY

protected static final String DTD_VALIDATOR_FACTORY_PROPERTY
Property identifier: datatype validator factory.

DTD_VALIDATOR_PROPERTY

protected static final String DTD_VALIDATOR_PROPERTY
Property identifier: DTD validator.

DTNORMALIZATION

protected static final short DTNORMALIZATION
Field Value:
2

DYNAMIC_VALIDATION

protected static final String DYNAMIC_VALIDATION

ENTITIES

protected static final short ENTITIES
Field Value:
4

ENTITY_MANAGER

protected static final String ENTITY_MANAGER
Property identifier: entity manager.

ENTITY_RESOLVER

protected static final String ENTITY_RESOLVER
Property identifier: entity resolver.

ERROR_HANDLER

protected static final String ERROR_HANDLER
Property identifier: error handler.

ERROR_REPORTER

protected static final String ERROR_REPORTER
Property identifier: error reporter.

GENERATE_SYNTHETIC_ANNOTATIONS

protected static final String GENERATE_SYNTHETIC_ANNOTATIONS
Feature: generate synthetic annotations

GRAMMAR_POOL

protected static final String GRAMMAR_POOL
Property id: Grammar pool

HONOUR_ALL_SCHEMALOCATIONS

protected static final String HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations

INFOSET_FALSE_PARAMS

protected static final short INFOSET_FALSE_PARAMS
Field Value:
14

INFOSET_MASK

protected static final short INFOSET_MASK
Field Value:
815

INFOSET_TRUE_PARAMS

protected static final short INFOSET_TRUE_PARAMS
Field Value:
801

JAXP_SCHEMA_LANGUAGE

protected static final String JAXP_SCHEMA_LANGUAGE
Property identifier: JAXP schema language / DOM schema-type.

JAXP_SCHEMA_SOURCE

protected static final String JAXP_SCHEMA_SOURCE
Property identifier: JAXP schema source/ DOM schema-location.

NAMESPACES

protected static final short NAMESPACES
Field Value:
1

NORMALIZE_DATA

protected static final String NORMALIZE_DATA

NSDECL

protected static final short NSDECL
Field Value:
512

PSVI

protected static final short PSVI
Field Value:
128

SCHEMA

protected static final String SCHEMA

SCHEMA_ELEMENT_DEFAULT

protected static final String SCHEMA_ELEMENT_DEFAULT
Feature identifier: send element default value via characters()

SCHEMA_FULL_CHECKING

protected static final String SCHEMA_FULL_CHECKING

SCHEMA_LOCATION

protected static final String SCHEMA_LOCATION
Property identifier: schema location.

SCHEMA_NONS_LOCATION

protected static final String SCHEMA_NONS_LOCATION
Property identifier: no namespace schema location.

SEND_PSVI

protected static final String SEND_PSVI
sending psvi in the pipeline

SPLITCDATA

protected static final short SPLITCDATA
Field Value:
16

SYMBOL_TABLE

protected static final String SYMBOL_TABLE
Property identifier: symbol table.

USE_GRAMMAR_POOL_ONLY

protected static final String USE_GRAMMAR_POOL_ONLY
Feature identifier: use grammar pool only

VALIDATE

protected static final short VALIDATE
Field Value:
64

VALIDATE_ANNOTATIONS

protected static final String VALIDATE_ANNOTATIONS
Feature identifier: validate annotations

VALIDATION_MANAGER

protected static final String VALIDATION_MANAGER

WARN_ON_DUPLICATE_ATTDEF

protected static final String WARN_ON_DUPLICATE_ATTDEF
Feature identifier: warn on duplicate attribute definition.

WELLFORMED

protected static final short WELLFORMED
Field Value:
256

XERCES_NAMESPACES

protected static final String XERCES_NAMESPACES
Feature identifier: namespaces.

XERCES_VALIDATION

protected static final String XERCES_VALIDATION
Feature identifier: validation.

XML11_DATATYPE_VALIDATOR_FACTORY

protected static final String XML11_DATATYPE_VALIDATOR_FACTORY

XML_STRING

protected static final String XML_STRING
Property identifier: xml string.

fComponents

protected ArrayList fComponents
Components.

fCurrentDVFactory

protected DTDDVFactory fCurrentDVFactory
Current Datatype validator factory.

fDatatypeValidatorFactory

protected DTDDVFactory fDatatypeValidatorFactory
The XML 1.0 Datatype validator factory.

fErrorHandlerWrapper

protected final DOMErrorHandlerWrapper fErrorHandlerWrapper

fErrorReporter

protected XMLErrorReporter fErrorReporter
Error reporter

fLocale

protected Locale fLocale
Locale.

fSymbolTable

protected SymbolTable fSymbolTable
Symbol table.

fValidationManager

protected ValidationManager fValidationManager

fXML11DatatypeFactory

protected DTDDVFactory fXML11DatatypeFactory
The XML 1.1 Datatype validator factory. *

features

protected short features
Normalization features

Constructor Details

DOMConfigurationImpl

protected DOMConfigurationImpl()
Default Constructor.

DOMConfigurationImpl

protected DOMConfigurationImpl(SymbolTable symbolTable)
Constructs a parser configuration using the specified symbol table.
Parameters:
symbolTable - The symbol table to use.

DOMConfigurationImpl

protected DOMConfigurationImpl(SymbolTable symbolTable,
                               org.apache.xerces.xni.parser.XMLComponentManager parentSettings)
Constructs a parser configuration using the specified symbol table and parent settings.
Parameters:
symbolTable - The symbol table to use.
parentSettings - The parent settings.

Method Details

addComponent

protected void addComponent(org.apache.xerces.xni.parser.XMLComponent component)

canSetParameter

public boolean canSetParameter(String name,
                               Object value)
DOM Level 3 WD - Experimental. Check if setting a parameter to a specific value is supported.
Specified by:
canSetParameter in interface org.w3c.dom.DOMConfiguration
Parameters:
name - The name of the parameter to check.
value - An object. if null, the returned value is true.
Returns:
true if the parameter could be successfully set to the specified value, or false if the parameter is not recognized or the requested value is not supported. This does not change the current value of the parameter itself.

checkProperty

protected void checkProperty(String propertyId)
            throws org.apache.xerces.xni.parser.XMLConfigurationException
Check a property. If the property is known and supported, this method simply returns. Otherwise, the appropriate exception is thrown.
Overrides:
checkProperty in interface ParserConfigurationSettings
Parameters:
propertyId - The unique identifier (URI) of the property being set.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - If the requested feature is not known or supported.

createValidationManager

protected ValidationManager createValidationManager()

getDTDContentModelHandler

public org.apache.xerces.xni.XMLDTDContentModelHandler getDTDContentModelHandler()
Returns the registered DTD content model handler.
Specified by:
getDTDContentModelHandler in interface org.apache.xerces.xni.parser.XMLParserConfiguration

getDTDHandler

public org.apache.xerces.xni.XMLDTDHandler getDTDHandler()
Returns the registered DTD handler.
Specified by:
getDTDHandler in interface org.apache.xerces.xni.parser.XMLParserConfiguration

getDocumentHandler

public org.apache.xerces.xni.XMLDocumentHandler getDocumentHandler()
Returns the registered document handler.
Specified by:
getDocumentHandler in interface org.apache.xerces.xni.parser.XMLParserConfiguration

getEntityResolver

public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
Return the current entity resolver.
Specified by:
getEntityResolver in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Returns:
The current entity resolver, or null if none has been registered.

getErrorHandler

public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
Return the current error handler.
Specified by:
getErrorHandler in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Returns:
The current error handler, or null if none has been registered.

getFeature

public boolean getFeature(String featureId)
            throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the state of a feature.
Specified by:
getFeature in interface org.apache.xerces.xni.parser.XMLParserConfiguration
getFeature in interface org.apache.xerces.xni.parser.XMLComponentManager
Overrides:
getFeature in interface ParserConfigurationSettings
Parameters:
featureId - The feature identifier.
Returns:
true if the feature is supported
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

getLocale

public Locale getLocale()
Returns the locale.
Specified by:
getLocale in interface org.apache.xerces.xni.parser.XMLParserConfiguration

getParameter

public Object getParameter(String name)
            throws org.w3c.dom.DOMException
DOM Level 3 WD - Experimental. getParameter
Specified by:
getParameter in interface org.w3c.dom.DOMConfiguration

getParameterNames

public org.w3c.dom.DOMStringList getParameterNames()
DOM Level 3 CR - Experimental. The list of the parameters supported by this DOMConfiguration object and for which at least one value can be set by the application. Note that this list can also contain parameter names defined outside this specification.
Specified by:
getParameterNames in interface org.w3c.dom.DOMConfiguration

parse

public void parse(org.apache.xerces.xni.parser.XMLInputSource inputSource)
            throws org.apache.xerces.xni.XNIException,
                   IOException
Parse an XML document.

The parser can use this method to instruct this configuration to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).

Parsers may not invoke this method while a parse is in progress. Once a parse is complete, the parser may then parse another XML document.

This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.

Specified by:
parse in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Parameters:
Throws:
org.apache.xerces.xni.XNIException - Any XNI exception, possibly wrapping another exception.

reset

protected void reset()
            throws org.apache.xerces.xni.XNIException
reset all components before parsing

setDTDContentModelHandler

public void setDTDContentModelHandler(org.apache.xerces.xni.XMLDTDContentModelHandler handler)
Sets the DTD content model handler.
Specified by:
setDTDContentModelHandler in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Parameters:
handler - The DTD content model handler.

setDTDHandler

public void setDTDHandler(org.apache.xerces.xni.XMLDTDHandler dtdHandler)
Sets the DTD handler.
Specified by:
setDTDHandler in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Parameters:
dtdHandler - The DTD handler.

setDTDValidatorFactory

protected final void setDTDValidatorFactory(String version)

setDocumentHandler

public void setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler documentHandler)
Sets the document handler on the last component in the pipeline to receive information about the document.
Specified by:
setDocumentHandler in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Parameters:
documentHandler - The document handler.

setEntityResolver

public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver resolver)
Sets the resolver used to resolve external entities. The EntityResolver interface supports resolution of public and system identifiers.
Specified by:
setEntityResolver in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Parameters:
resolver - The new entity resolver. Passing a null value will uninstall the currently installed resolver.

setErrorHandler

public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Allow an application to register an error event handler.

If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Specified by:
setErrorHandler in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Parameters:
errorHandler - The error handler.

setFeature

public void setFeature(String featureId,
                       boolean state)
            throws org.apache.xerces.xni.parser.XMLConfigurationException
Set the state of a feature. Set the state of any feature in a SAX2 parser. The parser might not recognize the feature, and if it does recognize it, it might not be able to fulfill the request.
Specified by:
setFeature in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Overrides:
setFeature in interface ParserConfigurationSettings
Parameters:
featureId - The unique identifier (URI) of the feature.
state - The requested state of the feature (true or false).
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - If the requested feature is not known.

setLocale

public void setLocale(Locale locale)
            throws org.apache.xerces.xni.XNIException
Set the locale to use for messages.
Specified by:
setLocale in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Parameters:
locale - The locale object to use for localization of messages.
Throws:
org.apache.xerces.xni.XNIException - Thrown if the parser does not support the specified locale.

setParameter

public void setParameter(String name,
                         Object value)
            throws org.w3c.dom.DOMException
DOM Level 3 WD - Experimental. setParameter
Specified by:
setParameter in interface org.w3c.dom.DOMConfiguration

setProperty

public void setProperty(String propertyId,
                        Object value)
            throws org.apache.xerces.xni.parser.XMLConfigurationException
setProperty
Specified by:
setProperty in interface org.apache.xerces.xni.parser.XMLParserConfiguration
Overrides:
setProperty in interface ParserConfigurationSettings
Parameters:
propertyId -
value -

Copyright B) 1999-2006 The Apache Software Foundation. All Rights Reserved.