public class

XMLDocumentScannerImpl

extends XMLDocumentFragmentScannerImpl
java.lang.Object
   ↳ org.apache.xerces.impl.XMLScanner
     ↳ org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
       ↳ org.apache.xerces.impl.XMLDocumentScannerImpl
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

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:

  • http://xml.org/sax/features/namespaces
  • http://xml.org/sax/features/validation
  • http://apache.org/xml/features/nonvalidating/load-external-dtd
  • http://apache.org/xml/features/scanner/notify-char-refs
  • http://apache.org/xml/features/scanner/notify-builtin-refs
  • http://apache.org/xml/properties/internal/symbol-table
  • http://apache.org/xml/properties/internal/error-reporter
  • http://apache.org/xml/properties/internal/entity-manager
  • http://apache.org/xml/properties/internal/dtd-scanner
@xerces.internal

Summary

Nested Classes
class XMLDocumentScannerImpl.ContentDispatcher Dispatcher to handle content scanning. 
class XMLDocumentScannerImpl.DTDDispatcher Dispatcher to handle the internal and external DTD subsets. 
class XMLDocumentScannerImpl.PrologDispatcher Dispatcher to handle prolog scanning. 
class XMLDocumentScannerImpl.TrailingMiscDispatcher Dispatcher to handle trailing miscellaneous section scanning. 
class XMLDocumentScannerImpl.XMLDeclDispatcher Dispatcher to handle XMLDecl scanning. 
Constants
String DISALLOW_DOCTYPE_DECL_FEATURE Feature identifier: load external DTD.
String DTD_SCANNER Property identifier: DTD scanner.
String LOAD_EXTERNAL_DTD Feature identifier: load external DTD.
String NAMESPACE_CONTEXT property identifier: NamespaceContext
int SCANNER_STATE_DTD_EXTERNAL Scanner state: open DTD external subset.
int SCANNER_STATE_DTD_EXTERNAL_DECLS Scanner state: DTD external declarations.
int SCANNER_STATE_DTD_INTERNAL_DECLS Scanner state: DTD internal declarations.
int SCANNER_STATE_PROLOG Scanner state: prolog.
int SCANNER_STATE_TRAILING_MISC Scanner state: trailing misc.
int SCANNER_STATE_XML_DECL Scanner state: XML declaration.
String VALIDATION_MANAGER property identifier: ValidationManager
[Expand]
Inherited Constants
From class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
From class org.apache.xerces.impl.XMLScanner
Fields
protected XMLDocumentFragmentScannerImpl.Dispatcher fDTDDispatcher DTD dispatcher.
protected XMLDTDScanner fDTDScanner DTD scanner.
protected boolean fDisallowDoctype Disallow doctype declaration.
protected String fDoctypeName Doctype name.
protected String fDoctypePublicId Doctype declaration public identifier.
protected String fDoctypeSystemId Doctype declaration system identifier.
protected boolean fLoadExternalDTD Load external DTD.
protected NamespaceContext fNamespaceContext Namespace support.
protected XMLDocumentFragmentScannerImpl.Dispatcher fPrologDispatcher Prolog dispatcher.
protected boolean fScanningDTD Scanning DTD.
protected boolean fSeenDoctypeDecl Seen doctype declaration.
protected XMLDocumentFragmentScannerImpl.Dispatcher fTrailingMiscDispatcher Trailing miscellaneous section dispatcher.
protected ValidationManager fValidationManager Validation manager .
protected XMLDocumentFragmentScannerImpl.Dispatcher fXMLDeclDispatcher XML declaration dispatcher.
[Expand]
Inherited Fields
From class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
From class org.apache.xerces.impl.XMLScanner
Public Constructors
XMLDocumentScannerImpl()
Default constructor.
Public Methods
void endEntity(String name, Augmentations augs)
This method notifies the end of an entity.
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.
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.
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.
void reset(XMLComponentManager componentManager)
Resets the component.
void setFeature(String featureId, boolean state)
Sets the state of a feature.
void setInputSource(XMLInputSource inputSource)
Sets the input source.
void setProperty(String propertyId, Object value)
Sets the value of a property.
void startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs)
This method notifies of the start of an entity.
Protected Methods
XMLDocumentFragmentScannerImpl.Dispatcher createContentDispatcher()
Creates a content dispatcher.
String getScannerStateName(int state)
Returns the scanner state name.
boolean scanDoctypeDecl()
Scans a doctype declaration.
[Expand]
Inherited Methods
From class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
From class org.apache.xerces.impl.XMLScanner
From class java.lang.Object
From interface org.apache.xerces.impl.XMLEntityHandler
From interface org.apache.xerces.xni.parser.XMLComponent
From interface org.apache.xerces.xni.parser.XMLDocumentScanner
From interface org.apache.xerces.xni.parser.XMLDocumentSource

