org.apache.xerces.dom

Class DOMConfigurationImpl

Implemented Interfaces:
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, DOMConfiguration

Xerces implementation of DOMConfiguration that maintains a table of recognized parameters.
Version:
$Id: DOMConfigurationImpl.java,v 1.36 2005/07/25 04:24:21 mrglavas Exp $
Authors:
Elena Litani, IBM
Neeraj Bajaj, Sun Microsystems.

Field Summary

protected static short
CDATA
protected static short
COMMENTS
protected static String
DTD_VALIDATOR_FACTORY_PROPERTY
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
GRAMMAR_POOL
Property id: Grammar pool
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_FULL_CHECKING
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 short
VALIDATE
protected static String
VALIDATION_MANAGER
protected static short
WELLFORMED
protected static String
XERCES_NAMESPACES
Feature identifier: namespaces.
protected static String
XERCES_VALIDATION
Feature identifier: validation.
protected static String
XML_STRING
Property identifier: xml string.
protected ArrayList
fComponents
Components.
protected DOMErrorHandlerWrapper
fErrorHandlerWrapper
protected XMLErrorReporter
fErrorReporter
Error reporter
protected Locale
fLocale
Locale.
protected SymbolTable
fSymbolTable
Symbol table.
protected ValidationManager
fValidationManager
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.
Locale
getLocale()
Returns the locale.
Object
getParameter(String name)
DOM Level 3 WD - Experimental.
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.
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

CDATA

protected static final short CDATA
Field Value:
8

COMMENTS

protected static final short COMMENTS
Field Value:
32

DTD_VALIDATOR_FACTORY_PROPERTY

protected static final String DTD_VALIDATOR_FACTORY_PROPERTY

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.

GRAMMAR_POOL

protected static final String GRAMMAR_POOL
Property id: Grammar pool

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_FULL_CHECKING

protected static final String SCHEMA_FULL_CHECKING

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.

VALIDATE

protected static final short VALIDATE
Field Value:
64

VALIDATION_MANAGER

protected static final String VALIDATION_MANAGER

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.

XML_STRING

protected static final String XML_STRING
Property identifier: xml string.

fComponents

protected ArrayList fComponents
Components.

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

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.
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.

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 DOMException
DOM Level 3 WD - Experimental. getParameter

getParameterNames

public 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.

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.

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 DOMException
DOM Level 3 WD - Experimental. setParameter

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-2005 Apache XML Project. All Rights Reserved.