public class

XMLGrammarPreparser

extends Object
java.lang.Object
   ↳ org.apache.xerces.parsers.XMLGrammarPreparser

Class Overview

This class provides an easy way for a user to preparse grammars of various types. By default, it knows how to preparse external DTD's and schemas; it provides an easy way for user applications to register classes that know how to parse additional grammar types. By default, it does no grammar caching; but it provides ways for user applications to do so.

Summary

Constants
String ENTITY_RESOLVER Property identifier: entity resolver.
String ERROR_HANDLER Property identifier: error handler.
String ERROR_REPORTER Property identifier: error reporter.
String GRAMMAR_POOL Property identifier: grammar pool .
String SYMBOL_TABLE Property identifier: symbol table.
Fields
protected XMLEntityResolver fEntityResolver
protected XMLErrorReporter fErrorReporter
protected XMLGrammarPool fGrammarPool
protected Locale fLocale
protected SymbolTable fSymbolTable
Public Constructors
XMLGrammarPreparser()
Default constructor.
XMLGrammarPreparser(SymbolTable symbolTable)
Constructs a preparser using the specified symbol table.
Public Methods
XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.
XMLErrorHandler getErrorHandler()
Returns the registered error handler.
boolean getFeature(String type, String featureId)
XMLGrammarPool getGrammarPool()
Returns the registered grammar pool.
XMLGrammarLoader getLoader(String type)
Locale getLocale()
Return the Locale the XMLGrammarLoader is using.
Object getProperty(String type, String propertyId)
Grammar preparseGrammar(String type, XMLInputSource is)
Parse a grammar from a location identified by an XMLInputSource.
boolean registerPreparser(String grammarType, XMLGrammarLoader loader)
void setEntityResolver(XMLEntityResolver entityResolver)
Sets the entity resolver.
void setErrorHandler(XMLErrorHandler errorHandler)
Sets the error handler.
void setFeature(String featureId, boolean value)
void setGrammarPool(XMLGrammarPool grammarPool)
Sets the grammar pool.
void setLocale(Locale locale)
Set the locale to use for messages.
void setProperty(String propId, Object value)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

protected static final String ENTITY_RESOLVER

Property identifier: entity resolver.

Constant Value: "http://apache.org/xml/properties/internal/entity-resolver"

protected static final String ERROR_HANDLER

Property identifier: error handler.

Constant Value: "http://apache.org/xml/properties/internal/error-handler"

protected static final String ERROR_REPORTER

Property identifier: error reporter.

Constant Value: "http://apache.org/xml/properties/internal/error-reporter"

protected static final String GRAMMAR_POOL

Property identifier: grammar pool .

Constant Value: "http://apache.org/xml/properties/internal/grammar-pool"

protected static final String SYMBOL_TABLE

Property identifier: symbol table.

Constant Value: "http://apache.org/xml/properties/internal/symbol-table"

Fields

protected XMLEntityResolver fEntityResolver

protected XMLErrorReporter fErrorReporter

protected XMLGrammarPool fGrammarPool

protected Locale fLocale

protected SymbolTable fSymbolTable

Public Constructors

public XMLGrammarPreparser ()

Default constructor.

public XMLGrammarPreparser (SymbolTable symbolTable)

Constructs a preparser using the specified symbol table.

Parameters
symbolTable The symbol table to use.

Public Methods

public XMLEntityResolver getEntityResolver ()

Returns the registered entity resolver.

public XMLErrorHandler getErrorHandler ()

Returns the registered error handler.

public boolean getFeature (String type, String featureId)

public XMLGrammarPool getGrammarPool ()

Returns the registered grammar pool.

public XMLGrammarLoader getLoader (String type)

public Locale getLocale ()

Return the Locale the XMLGrammarLoader is using.

public Object getProperty (String type, String propertyId)

public Grammar preparseGrammar (String type, XMLInputSource is)

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

Parameters
type The type of the grammar to be constructed
is 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
  • The newly created Grammar.
Throws
XNIException thrown on an error in grammar construction
IOException thrown if an error is encountered in reading the file

public boolean registerPreparser (String grammarType, XMLGrammarLoader loader)

public void setEntityResolver (XMLEntityResolver entityResolver)

Sets the entity resolver.

Parameters
entityResolver The new entity resolver.

public void setErrorHandler (XMLErrorHandler errorHandler)

Sets the error handler.

Parameters
errorHandler The error handler.

public void setFeature (String featureId, boolean value)

public void setGrammarPool (XMLGrammarPool grammarPool)

Sets the grammar pool.

Parameters
grammarPool The new grammar pool.

public void setLocale (Locale locale)

Set the locale to use for messages.

Parameters
locale The locale object to use for localization of messages.
Throws
XNIException Thrown if the parser does not support the specified locale.

public void setProperty (String propId, Object value)