org.apache.xerces.impl
Class XMLDTDScannerImpl

java.lang.Object
  extended by org.apache.xerces.impl.XMLScanner
      extended by org.apache.xerces.impl.XMLDTDScannerImpl
All Implemented Interfaces:
XMLEntityHandler, XMLComponent, XMLDTDContentModelSource, XMLDTDScanner, XMLDTDSource
Direct Known Subclasses:
XML11DTDScannerImpl

public class XMLDTDScannerImpl
extends XMLScanner
implements XMLDTDScanner, XMLComponent, XMLEntityHandler

This class is responsible for scanning the declarations found in the internal and external subsets of a DTD in an XML document. The scanner acts as the sources for the DTD information which is communicated to the DTD handlers.

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

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

Constructor Summary
XMLDTDScannerImpl()
          Default constructor.
XMLDTDScannerImpl(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)
          Constructor for he use of non-XMLComponentManagers.
 
Method Summary
 void endEntity(java.lang.String name, Augmentations augs)
          This method notifies the end of an entity.
 XMLDTDContentModelHandler getDTDContentModelHandler()
          getDTDContentModelHandler
 XMLDTDHandler getDTDHandler()
          getDTDHandler
 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()
           
 void reset(XMLComponentManager componentManager)
          reset
 boolean scanDTDExternalSubset(boolean complete)
          Scans the external subset of the document.
 boolean scanDTDInternalSubset(boolean complete, boolean standalone, boolean hasExternalSubset)
          Scans the internal subset of the document.
 void setDTDContentModelHandler(XMLDTDContentModelHandler dtdContentModelHandler)
          setDTDContentModelHandler
 void setDTDHandler(XMLDTDHandler dtdHandler)
          setDTDHandler
 void setInputSource(XMLInputSource inputSource)
          Sets the input source.
 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, setFeature, setProperty
 
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
setFeature, setProperty
 

Constructor Detail

XMLDTDScannerImpl

public XMLDTDScannerImpl()
Default constructor.


XMLDTDScannerImpl

public XMLDTDScannerImpl(SymbolTable symbolTable,
                         XMLErrorReporter errorReporter,
                         XMLEntityManager entityManager)
Constructor for he use of non-XMLComponentManagers.

Method Detail

setInputSource

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

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

scanDTDExternalSubset

public boolean scanDTDExternalSubset(boolean complete)
                              throws java.io.IOException,
                                     XNIException
Scans the external subset of the document.

Specified by:
scanDTDExternalSubset in interface XMLDTDScanner
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

scanDTDInternalSubset

public boolean scanDTDInternalSubset(boolean complete,
                                     boolean standalone,
                                     boolean hasExternalSubset)
                              throws java.io.IOException,
                                     XNIException
Scans the internal subset of the document.

Specified by:
scanDTDInternalSubset in interface XMLDTDScanner
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.
standalone - True if the document was specified as standalone. This value is important for verifying certain well-formedness constraints.
hasExternalSubset - True if the document has an external DTD. This allows the scanner to properly notify the handler of the end of the DTD in the absence of an external subset.
Returns:
True if there is more to scan, false otherwise.
Throws:
java.io.IOException
XNIException

reset

public void reset(XMLComponentManager componentManager)
           throws XMLConfigurationException
reset

Specified by:
reset in interface XMLComponent
Overrides:
reset in class XMLScanner
Parameters:
componentManager -
Throws:
XMLConfigurationException

reset

public void reset()

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

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

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

setDTDHandler

public void setDTDHandler(XMLDTDHandler dtdHandler)
setDTDHandler

Specified by:
setDTDHandler in interface XMLDTDSource
Parameters:
dtdHandler -

getDTDHandler

public XMLDTDHandler getDTDHandler()
getDTDHandler

Specified by:
getDTDHandler in interface XMLDTDSource
Returns:
the XMLDTDHandler

setDTDContentModelHandler

public void setDTDContentModelHandler(XMLDTDContentModelHandler dtdContentModelHandler)
setDTDContentModelHandler

Specified by:
setDTDContentModelHandler in interface XMLDTDContentModelSource
Parameters:
dtdContentModelHandler -

getDTDContentModelHandler

public XMLDTDContentModelHandler getDTDContentModelHandler()
getDTDContentModelHandler

Specified by:
getDTDContentModelHandler in interface XMLDTDContentModelSource
Returns:
XMLDTDContentModelHandler

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.