org.apache.xerces.parsers
Class XMLGrammarPreparser
java.lang.Object
org.apache.xerces.parsers.XMLGrammarPreparser
public class XMLGrammarPreparser
extends java.lang.Object
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.
$Id: XMLGrammarPreparser.java,v 1.10 2004/03/25 04:03:23 mrglavas Exp $
org.apache.xerces.xni.parser.XMLEntityResolver | getEntityResolver() - Returns the registered entity resolver.
|
org.apache.xerces.xni.parser.XMLErrorHandler | getErrorHandler() - Returns the registered error handler.
|
boolean | getFeature(String type, String featureId)
|
org.apache.xerces.xni.grammars.XMLGrammarPool | getGrammarPool() - Returns the registered grammar pool.
|
org.apache.xerces.xni.grammars.XMLGrammarLoader | getLoader(String type)
|
Locale | getLocale() - Return the Locale the XMLGrammarLoader is using.
|
Object | 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 | setLocale(Locale locale) - Set the locale to use for messages.
|
void | setProperty(String propId, Object value)
|
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 identifier: grammar pool .
SYMBOL_TABLE
protected static final String SYMBOL_TABLE
Property identifier: symbol table.
fEntityResolver
protected org.apache.xerces.xni.parser.XMLEntityResolver fEntityResolver
fGrammarPool
protected org.apache.xerces.xni.grammars.XMLGrammarPool fGrammarPool
fLocale
protected Locale fLocale
XMLGrammarPreparser
public XMLGrammarPreparser()
Default constructor.
XMLGrammarPreparser
public XMLGrammarPreparser(SymbolTable symbolTable)
Constructs a preparser using the specified symbol table.
symbolTable
- The symbol table to use.
getEntityResolver
public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.
getErrorHandler
public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
Returns the registered error handler.
getFeature
public boolean getFeature(String type,
String featureId)
getGrammarPool
public org.apache.xerces.xni.grammars.XMLGrammarPool getGrammarPool()
Returns the registered grammar pool.
getLoader
public org.apache.xerces.xni.grammars.XMLGrammarLoader getLoader(String type)
getLocale
public Locale getLocale()
Return the Locale the XMLGrammarLoader is using.
getProperty
public Object getProperty(String type,
String propertyId)
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
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
- The newly created
Grammar
.
org.apache.xerces.xni.XNIException
- thrown on an error in grammar
construction
registerPreparser
public boolean registerPreparser(String grammarType,
org.apache.xerces.xni.grammars.XMLGrammarLoader loader)
setEntityResolver
public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
Sets the entity resolver.
entityResolver
- The new entity resolver.
setErrorHandler
public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Sets the error handler.
errorHandler
- The error handler.
setFeature
public void setFeature(String featureId,
boolean value)
setGrammarPool
public void setGrammarPool(org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)
Sets the grammar pool.
grammarPool
- The new grammar pool.
setLocale
public void setLocale(Locale locale)
Set the locale to use for messages.
locale
- The locale object to use for localization of messages.
setProperty
public void setProperty(String propId,
Object value)
Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.