BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.apache.xerces.parsers
Class XMLGrammarPreparser

java.lang.Object
  |
  +--weblogic.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.


Field Summary
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  XMLEntityResolver fEntityResolver
           
protected  XMLErrorReporter fErrorReporter
           
protected  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 Summary
XMLGrammarPreparser()
          Default constructor.
XMLGrammarPreparser(SymbolTable symbolTable)
          Constructs a preparser using the specified symbol table.
 
Method Summary
 XMLEntityResolver getEntityResolver()
          Returns the registered entity resolver.
 XMLErrorHandler getErrorHandler()
          Returns the registered error handler.
 boolean getFeature(java.lang.String type, java.lang.String featureId)
           
 XMLGrammarPool getGrammarPool()
          Returns the registered grammar pool.
 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)
           
 Grammar preparseGrammar(java.lang.String type, XMLInputSource is)
          Parse a grammar from a location identified by an XMLInputSource.
 boolean registerPreparser(java.lang.String grammarType, XMLGrammarLoader loader)
           
 void setEntityResolver(XMLEntityResolver entityResolver)
          Sets the entity resolver.
 void setErrorHandler(XMLErrorHandler errorHandler)
          Sets the error handler.
 void setFeature(java.lang.String featureId, boolean value)
           
 void setGrammarPool(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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYMBOL_TABLE

protected static final java.lang.String SYMBOL_TABLE
Property identifier: symbol table.

ERROR_REPORTER

protected static final java.lang.String ERROR_REPORTER
Property identifier: error reporter.

ERROR_HANDLER

protected static final java.lang.String ERROR_HANDLER
Property identifier: error handler.

ENTITY_RESOLVER

protected static final java.lang.String ENTITY_RESOLVER
Property identifier: entity resolver.

GRAMMAR_POOL

protected static final java.lang.String GRAMMAR_POOL
Property identifier: grammar pool .

fSymbolTable

protected SymbolTable fSymbolTable

fErrorReporter

protected XMLErrorReporter fErrorReporter

fEntityResolver

protected XMLEntityResolver fEntityResolver

fGrammarPool

protected XMLGrammarPool fGrammarPool

fLocale

protected java.util.Locale fLocale
Constructor Detail

XMLGrammarPreparser

public XMLGrammarPreparser()
Default constructor.

XMLGrammarPreparser

public XMLGrammarPreparser(SymbolTable symbolTable)
Constructs a preparser using the specified symbol table.

Parameters:
symbolTable - The symbol table to use.
Method Detail

registerPreparser

public boolean registerPreparser(java.lang.String grammarType,
                                 XMLGrammarLoader loader)

preparseGrammar

public Grammar preparseGrammar(java.lang.String type,
                               XMLInputSource is)
                        throws XNIException,
                               java.io.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 constructed
source - 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
java.io.IOException - thrown if an error is encountered in reading the file

setLocale

public void setLocale(java.util.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.

getLocale

public java.util.Locale getLocale()
Return the Locale the XMLGrammarLoader is using.

setErrorHandler

public void setErrorHandler(XMLErrorHandler errorHandler)
Sets the error handler.

Parameters:
errorHandler - The error handler.

getErrorHandler

public XMLErrorHandler getErrorHandler()
Returns the registered error handler.

setEntityResolver

public void setEntityResolver(XMLEntityResolver entityResolver)
Sets the entity resolver.

Parameters:
entityResolver - The new entity resolver.

getEntityResolver

public XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.

setGrammarPool

public void setGrammarPool(XMLGrammarPool grammarPool)
Sets the grammar pool.

Parameters:
grammarPool - The new grammar pool.

getGrammarPool

public XMLGrammarPool getGrammarPool()
Returns the registered grammar pool.

getLoader

public XMLGrammarLoader getLoader(java.lang.String type)

setFeature

public void setFeature(java.lang.String featureId,
                       boolean value)

setProperty

public void setProperty(java.lang.String propId,
                        java.lang.Object value)

getFeature

public boolean getFeature(java.lang.String type,
                          java.lang.String featureId)

getProperty

public java.lang.Object getProperty(java.lang.String type,
                                    java.lang.String propertyId)

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81