org.apache.xerces.impl
Class XMLScanner

java.lang.Object
  extended by org.apache.xerces.impl.XMLScanner
All Implemented Interfaces:
XMLComponent
Direct Known Subclasses:
XMLDocumentFragmentScannerImpl, XMLDTDScannerImpl

public abstract class XMLScanner
extends java.lang.Object
implements XMLComponent

This class is responsible for holding scanning methods common to scanning the XML document structure and content as well as the DTD structure and content. Both XMLDocumentScanner and XMLDTDScanner inherit from this base class.

This component requires the following features and properties from the component manager that uses it:

Version:
$Id: XMLScanner.java 572055 2007-09-02 17:55:43Z mrglavas $
Author:
Andy Clark, IBM, Arnaud Le Hors, IBM, Eric Ye, IBM

Constructor Summary
XMLScanner()
           
 
Method Summary
 void endEntity(java.lang.String name, Augmentations augs)
          This method notifies the end of an entity.
 boolean getFeature(java.lang.String featureId)
           
 void reset(XMLComponentManager componentManager)
          Resets the component.
 java.lang.String scanPseudoAttribute(boolean scanningTextDecl, XMLString value)
          Scans a pseudo attribute.
 void setFeature(java.lang.String featureId, boolean value)
          Sets the state of a feature.
 void setProperty(java.lang.String propertyId, java.lang.Object value)
          Sets the value of a property during parsing.
 void startEntity(java.lang.String name, XMLResourceIdentifier identifier, java.lang.String encoding, Augmentations augs)
          This method notifies of the start of an entity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.xerces.xni.parser.XMLComponent
getFeatureDefault, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties
 

Constructor Detail

XMLScanner

public XMLScanner()
Method Detail

reset

public void reset(XMLComponentManager componentManager)
           throws XMLConfigurationException
Description copied from interface: XMLComponent
Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.

Specified by:
reset in interface XMLComponent
Parameters:
componentManager - The component manager.
Throws:
SAXException - Throws exception if required features and properties cannot be found.
XMLConfigurationException

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
                 throws XMLConfigurationException
Sets the value of a property during parsing.

Specified by:
setProperty in interface XMLComponent
Parameters:
propertyId -
value -
Throws:
XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

setFeature

public void setFeature(java.lang.String featureId,
                       boolean value)
                throws XMLConfigurationException
Description copied from interface: XMLComponent
Sets the state of a feature. This method is called by the component manager any time after reset when a feature changes state.

Note: Components should silently ignore features that do not affect the operation of the component.

Specified by:
setFeature in interface XMLComponent
Parameters:
featureId - The feature identifier.
value - The state of the feature.
Throws:
XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

getFeature

public boolean getFeature(java.lang.String featureId)
                   throws XMLConfigurationException
Throws:
XMLConfigurationException

scanPseudoAttribute

public java.lang.String scanPseudoAttribute(boolean scanningTextDecl,
                                            XMLString value)
                                     throws java.io.IOException,
                                            XNIException
Scans a pseudo attribute.

Parameters:
scanningTextDecl - True if scanning this pseudo-attribute for a TextDecl; false if scanning XMLDecl. This flag is needed to report the correct type of error.
value - The string to fill in with the attribute value.
Returns:
The name of the attribute Note: This method uses fStringBuffer2, anything in it at the time of calling is lost.
Throws:
java.io.IOException
XNIException

startEntity

public void startEntity(java.lang.String name,
                        XMLResourceIdentifier identifier,
                        java.lang.String encoding,
                        Augmentations augs)
                 throws XNIException
This method notifies of the start of an entity. The document entity has the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]" parameter entity names start with '%'; and general entities are just specified by their name.

Parameters:
name - The name of the entity.
identifier - The resource identifier.
encoding - The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal entities or a document entity that is parsed from a java.io.Reader).
augs - Additional information that may include infoset augmentations
Throws:
XNIException - Thrown by handler to signal an error.

endEntity

public void endEntity(java.lang.String name,
                      Augmentations augs)
               throws XNIException
This method notifies the end of an entity. The document entity has the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]" parameter entity names start with '%'; and general entities are just specified by their name.

Parameters:
name - The name of the entity.
augs - Additional information that may include infoset augmentations
Throws:
XNIException - Thrown by handler to signal an error.