org.apache.xerces.impl

Class XMLDocumentScannerImpl

public class XMLDocumentScannerImpl extends XMLDocumentFragmentScannerImpl

This class is responsible for scanning XML document structure and content. 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: XMLDocumentScannerImpl.java,v 1.51 2005/02/24 19:03:49 mrglavas Exp $

Author: Glenn Marcy, IBM Andy Clark, IBM Arnaud Le Hors, IBM Eric Ye, IBM

UNKNOWN:

Nested Class Summary
protected classXMLDocumentScannerImpl.ContentDispatcher
Dispatcher to handle content scanning.
protected classXMLDocumentScannerImpl.DTDDispatcher
Dispatcher to handle the internal and external DTD subsets.
protected classXMLDocumentScannerImpl.PrologDispatcher
Dispatcher to handle prolog scanning.
protected classXMLDocumentScannerImpl.TrailingMiscDispatcher
Dispatcher to handle trailing miscellaneous section scanning.
protected classXMLDocumentScannerImpl.XMLDeclDispatcher
Dispatcher to handle XMLDecl scanning.
Field Summary
protected static StringDISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: load external DTD.
protected static StringDTD_SCANNER
Property identifier: DTD scanner.
protected booleanfDisallowDoctype
Disallow doctype declaration.
protected StringfDoctypeName
Doctype name.
protected StringfDoctypePublicId
Doctype declaration public identifier.
protected StringfDoctypeSystemId
Doctype declaration system identifier.
protected DispatcherfDTDDispatcher
DTD dispatcher.
protected XMLDTDScannerfDTDScanner
DTD scanner.
protected booleanfLoadExternalDTD
Load external DTD.
protected NamespaceContextfNamespaceContext
Namespace support.
protected DispatcherfPrologDispatcher
Prolog dispatcher.
protected booleanfScanningDTD
Scanning DTD.
protected booleanfSeenDoctypeDecl
Seen doctype declaration.
protected DispatcherfTrailingMiscDispatcher
Trailing miscellaneous section dispatcher.
protected ValidationManagerfValidationManager
Validation manager .
protected DispatcherfXMLDeclDispatcher
XML declaration dispatcher.
protected static StringLOAD_EXTERNAL_DTD
Feature identifier: load external DTD.
protected static StringNAMESPACE_CONTEXT
property identifier: NamespaceContext
protected static intSCANNER_STATE_DTD_EXTERNAL
Scanner state: open DTD external subset.
protected static intSCANNER_STATE_DTD_EXTERNAL_DECLS
Scanner state: DTD external declarations.
protected static intSCANNER_STATE_DTD_INTERNAL_DECLS
Scanner state: DTD internal declarations.
protected static intSCANNER_STATE_PROLOG
Scanner state: prolog.
protected static intSCANNER_STATE_TRAILING_MISC
Scanner state: trailing misc.
protected static intSCANNER_STATE_XML_DECL
Scanner state: XML declaration.
protected static StringVALIDATION_MANAGER
property identifier: ValidationManager
Constructor Summary
XMLDocumentScannerImpl()
Default constructor.
Method Summary
protected DispatchercreateContentDispatcher()
Creates a content dispatcher.
voidendEntity(String name, Augmentations augs)
This method notifies the end of an entity.
BooleangetFeatureDefault(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.
ObjectgetPropertyDefault(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.
String[]getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by this component.
String[]getRecognizedProperties()
Returns a list of property identifiers that are recognized by this component.
protected StringgetScannerStateName(int state)
Returns the scanner state name.
voidreset(XMLComponentManager componentManager)
Resets the component.
protected booleanscanDoctypeDecl()
Scans a doctype declaration.
voidsetFeature(String featureId, boolean state)
Sets the state of a feature.
voidsetInputSource(XMLInputSource inputSource)
Sets the input source.
voidsetProperty(String propertyId, Object value)
Sets the value of a property.
voidstartEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs)
This method notifies of the start of an entity.

Field Detail

DISALLOW_DOCTYPE_DECL_FEATURE

protected static final String DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: load external DTD.

DTD_SCANNER

protected static final String DTD_SCANNER
Property identifier: DTD scanner.

fDisallowDoctype

protected boolean fDisallowDoctype
Disallow doctype declaration.

fDoctypeName

protected String fDoctypeName
Doctype name.

fDoctypePublicId

protected String fDoctypePublicId
Doctype declaration public identifier.

fDoctypeSystemId

protected String fDoctypeSystemId
Doctype declaration system identifier.

fDTDDispatcher

protected Dispatcher fDTDDispatcher
DTD dispatcher.

fDTDScanner

protected XMLDTDScanner fDTDScanner
DTD scanner.

fLoadExternalDTD

protected boolean fLoadExternalDTD
Load external DTD.

fNamespaceContext

protected NamespaceContext fNamespaceContext
Namespace support.

fPrologDispatcher

protected Dispatcher fPrologDispatcher
Prolog dispatcher.

fScanningDTD

protected boolean fScanningDTD
Scanning DTD.

fSeenDoctypeDecl

protected boolean fSeenDoctypeDecl
Seen doctype declaration.

fTrailingMiscDispatcher

protected Dispatcher fTrailingMiscDispatcher
Trailing miscellaneous section dispatcher.

fValidationManager

protected ValidationManager fValidationManager
Validation manager .

fXMLDeclDispatcher

protected Dispatcher fXMLDeclDispatcher
XML declaration dispatcher.

LOAD_EXTERNAL_DTD

protected static final String LOAD_EXTERNAL_DTD
Feature identifier: load external DTD.

NAMESPACE_CONTEXT

protected static final String NAMESPACE_CONTEXT
property identifier: NamespaceContext

SCANNER_STATE_DTD_EXTERNAL

protected static final int SCANNER_STATE_DTD_EXTERNAL
Scanner state: open DTD external subset.

SCANNER_STATE_DTD_EXTERNAL_DECLS

protected static final int SCANNER_STATE_DTD_EXTERNAL_DECLS
Scanner state: DTD external declarations.

SCANNER_STATE_DTD_INTERNAL_DECLS

protected static final int SCANNER_STATE_DTD_INTERNAL_DECLS
Scanner state: DTD internal declarations.

SCANNER_STATE_PROLOG

protected static final int SCANNER_STATE_PROLOG
Scanner state: prolog.

SCANNER_STATE_TRAILING_MISC

protected static final int SCANNER_STATE_TRAILING_MISC
Scanner state: trailing misc.

SCANNER_STATE_XML_DECL

protected static final int SCANNER_STATE_XML_DECL
Scanner state: XML declaration.

VALIDATION_MANAGER

protected static final String VALIDATION_MANAGER
property identifier: ValidationManager

Constructor Detail

XMLDocumentScannerImpl

public XMLDocumentScannerImpl()
Default constructor.

Method Detail

createContentDispatcher

protected Dispatcher createContentDispatcher()
Creates a content dispatcher.

endEntity

public void endEntity(String name, Augmentations augs)
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.

Parameters: name The name of the entity.

Throws: XNIException Thrown by handler to signal an error.

getFeatureDefault

public Boolean getFeatureDefault(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.

Parameters: featureId The feature identifier.

Since: Xerces 2.2.0

getPropertyDefault

public Object getPropertyDefault(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.

Parameters: propertyId The property identifier.

Since: Xerces 2.2.0

getRecognizedFeatures

public 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.

getRecognizedProperties

public 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.

getScannerStateName

protected String getScannerStateName(int state)
Returns the scanner state name.

reset

public void reset(XMLComponentManager componentManager)
Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.

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.

scanDoctypeDecl

protected boolean scanDoctypeDecl()
Scans a doctype declaration.

setFeature

public void setFeature(String featureId, boolean state)
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.

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.

setInputSource

public void setInputSource(XMLInputSource inputSource)
Sets the input source.

Parameters: inputSource The input source.

Throws: IOException Thrown on i/o error.

setProperty

public void setProperty(String propertyId, Object value)
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.

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.

startEntity

public void startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs)
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.

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).

Throws: XNIException Thrown by handler to signal an error.

Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.