org.apache.xerces.impl
Class XMLDocumentFragmentScannerImpl

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

public class XMLDocumentFragmentScannerImpl
extends XMLScanner
implements XMLDocumentScanner, XMLComponent, XMLEntityHandler

This class is responsible for scanning the structure and content of document fragments. The scanner acts as the source for the document information which is communicated to the document handler.

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

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

Constructor Summary
XMLDocumentFragmentScannerImpl()
          Default constructor.
 
Method Summary
 void endEntity(java.lang.String name, Augmentations augs)
          This method notifies the end of an entity.
 java.lang.String getDispatcherName(org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.Dispatcher dispatcher)
          Returns the dispatcher name.
 XMLDocumentHandler getDocumentHandler()
          Returns the document handler
 java.lang.Boolean getFeatureDefault(java.lang.String featureId)
          Returns the default state for a feature, or null if this component does not want to report a default value for this feature.
 java.lang.Object getPropertyDefault(java.lang.String propertyId)
          Returns the default state for a property, or null if this component does not want to report a default value for this property.
 java.lang.String[] getRecognizedFeatures()
          Returns a list of feature identifiers that are recognized by this component.
 java.lang.String[] getRecognizedProperties()
          Returns a list of property identifiers that are recognized by this component.
 void reset(XMLComponentManager componentManager)
          Resets the component.
 boolean scanDocument(boolean complete)
          Scans a document.
 void setDocumentHandler(XMLDocumentHandler documentHandler)
          setDocumentHandler
 void setFeature(java.lang.String featureId, boolean state)
          Sets the state of a feature.
 void setInputSource(XMLInputSource inputSource)
          Sets the input source.
 void setProperty(java.lang.String propertyId, java.lang.Object value)
          Sets the value of a property.
 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 org.apache.xerces.impl.XMLScanner
getFeature, scanPseudoAttribute
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDocumentFragmentScannerImpl

public XMLDocumentFragmentScannerImpl()
Default constructor.

Method Detail

setInputSource

public void setInputSource(XMLInputSource inputSource)
                    throws java.io.IOException
Sets the input source.

Specified by:
setInputSource in interface XMLDocumentScanner
Parameters:
inputSource - The input source.
Throws:
java.io.IOException - Thrown on i/o error.

scanDocument

public boolean scanDocument(boolean complete)
                     throws java.io.IOException,
                            XNIException
Scans a document.

Specified by:
scanDocument in interface XMLDocumentScanner
Parameters:
complete - True if the scanner should scan the document completely, pushing all events to the registered document handler. A value of false indicates that that the scanner should only scan the next portion of the document and return. A scanner instance is permitted to completely scan a document if it does not support this "pull" scanning model.
Returns:
True if there is more to scan, false otherwise.
Throws:
java.io.IOException
XNIException

reset

public void reset(XMLComponentManager componentManager)
           throws XMLConfigurationException
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
Overrides:
reset in class XMLScanner
Parameters:
componentManager - The component manager.
Throws:
SAXException - Thrown by component on initialization error. For example, if a feature or property is required for the operation of the component, the component manager may throw a SAXNotRecognizedException or a SAXNotSupportedException.
XMLConfigurationException

getRecognizedFeatures

public java.lang.String[] getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by this component. This method may return null if no features are recognized by this component.

Specified by:
getRecognizedFeatures in interface XMLComponent

setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
                throws XMLConfigurationException
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
Overrides:
setFeature in class XMLScanner
Parameters:
featureId - The feature identifier.
state - The state of the feature.
Throws:
SAXNotRecognizedException - The component should not throw this exception.
SAXNotSupportedException - The component should not throw this exception.
XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

getRecognizedProperties

public java.lang.String[] getRecognizedProperties()
Returns a list of property identifiers that are recognized by this component. This method may return null if no properties are recognized by this component.

Specified by:
getRecognizedProperties in interface XMLComponent

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
                 throws XMLConfigurationException
Sets the value of a property. This method is called by the component manager any time after reset when a property changes value.

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

Specified by:
setProperty in interface XMLComponent
Overrides:
setProperty in class XMLScanner
Parameters:
propertyId - The property identifier.
value - The value of the property.
Throws:
SAXNotRecognizedException - The component should not throw this exception.
SAXNotSupportedException - The component should not throw this exception.
XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

getFeatureDefault

public java.lang.Boolean getFeatureDefault(java.lang.String featureId)
Returns the default state for a feature, or null if this component does not want to report a default value for this feature.

Specified by:
getFeatureDefault in interface XMLComponent
Parameters:
featureId - The feature identifier.
Since:
Xerces 2.2.0

getPropertyDefault

public java.lang.Object getPropertyDefault(java.lang.String propertyId)
Returns the default state for a property, or null if this component does not want to report a default value for this property.

Specified by:
getPropertyDefault in interface XMLComponent
Parameters:
propertyId - The property identifier.
Since:
Xerces 2.2.0

setDocumentHandler

public void setDocumentHandler(XMLDocumentHandler documentHandler)
setDocumentHandler

Specified by:
setDocumentHandler in interface XMLDocumentSource
Parameters:
documentHandler -

getDocumentHandler

public XMLDocumentHandler getDocumentHandler()
Returns the document handler

Specified by:
getDocumentHandler in interface XMLDocumentSource

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 DTD has the pseudo-name of "[dtd]" parameter entity names start with '%'; and general entities are just specified by their name.

Specified by:
startEntity in interface XMLEntityHandler
Overrides:
startEntity in class XMLScanner
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 DTD has the pseudo-name of "[dtd]" parameter entity names start with '%'; and general entities are just specified by their name.

Specified by:
endEntity in interface XMLEntityHandler
Overrides:
endEntity in class XMLScanner
Parameters:
name - The name of the entity.
augs - Additional information that may include infoset augmentations
Throws:
XNIException - Thrown by handler to signal an error.

getDispatcherName

public java.lang.String getDispatcherName(org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.Dispatcher dispatcher)
Returns the dispatcher name.