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.
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ENTITY_RESOLVER
Property identifier: entity resolver.
|
protected static java.lang.String |
ERROR_HANDLER
Property identifier: error handler.
|
protected static java.lang.String |
ERROR_REPORTER
Property identifier: error reporter.
|
protected org.apache.xerces.xni.parser.XMLEntityResolver |
fEntityResolver |
protected XMLErrorReporter |
fErrorReporter |
protected org.apache.xerces.xni.grammars.XMLGrammarPool |
fGrammarPool |
protected java.util.Locale |
fLocale |
protected SymbolTable |
fSymbolTable |
protected static java.lang.String |
GRAMMAR_POOL
Property identifier: grammar pool .
|
protected static java.lang.String |
SYMBOL_TABLE
Property identifier: symbol table.
|
Constructor and Description |
---|
XMLGrammarPreparser()
Default constructor.
|
XMLGrammarPreparser(SymbolTable symbolTable)
Constructs a preparser using the specified symbol table.
|
Modifier and Type | Method and Description |
---|---|
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(java.lang.String type,
java.lang.String featureId) |
org.apache.xerces.xni.grammars.XMLGrammarPool |
getGrammarPool()
Returns the registered grammar pool.
|
org.apache.xerces.xni.grammars.XMLGrammarLoader |
getLoader(java.lang.String type) |
java.util.Locale |
getLocale()
Return the Locale the XMLGrammarLoader is using.
|
java.lang.Object |
getProperty(java.lang.String type,
java.lang.String propertyId) |
org.apache.xerces.xni.grammars.Grammar |
preparseGrammar(java.lang.String type,
org.apache.xerces.xni.parser.XMLInputSource is)
Parse a grammar from a location identified by an
XMLInputSource.
|
boolean |
registerPreparser(java.lang.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(java.lang.String featureId,
boolean value) |
void |
setGrammarPool(org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)
Sets the grammar pool.
|
void |
setLocale(java.util.Locale locale)
Set the locale to use for messages.
|
void |
setProperty(java.lang.String propId,
java.lang.Object value) |
protected static final java.lang.String SYMBOL_TABLE
protected static final java.lang.String ERROR_REPORTER
protected static final java.lang.String ERROR_HANDLER
protected static final java.lang.String ENTITY_RESOLVER
protected static final java.lang.String GRAMMAR_POOL
protected final SymbolTable fSymbolTable
protected final XMLErrorReporter fErrorReporter
protected org.apache.xerces.xni.parser.XMLEntityResolver fEntityResolver
protected org.apache.xerces.xni.grammars.XMLGrammarPool fGrammarPool
protected java.util.Locale fLocale
public XMLGrammarPreparser()
public XMLGrammarPreparser(SymbolTable symbolTable)
symbolTable
- The symbol table to use.public boolean registerPreparser(java.lang.String grammarType, org.apache.xerces.xni.grammars.XMLGrammarLoader loader)
public org.apache.xerces.xni.grammars.Grammar preparseGrammar(java.lang.String type, org.apache.xerces.xni.parser.XMLInputSource is) throws org.apache.xerces.xni.XNIException, java.io.IOException
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 EntityResolverGrammar
.org.apache.xerces.xni.XNIException
- thrown on an error in grammar
constructionjava.io.IOException
- thrown if an error is encountered
in reading the filepublic void setLocale(java.util.Locale locale)
locale
- The locale object to use for localization of messages.org.apache.xerces.xni.XNIException
- Thrown if the parser does not support the
specified locale.public java.util.Locale getLocale()
public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
errorHandler
- The error handler.public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
entityResolver
- The new entity resolver.public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
public void setGrammarPool(org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)
grammarPool
- The new grammar pool.public org.apache.xerces.xni.grammars.XMLGrammarPool getGrammarPool()
public org.apache.xerces.xni.grammars.XMLGrammarLoader getLoader(java.lang.String type)
public void setFeature(java.lang.String featureId, boolean value)
public void setProperty(java.lang.String propId, java.lang.Object value)
public boolean getFeature(java.lang.String type, java.lang.String featureId)
public java.lang.Object getProperty(java.lang.String type, java.lang.String propertyId)
Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.