|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.parsers.BasicParserConfiguration
A very basic parser configuration. This configuration class can be used as a base class for custom parser configurations. The basic parser configuration creates the symbol table (if not specified at construction time) and manages all of the recognized features and properties.
The basic parser configuration does not mandate
any particular pipeline configuration or the use of specific
components except for the symbol table. If even this is too much
for a basic parser configuration, the programmer can create a new
configuration class that implements the
XMLParserConfiguration
interface.
Subclasses of the basic parser configuration can add their own
recognized features and properties by calling the
addRecognizedFeature
and
addRecognizedProperty
methods, respectively.
The basic parser configuration assumes that the configuration
will be made up of various parser components that implement the
XMLComponent
interface. If subclasses of this
configuration create their own components for use in the
parser configuration, then each component should be added to
the list of components by calling the addComponent
method. The basic parser configuration will make sure to call
the reset
method of each registered component
before parsing an instance document.
This class recognizes the following features and properties:
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 |
EXTERNAL_GENERAL_ENTITIES
Feature identifier: external general entities. |
protected static java.lang.String |
EXTERNAL_PARAMETER_ENTITIES
Feature identifier: external parameter entities. |
protected java.util.Vector |
fComponents
Components. |
protected org.apache.xerces.xni.XMLDocumentHandler |
fDocumentHandler
The document handler. |
protected org.apache.xerces.xni.XMLDTDContentModelHandler |
fDTDContentModelHandler
The DTD content model handler. |
protected org.apache.xerces.xni.XMLDTDHandler |
fDTDHandler
The DTD handler. |
protected java.util.Hashtable |
fFeatures
Features. |
protected java.util.Hashtable |
fProperties
Properties. |
protected java.util.Vector |
fRecognizedFeatures
Recognized features. |
protected java.util.Vector |
fRecognizedProperties
Recognized properties. |
protected SymbolTable |
fSymbolTable
Symbol table. |
protected static java.lang.String |
NAMESPACES
Feature identifier: namespaces. |
protected static java.lang.String |
SYMBOL_TABLE
Property identifier: symbol table. |
protected static java.lang.String |
VALIDATION
Feature identifier: validation. |
protected static java.lang.String |
XML_STRING
Property identifier: xml string. |
Constructor Summary | |
protected |
BasicParserConfiguration()
Default Constructor. |
protected |
BasicParserConfiguration(SymbolTable symbolTable)
Constructs a document parser using the specified symbol table and a default grammar pool. |
Method Summary | |
protected void |
addComponent(org.apache.xerces.xni.parser.XMLComponent component)
Adds a component to the parser configuration. |
void |
addRecognizedFeatures(java.lang.String[] featureIds)
Allows a parser to add parser specific features to be recognized and managed by the parser configuration. |
void |
addRecognizedProperties(java.lang.String[] propertyIds)
Allows a parser to add parser specific properties to be recognized and managed by the parser configuration. |
protected void |
checkFeature(java.lang.String featureId)
Check a feature. |
protected void |
checkProperty(java.lang.String propertyId)
Check a property. |
org.apache.xerces.xni.parser.XMLEntityResolver |
getEntityResolver()
Return the current entity resolver. |
org.apache.xerces.xni.parser.XMLErrorHandler |
getErrorHandler()
Return the current error handler. |
boolean |
getFeature(java.lang.String featureId)
Returns the state of a feature. |
java.lang.Object |
getProperty(java.lang.String propertyId)
Returns the value of a property. |
abstract void |
parse(org.apache.xerces.xni.parser.XMLInputSource inputSource)
public void parse(String systemId) throws XNIException, IOException { InputSource source = new InputSource(systemId); parse(source); try { Reader reader = source.getCharacterStream(); if (reader != null) { reader.close(); } else { InputStream is = source.getByteStream(); if (is != null) { is.close(); } } } catch (IOException e) { // ignore } } // parse(String) /** parse |
protected void |
reset()
reset all components before parsing |
void |
setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)
Sets the document handler to receive information about the document. |
void |
setDTDContentModelHandler(org.apache.xerces.xni.XMLDTDContentModelHandler handler)
Sets the DTD content model handler. |
void |
setDTDHandler(org.apache.xerces.xni.XMLDTDHandler handler)
Sets the DTD handler. |
void |
setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver resolver)
Sets the resolver used to resolve external entities. |
void |
setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Allow an application to register an error event handler. |
void |
setFeature(java.lang.String featureId,
boolean state)
Set the state of a feature. |
void |
setProperty(java.lang.String propertyId,
java.lang.Object value)
setProperty |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static final java.lang.String VALIDATION
protected static final java.lang.String NAMESPACES
protected static final java.lang.String EXTERNAL_GENERAL_ENTITIES
protected static final java.lang.String EXTERNAL_PARAMETER_ENTITIES
protected static final java.lang.String XML_STRING
protected static final java.lang.String SYMBOL_TABLE
protected static final java.lang.String ERROR_HANDLER
protected static final java.lang.String ENTITY_RESOLVER
protected SymbolTable fSymbolTable
protected java.util.Vector fRecognizedProperties
protected java.util.Hashtable fProperties
protected java.util.Vector fRecognizedFeatures
protected java.util.Hashtable fFeatures
protected java.util.Vector fComponents
protected org.apache.xerces.xni.XMLDocumentHandler fDocumentHandler
protected org.apache.xerces.xni.XMLDTDHandler fDTDHandler
protected org.apache.xerces.xni.XMLDTDContentModelHandler fDTDContentModelHandler
Constructor Detail |
protected BasicParserConfiguration()
protected BasicParserConfiguration(SymbolTable symbolTable)
Method Detail |
protected void addComponent(org.apache.xerces.xni.parser.XMLComponent component)
component
- The component to add.public abstract void parse(org.apache.xerces.xni.parser.XMLInputSource inputSource) throws org.apache.xerces.xni.XNIException, java.io.IOException
inputSource
- public void setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)
documentHandler
- The document handler.public void setDTDHandler(org.apache.xerces.xni.XMLDTDHandler handler)
dtdHandler
- The DTD handler.public void setDTDContentModelHandler(org.apache.xerces.xni.XMLDTDContentModelHandler handler)
dtdContentModelHandler
- The DTD content model handler.public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver resolver)
resolver
- The new entity resolver. Passing a null value will
uninstall the currently installed resolver.public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver)
public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
errorHandler
- The error handler.getErrorHandler()
public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler)
public void addRecognizedFeatures(java.lang.String[] featureIds)
featureIds
- An array of the additional feature identifiers
to be recognized.public void setFeature(java.lang.String featureId, boolean state) throws org.apache.xerces.xni.parser.XMLConfigurationException
featureId
- The unique identifier (URI) of the feature.state
- The requested state of the feature (true or false).public void addRecognizedProperties(java.lang.String[] propertyIds)
propertyIds
- An array of the additional property identifiers
to be recognized.public void setProperty(java.lang.String propertyId, java.lang.Object value) throws org.apache.xerces.xni.parser.XMLConfigurationException
propertyId
- value
- public boolean getFeature(java.lang.String featureId) throws org.apache.xerces.xni.parser.XMLConfigurationException
featureId
- The feature identifier.public java.lang.Object getProperty(java.lang.String propertyId) throws org.apache.xerces.xni.parser.XMLConfigurationException
propertyId
- The property identifier.protected void reset() throws org.apache.xerces.xni.XNIException
protected void checkFeature(java.lang.String featureId) throws org.apache.xerces.xni.parser.XMLConfigurationException
featureId
- The unique identifier (URI) of the feature.protected void checkProperty(java.lang.String propertyId) throws org.apache.xerces.xni.parser.XMLConfigurationException
propertyId
- The unique identifier (URI) of the property
being set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |