Xerces 2.0.0.alpha

org.apache.xerces.parsers
Class XMLParser

java.lang.Object
  |
  +--org.apache.xerces.parsers.XMLParser
All Implemented Interfaces:
org.apache.xerces.xni.XMLComponentManager
Direct Known Subclasses:
XMLDocumentParser, XMLGrammarParser

public abstract class XMLParser
extends java.lang.Object
implements org.apache.xerces.xni.XMLComponentManager

Base class of all XML-related parsers.

This class sets the defaults for the following features and properties:

Version:
$Id: XMLParser.java,v 1.1.2.16 2000/11/02 02:11:24 ericye Exp $

Field Summary
protected  org.apache.xerces.impl.XMLEntityManager fEntityManager
          Entity manager.
protected  org.apache.xerces.impl.XMLErrorReporter fErrorReporter
          Error reporter.
protected  java.util.Hashtable fFeatures
          Features.
protected  Locator fLocator
          Locator
protected  java.util.Hashtable fProperties
          Properties.
protected  org.apache.xerces.util.SymbolTable fSymbolTable
          Symbol table.
 
Constructor Summary
protected XMLParser()
          Default Constructor.
protected XMLParser(org.apache.xerces.util.SymbolTable symbolTable)
          Constructor allowing the SymbolTable to be specified.
 
Method Summary
protected  void checkFeature(java.lang.String featureId)
          Check a feature.
protected  void checkProperty(java.lang.String propertyId)
          Check a property.
 EntityResolver getEntityResolver()
          Return the current entity resolver.
 ErrorHandler 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(InputSource inputSource)
          parse
 void parse(java.lang.String systemId)
          Parses the input source specified by the given system identifier.
protected  void reset()
          reset all components before parsing
 void setEntityResolver(EntityResolver resolver)
          Sets the resolver used to resolve external entities.
 void setErrorHandler(ErrorHandler 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 setLocale(java.util.Locale locale)
          Set the locale to use for messages.
 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

fSymbolTable

protected org.apache.xerces.util.SymbolTable fSymbolTable
Symbol table.

fLocator

protected Locator fLocator
Locator

fEntityManager

protected org.apache.xerces.impl.XMLEntityManager fEntityManager
Entity manager.

fErrorReporter

protected org.apache.xerces.impl.XMLErrorReporter fErrorReporter
Error reporter.

fProperties

protected java.util.Hashtable fProperties
Properties.

fFeatures

protected java.util.Hashtable fFeatures
Features.
Constructor Detail

XMLParser

protected XMLParser()
Default Constructor. Creates a parser with its own SymbolTable.

XMLParser

protected XMLParser(org.apache.xerces.util.SymbolTable symbolTable)
Constructor allowing the SymbolTable to be specified.
Parameters:
symbolTable -  
Method Detail

parse

public void parse(java.lang.String systemId)
           throws SAXException,
                  java.io.IOException
Parses the input source specified by the given system identifier.

This method is equivalent to the following:

     parse(new InputSource(systemId));
 
Parameters:
source - The input source.
Throws:
SAXException - Throws exception on SAX error.
java.io.IOException - Throws exception on i/o error.

parse

public abstract void parse(InputSource inputSource)
                    throws SAXException,
                           java.io.IOException
parse
Parameters:
inputSource -  
Throws:
SAXException -  
java.io.IOException -  

setEntityResolver

public void setEntityResolver(EntityResolver resolver)
Sets the resolver used to resolve external entities. The EntityResolver interface supports resolution of public and system identifiers.
Parameters:
resolver - The new entity resolver. Passing a null value will uninstall the currently installed resolver.

getEntityResolver

public EntityResolver getEntityResolver()
Return the current entity resolver.
Returns:
The current entity resolver, or null if none has been registered.
See Also:
setEntityResolver(org.xml.sax.EntityResolver)

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Allow an application to register an error event handler.

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.

Parameters:
errorHandler - The error handler.
Throws:
java.lang.NullPointerException - If the handler argument is null.
See Also:
getErrorHandler()

getErrorHandler

public ErrorHandler getErrorHandler()
Return the current error handler.
Returns:
The current error handler, or null if none has been registered.
See Also:
setErrorHandler(org.xml.sax.ErrorHandler)

setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the state of a feature. Set the state of any feature in a SAX2 parser. The parser might not recognize the feature, and if it does recognize it, it might not be able to fulfill the request.
Parameters:
featureId - The unique identifier (URI) of the feature.
state - The requested state of the feature (true or false).
Throws:
SAXNotRecognizedException - If the requested feature is not known.
SAXNotSupportedException - If the requested feature is known, but the requested state is not supported.
SAXException - If there is any other problem fulfilling the request.

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
                 throws SAXNotRecognizedException,
                        SAXNotSupportedException
setProperty
Parameters:
propertyId -  
value -  

setLocale

public void setLocale(java.util.Locale locale)
               throws SAXException
Set the locale to use for messages.
Parameters:
locale - The locale object to use for localization of messages.
Throws:
SAXException - An exception thrown if the parser does not support the specified locale.
See Also:
Parser

getFeature

public boolean getFeature(java.lang.String featureId)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException
Returns the state of a feature.
Specified by:
getFeature in interface org.apache.xerces.xni.XMLComponentManager
Parameters:
featureId - The feature identifier.
Throws:
SAXNotRecognizedException - Thrown if the feature is not recognized.
SAXNotSupportedException - Thrown if the feature is not supported.

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
                             throws SAXNotRecognizedException,
                                    SAXNotSupportedException
Returns the value of a property.
Specified by:
getProperty in interface org.apache.xerces.xni.XMLComponentManager
Parameters:
propertyId - The property identifier.
Throws:
SAXNotRecognizedException - Thrown if the feature is not recognized.
SAXNotSupportedException - Thrown if the feature is not supported.

reset

protected void reset()
              throws SAXException
reset all components before parsing

checkFeature

protected void checkFeature(java.lang.String featureId)
                     throws SAXNotRecognizedException,
                            SAXNotSupportedException
Check a feature. If feature is know and supported, this method simply returns. Otherwise, the appropriate exception is thrown.
Parameters:
featureId - The unique identifier (URI) of the feature.
Throws:
SAXNotRecognizedException - If the requested feature is not known.
SAXNotSupportedException - If the requested feature is known, but the requested state is not supported.
SAXException - If there is any other problem fulfilling the request.

checkProperty

protected void checkProperty(java.lang.String propertyId)
                      throws SAXNotRecognizedException,
                             SAXNotSupportedException
Check a property. If the property is know and supported, this method simply returns. Otherwise, the appropriate exception is thrown.
Parameters:
propertyId - The unique identifier (URI) of the property being set.
Throws:
SAXNotRecognizedException - If the requested property is not known.
SAXNotSupportedException - If the requested property is known, but the requested value is not supported.
SAXException - If there is any other problem fulfilling the request.

Xerces 2.0.0.alpha