Top Description Fields Constructors Methods
org.apache.xerces.parsers

public Class XMLGrammarCachingConfiguration

extends XIncludeAwareParserConfiguration
Class Inheritance
Imports
java.io.IOException, org.apache.xerces.impl.Constants, org.apache.xerces.impl.dtd.DTDGrammar, .XMLDTDLoader, org.apache.xerces.impl.xs.SchemaGrammar, .XMLSchemaLoader, .XSMessageFormatter, org.apache.xerces.util.SymbolTable, .SynchronizedSymbolTable, .XMLGrammarPoolImpl, org.apache.xerces.xni.XNIException, org.apache.xerces.xni.grammars.Grammar, .XMLGrammarDescription, .XMLGrammarPool, org.apache.xerces.xni.parser.XMLComponentManager, .XMLConfigurationException, .XMLEntityResolver, .XMLInputSource

This configuration provides a generic way of using Xerces's grammar caching facilities. It extends the XIncludeAwareParserConfiguration and thus may validate documents according to XML schemas or DTD's. It also allows the user to preparse a grammar, and to lock the grammar pool implementation such that no more grammars will be added.

Using the org.apache.xerces.xni.parser property, an application may instantiate a Xerces SAX or DOM parser with this configuration. When invoked in this manner, the default behaviour will be elicited; to use this configuration's specific facilities, the user will need to reference it directly.

In addition to the features and properties recognized by the base parser configuration, this class recognizes these additional features and properties:

Author
Neil Graham, IBM
Version
$Id: XMLGrammarCachingConfiguration.java 447239 2006-09-18 05:08:26Z mrglavas $

Field Summary

Modifier and TypeField and Description
public static final int
protected XMLDTDLoader
protected XMLSchemaLoader
protected static final XMLGrammarPoolImpl
protected static final SynchronizedSymbolTable
protected static final String
Inherited from org.apache.xerces.parsers.XIncludeAwareParserConfiguration:
ALLOW_UE_AND_NOTATION_EVENTSfCurrentNSContextfNonXIncludeNSContextfXIncludeEnabledfXIncludeHandlerfXIncludeNSContextNAMESPACE_CONTEXTXINCLUDE_FEATUREXINCLUDE_FIXUP_BASE_URISXINCLUDE_FIXUP_LANGUAGEXINCLUDE_HANDLER

Constructor Summary

AccessConstructor and Description
public
XMLGrammarCachingConfiguration()

Default constructor.

public
XMLGrammarCachingConfiguration(SymbolTable
The symbol table to use.
symbolTable
)

Constructs a parser configuration using the specified symbol table.

public
XMLGrammarCachingConfiguration(SymbolTable
The symbol table to use.
symbolTable
,
XMLGrammarPool
The grammar pool to use.
grammarPool
)

Constructs a parser configuration using the specified symbol table and grammar pool.

public
XMLGrammarCachingConfiguration(SymbolTable
The symbol table to use.
symbolTable
,
XMLGrammarPool
The grammar pool to use.
grammarPool
,
XMLComponentManager
The parent settings.
parentSettings
)

Constructs a parser configuration using the specified symbol table, grammar pool, and parent settings.

Method Summary

Modifier and TypeMethod and Description
protected void
checkFeature(String
The unique identifier (URI) of the feature.
featureId
)

Overrides org.apache.xerces.parsers.XML11Configuration.checkFeature.

Check a feature.
protected void
checkProperty(String
The unique identifier (URI) of the property being set.
propertyId
)

Overrides org.apache.xerces.parsers.XML11Configuration.checkProperty.

Check a property.
public void
public void
pack-priv DTDGrammar
public Grammar

Returns:

The newly created Grammar.
parseGrammar
(String
The type of the grammar to be constructed
type
,
String
The location of the grammar to be constructed. The parser will not expand this URI or make it available to the EntityResolver
uri
)

Parse a grammar from a location identified by an URI.

public Grammar

Returns:

The newly created Grammar.
parseGrammar
(String
The type of the grammar to be constructed
type
,
XMLInputSource
The XMLInputSource containing this grammar's information If a URI is included in the systemId field, the parser will not expand this URI or make it available to the EntityResolver
is
)

Parse a grammar from a location identified by an XMLInputSource.

