Package org.apache.xerces.parsers
Class XMLGrammarPreparser
java.lang.Object
org.apache.xerces.parsers.XMLGrammarPreparser
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.
- Version:
- $Id: XMLGrammarPreparser.java 713638 2008-11-13 04:42:18Z mrglavas $
- Author:
- Neil Graham, IBM
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
Property identifier: entity resolver.protected static final String
Property identifier: error handler.protected static final String
Property identifier: error reporter.protected org.apache.xerces.xni.parser.XMLEntityResolver
protected final XMLErrorReporter
protected org.apache.xerces.xni.grammars.XMLGrammarPool
protected Locale
protected final SymbolTable
protected static final String
Property identifier: grammar pool .protected static final String
Property identifier: symbol table. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.XMLGrammarPreparser
(SymbolTable symbolTable) Constructs a preparser using the specified symbol table. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.xerces.xni.parser.XMLEntityResolver
Returns the registered entity resolver.org.apache.xerces.xni.parser.XMLErrorHandler
Returns the registered error handler.boolean
getFeature
(String type, String featureId) org.apache.xerces.xni.grammars.XMLGrammarPool
Returns the registered grammar pool.org.apache.xerces.xni.grammars.XMLGrammarLoader
Return the Locale the XMLGrammarLoader is using.getProperty
(String type, String propertyId) org.apache.xerces.xni.grammars.Grammar
preparseGrammar
(String type, org.apache.xerces.xni.parser.XMLInputSource is) Parse a grammar from a location identified by an XMLInputSource.boolean
registerPreparser
(String grammarType, org.apache.xerces.xni.grammars.XMLGrammarLoader loader) void
setEntityResolver
(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver) Sets the entity resolver.void
setErrorHandler
(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler) Sets the error handler.void
setFeature
(String featureId, boolean value) void
setGrammarPool
(org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool) Sets the grammar pool.void
Set the locale to use for messages.void
setProperty
(String propId, Object value)
-
Field Details
-
SYMBOL_TABLE
Property identifier: symbol table.- See Also:
-
ERROR_REPORTER
Property identifier: error reporter.- See Also:
-
ERROR_HANDLER
Property identifier: error handler.- See Also:
-
ENTITY_RESOLVER
Property identifier: entity resolver.- See Also:
-
GRAMMAR_POOL
Property identifier: grammar pool .- See Also:
-
fSymbolTable
-
fErrorReporter
-
fEntityResolver
protected org.apache.xerces.xni.parser.XMLEntityResolver fEntityResolver -
fGrammarPool
protected org.apache.xerces.xni.grammars.XMLGrammarPool fGrammarPool -
fLocale
-
-
Constructor Details
-
XMLGrammarPreparser
public XMLGrammarPreparser()Default constructor. -
XMLGrammarPreparser
Constructs a preparser using the specified symbol table.- Parameters:
symbolTable
- The symbol table to use.
-
-
Method Details
-
registerPreparser
public boolean registerPreparser(String grammarType, org.apache.xerces.xni.grammars.XMLGrammarLoader loader) -
preparseGrammar
public org.apache.xerces.xni.grammars.Grammar preparseGrammar(String type, org.apache.xerces.xni.parser.XMLInputSource is) throws org.apache.xerces.xni.XNIException, IOException 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 constructedis
- 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:
org.apache.xerces.xni.XNIException
- thrown on an error in grammar constructionIOException
- thrown if an error is encountered in reading the file
-
setLocale
Set the locale to use for messages.- 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.
-
getLocale
Return the Locale the XMLGrammarLoader is using. -
setErrorHandler
public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler) Sets the error handler.- Parameters:
errorHandler
- The error handler.
-
getErrorHandler
public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()Returns the registered error handler. -
setEntityResolver
public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver) Sets the entity resolver.- Parameters:
entityResolver
- The new entity resolver.
-
getEntityResolver
public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()Returns the registered entity resolver. -
setGrammarPool
public void setGrammarPool(org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool) Sets the grammar pool.- Parameters:
grammarPool
- The new grammar pool.
-
getGrammarPool
public org.apache.xerces.xni.grammars.XMLGrammarPool getGrammarPool()Returns the registered grammar pool. -
getLoader
-
setFeature
-
setProperty
-
getFeature
-
getProperty
-