Constants

protected static final String DISALLOW_DOCTYPE_DECL_FEATURE

Feature identifier: load external DTD.

Constant Value: "http://apache.org/xml/features/disallow-doctype-decl"

protected static final String DTD_SCANNER

Property identifier: DTD scanner.

Constant Value: "http://apache.org/xml/properties/internal/dtd-scanner"

protected static final String LOAD_EXTERNAL_DTD

Feature identifier: load external DTD.

Constant Value: "http://apache.org/xml/features/nonvalidating/load-external-dtd"

protected static final String NAMESPACE_CONTEXT

property identifier: NamespaceContext

Constant Value: "http://apache.org/xml/properties/internal/namespace-context"

protected static final int SCANNER_STATE_DTD_EXTERNAL

Scanner state: open DTD external subset.

Constant Value: 18 (0x00000012)

protected static final int SCANNER_STATE_DTD_EXTERNAL_DECLS

Scanner state: DTD external declarations.

Constant Value: 19 (0x00000013)

protected static final int SCANNER_STATE_DTD_INTERNAL_DECLS

Scanner state: DTD internal declarations.

Constant Value: 17 (0x00000011)

protected static final int SCANNER_STATE_PROLOG

Scanner state: prolog.

Constant Value: 5 (0x00000005)

protected static final int SCANNER_STATE_TRAILING_MISC

Scanner state: trailing misc.

Constant Value: 12 (0x0000000c)

protected static final int SCANNER_STATE_XML_DECL

Scanner state: XML declaration.

Constant Value: 0 (0x00000000)

protected static final String VALIDATION_MANAGER

property identifier: ValidationManager

Constant Value: "http://apache.org/xml/properties/internal/validation-manager"

Fields

protected XMLDocumentFragmentScannerImpl.Dispatcher fDTDDispatcher

DTD dispatcher.

protected XMLDTDScanner fDTDScanner

DTD scanner.

protected boolean fDisallowDoctype

Disallow doctype declaration.

protected String fDoctypeName

Doctype name.

protected String fDoctypePublicId

Doctype declaration public identifier.

protected String fDoctypeSystemId

Doctype declaration system identifier.

protected boolean fLoadExternalDTD

Load external DTD.

protected NamespaceContext fNamespaceContext

Namespace support.

protected XMLDocumentFragmentScannerImpl.Dispatcher fPrologDispatcher

Prolog dispatcher.

protected boolean fScanningDTD

Scanning DTD.

protected boolean fSeenDoctypeDecl

Seen doctype declaration.

protected XMLDocumentFragmentScannerImpl.Dispatcher fTrailingMiscDispatcher

Trailing miscellaneous section dispatcher.

protected ValidationManager fValidationManager

Validation manager .

protected XMLDocumentFragmentScannerImpl.Dispatcher fXMLDeclDispatcher

XML declaration dispatcher.

Public Constructors

public XMLDocumentScannerImpl ()

Default constructor.

Public Methods

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.
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

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.

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.

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.

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.

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

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
The component should not throw this exception.
The component should not throw this exception.
XMLConfigurationException

public void setInputSource (XMLInputSource inputSource)

Sets the input source.

Parameters
inputSource The input source.
Throws
IOException Thrown on i/o error.

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
The component should not throw this exception.
The component should not throw this exception.
XMLConfigurationException

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).
augs Additional information that may include infoset augmentations
Throws
XNIException Thrown by handler to signal an error.

Protected Methods

protected XMLDocumentFragmentScannerImpl.Dispatcher createContentDispatcher ()

Creates a content dispatcher.

protected String getScannerStateName (int state)

Returns the scanner state name.

protected boolean scanDoctypeDecl ()

Scans a doctype declaration.