pack-priv SchemaGrammar
public void
Inherited from org.apache.xerces.parsers.XIncludeAwareParserConfiguration:
configurePipelineconfigureXML11PipelinegetFeaturesetFeature

Field Detail

BIG_PRIMEback to summary
public static final int BIG_PRIME
fDTDLoaderback to summary
protected XMLDTDLoader fDTDLoader
fSchemaLoaderback to summary
protected XMLSchemaLoader fSchemaLoader
fStaticGrammarPoolback to summary
protected static final XMLGrammarPoolImpl fStaticGrammarPool
fStaticSymbolTableback to summary
protected static final SynchronizedSymbolTable fStaticSymbolTable
SCHEMA_FULL_CHECKINGback to summary
protected static final String SCHEMA_FULL_CHECKING

Constructor Detail

XMLGrammarCachingConfigurationback to summary
public XMLGrammarCachingConfiguration()

Default constructor.

XMLGrammarCachingConfigurationback to summary
public XMLGrammarCachingConfiguration(SymbolTable symbolTable)

Constructs a parser configuration using the specified symbol table.

Parameters
symbolTable:SymbolTable

The symbol table to use.

XMLGrammarCachingConfigurationback to summary
public XMLGrammarCachingConfiguration(SymbolTable symbolTable, XMLGrammarPool grammarPool)

Constructs a parser configuration using the specified symbol table and grammar pool.

REVISIT: Grammar pool will be updated when the new validation engine is implemented.

Parameters
symbolTable:SymbolTable

The symbol table to use.

grammarPool:XMLGrammarPool

The grammar pool to use.

XMLGrammarCachingConfigurationback to summary
public XMLGrammarCachingConfiguration(SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLComponentManager parentSettings)

Constructs a parser configuration using the specified symbol table, grammar pool, and parent settings.

REVISIT: Grammar pool will be updated when the new validation engine is implemented.

Parameters
symbolTable:SymbolTable

The symbol table to use.

grammarPool:XMLGrammarPool

The grammar pool to use.

parentSettings:XMLComponentManager

The parent settings.

Method Detail

checkFeatureback to summary
protected void checkFeature(String featureId) throws XMLConfigurationException

Overrides org.apache.xerces.parsers.XML11Configuration.checkFeature.

Check a feature. If feature is known and supported, this method simply returns. Otherwise, the appropriate exception is thrown.

Parameters
featureId:String

The unique identifier (URI) of the feature.

Exceptions
XMLConfigurationException:
Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.
checkPropertyback to summary
protected void checkProperty(String propertyId) throws XMLConfigurationException

Overrides org.apache.xerces.parsers.XML11Configuration.checkProperty.

Check a property. If the property is known and supported, this method simply returns. Otherwise, the appropriate exception is thrown.

Parameters
propertyId:String

The unique identifier (URI) of the property being set.

Exceptions
XMLConfigurationException:
Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.
clearGrammarPoolback to summary
public void clearGrammarPool()
lockGrammarPoolback to summary
public void lockGrammarPool()
parseDTDback to summary
pack-priv DTDGrammar parseDTD(XMLInputSource is) throws IOException
parseGrammarback to summary
public Grammar parseGrammar(String type, String uri) throws XNIException, IOException

Parse a grammar from a location identified by an URI. This method also adds this grammar to the XMLGrammarPool

Parameters
type:String

The type of the grammar to be constructed

uri:String

The location of the grammar to be constructed. The parser will not expand this URI or make it available to the EntityResolver

Returns:Grammar

The newly created Grammar.

Exceptions
XNIException:
thrown on an error in grammar construction
IOException:
thrown if an error is encountered in reading the file
parseGrammarback to summary
public Grammar parseGrammar(String type, XMLInputSource is) throws XNIException, IOException

Parse a grammar from a location identified by an XMLInputSource. This method also adds this grammar to the XMLGrammarPool

Parameters
type:String

The type of the grammar to be constructed

is:XMLInputSource

The XMLInputSource containing this grammar's information If a URI is included in the systemId field, the parser will not expand this URI or make it available to the EntityResolver

Returns:Grammar

The newly created Grammar.

Exceptions
XNIException:
thrown on an error in grammar construction
IOException:
thrown if an error is encountered in reading the file
parseXMLSchemaback to summary
pack-priv SchemaGrammar parseXMLSchema(XMLInputSource is) throws IOException
unlockGrammarPoolback to summary
public void unlockGrammarPool()