org.apache.xerces.impl

Class XMLDocumentScannerImpl

Implemented Interfaces:
org.apache.xerces.xni.parser.XMLDocumentScanner, org.apache.xerces.xni.parser.XMLComponent, XMLEntityHandler
Known Direct Subclasses:
XML11DocumentScannerImpl, XMLNSDocumentScannerImpl

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 418359 2006-06-30 18:48:35Z mrglavas $
Authors:
Glenn Marcy, IBM
Andy Clark, IBM
Arnaud Le Hors, IBM
Eric Ye, IBM

Nested Class Summary

protected class
XMLDocumentScannerImpl.ContentDispatcher
Dispatcher to handle content scanning.
protected class
XMLDocumentScannerImpl.DTDDispatcher
Dispatcher to handle the internal and external DTD subsets.
protected class
XMLDocumentScannerImpl.PrologDispatcher
Dispatcher to handle prolog scanning.
protected class
XMLDocumentScannerImpl.TrailingMiscDispatcher
Dispatcher to handle trailing miscellaneous section scanning.
protected class
XMLDocumentScannerImpl.XMLDeclDispatcher
Dispatcher to handle XMLDecl scanning.

Nested classes/interfaces inherited from class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl

XMLDocumentFragmentScannerImpl.Dispatcher, XMLDocumentFragmentScannerImpl.ElementStack, XMLDocumentFragmentScannerImpl.FragmentContentDispatcher

Field Summary

protected static String
DISALLOW_DOCTYPE_DECL_FEATURE
Feature identifier: load external DTD.
protected static String
DTD_SCANNER
Property identifier: DTD scanner.
protected static String
LOAD_EXTERNAL_DTD
Feature identifier: load external DTD.
protected static String
NAMESPACE_CONTEXT
property identifier: NamespaceContext
protected static int
SCANNER_STATE_DTD_EXTERNAL
Scanner state: open DTD external subset.
protected static int
SCANNER_STATE_DTD_EXTERNAL_DECLS
Scanner state: DTD external declarations.
protected static int
SCANNER_STATE_DTD_INTERNAL_DECLS
Scanner state: DTD internal declarations.
protected static int
SCANNER_STATE_PROLOG
Scanner state: prolog.
protected static int
SCANNER_STATE_TRAILING_MISC
Scanner state: trailing misc.
protected static int
SCANNER_STATE_XML_DECL
Scanner state: XML declaration.
protected static String
VALIDATION_MANAGER
property identifier: ValidationManager
protected XMLDocumentFragmentScannerImpl.Dispatcher
fDTDDispatcher
DTD dispatcher.
protected org.apache.xerces.xni.parser.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 org.apache.xerces.xni.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.

Fields inherited from class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl

DEBUG_CONTENT_SCANNING, ENTITY_RESOLVER, NAMESPACES, NOTIFY_BUILTIN_REFS, SCANNER_STATE_CDATA, SCANNER_STATE_COMMENT, SCANNER_STATE_CONTENT, SCANNER_STATE_DOCTYPE, SCANNER_STATE_END_OF_INPUT, SCANNER_STATE_PI, SCANNER_STATE_REFERENCE, SCANNER_STATE_ROOT_ELEMENT, SCANNER_STATE_START_OF_MARKUP, SCANNER_STATE_TERMINATED, SCANNER_STATE_TEXT_DECL, fAttributeQName, fAttributes, fContentDispatcher, fCurrentElement, fDispatcher, fDocumentHandler, fElementQName, fElementStack, fEntityStack, fExternalSubsetResolver, fHasExternalDTD, fInScanContent, fMarkupDepth, fNotifyBuiltInRefs, fScannerState, fStandalone, fTempString, fTempString2

Fields inherited from class org.apache.xerces.impl.XMLScanner

DEBUG_ATTR_NORMALIZATION, ENTITY_MANAGER, ERROR_REPORTER, NAMESPACES, NOTIFY_CHAR_REFS, PARSER_SETTINGS, SYMBOL_TABLE, VALIDATION, fAmpSymbol, fAposSymbol, fCharRefLiteral, fEncodingSymbol, fEntityDepth, fEntityManager, fEntityScanner, fErrorReporter, fGtSymbol, fLtSymbol, fNamespaces, fNotifyCharRefs, fParserSettings, fQuotSymbol, fReportEntity, fResourceIdentifier, fScanningAttribute, fStandaloneSymbol, fSymbolTable, fValidation, fVersionSymbol

Constructor Summary

XMLDocumentScannerImpl()
Default constructor.

Method Summary

protected XMLDocumentFragmentScannerImpl.Dispatcher
createContentDispatcher()
Creates a content dispatcher.
void
endEntity(String name, org.apache.xerces.xni.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.
protected String
getScannerStateName(int state)
Returns the scanner state name.
void
reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
Resets the component.
protected boolean
scanDoctypeDecl()
Scans a doctype declaration.
void
setFeature(String featureId, boolean state)
Sets the state of a feature.
void
setInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource)
Sets the input source.
void
setProperty(String propertyId, Object value)
Sets the value of a property.
void
startEntity(String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, String encoding, org.apache.xerces.xni.Augmentations augs)
This method notifies of the start of an entity.

Methods inherited from class org.apache.xerces.impl.XMLDocumentFragmentScannerImpl

createContentDispatcher, endEntity, getDispatcherName, getDocumentHandler, getFeatureDefault, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, getScannerStateName, handleEndElement, reset, scanAttribute, scanCDATASection, scanCharReference, scanComment, scanContent, scanDocument, scanEndElement, scanEntityReference, scanPIData, scanStartElement, scanStartElementAfterName, scanStartElementName, scanXMLDeclOrTextDecl, setDispatcher, setDocumentHandler, setFeature, setInputSource, setProperty, setScannerState, startEntity

Methods inherited from class org.apache.xerces.impl.XMLScanner

endEntity, getFeature, getVersionNotSupportedKey, isInvalid, isInvalidLiteral, isUnchangedByNormalization, isValidNCName, isValidNameChar, isValidNameStartChar, isValidNameStartHighSurrogate, normalizeWhitespace, normalizeWhitespace, reportFatalError, reset, reset, scanAttributeValue, scanCharReferenceValue, scanComment, scanExternalID, scanPI, scanPIData, scanPseudoAttribute, scanPubidLiteral, scanSurrogates, scanXMLDeclOrTextDecl, setFeature, setProperty, startEntity, versionSupported

Field Details

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.

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.
Field Value:
18

SCANNER_STATE_DTD_EXTERNAL_DECLS

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

SCANNER_STATE_DTD_INTERNAL_DECLS

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

SCANNER_STATE_PROLOG

protected static final int SCANNER_STATE_PROLOG
Scanner state: prolog.
Field Value:
5

SCANNER_STATE_TRAILING_MISC

protected static final int SCANNER_STATE_TRAILING_MISC
Scanner state: trailing misc.
Field Value:
12

SCANNER_STATE_XML_DECL

protected static final int SCANNER_STATE_XML_DECL
Scanner state: XML declaration.
Field Value:
0

VALIDATION_MANAGER

protected static final String VALIDATION_MANAGER
property identifier: ValidationManager

fDTDDispatcher

protected XMLDocumentFragmentScannerImpl.Dispatcher fDTDDispatcher
DTD dispatcher.

fDTDScanner

protected org.apache.xerces.xni.parser.XMLDTDScanner fDTDScanner
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.

fLoadExternalDTD

protected boolean fLoadExternalDTD
Load external DTD.

fNamespaceContext

protected org.apache.xerces.xni.NamespaceContext fNamespaceContext
Namespace support.

fPrologDispatcher

protected XMLDocumentFragmentScannerImpl.Dispatcher fPrologDispatcher
Prolog dispatcher.

fScanningDTD

protected boolean fScanningDTD
Scanning DTD.

fSeenDoctypeDecl

protected boolean fSeenDoctypeDecl
Seen doctype declaration.

fTrailingMiscDispatcher

protected XMLDocumentFragmentScannerImpl.Dispatcher fTrailingMiscDispatcher
Trailing miscellaneous section dispatcher.

fValidationManager

protected ValidationManager fValidationManager
Validation manager .

fXMLDeclDispatcher

protected XMLDocumentFragmentScannerImpl.Dispatcher fXMLDeclDispatcher
XML declaration dispatcher.

Constructor Details

XMLDocumentScannerImpl

public XMLDocumentScannerImpl()
Default constructor.

Method Details

createContentDispatcher

protected XMLDocumentFragmentScannerImpl.Dispatcher createContentDispatcher()
Creates a content dispatcher.
Overrides:
createContentDispatcher in interface XMLDocumentFragmentScannerImpl

endEntity

public void endEntity(String name,
                      org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.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 interface XMLDocumentFragmentScannerImpl
Parameters:
name - The name of the entity.
Throws:
org.apache.xerces.xni.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.
Specified by:
getFeatureDefault in interface org.apache.xerces.xni.parser.XMLComponent
Overrides:
getFeatureDefault in interface XMLDocumentFragmentScannerImpl
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.
Specified by:
getPropertyDefault in interface org.apache.xerces.xni.parser.XMLComponent
Overrides:
getPropertyDefault in interface XMLDocumentFragmentScannerImpl
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.
Specified by:
getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponent
Overrides:
getRecognizedFeatures in interface XMLDocumentFragmentScannerImpl

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.
Specified by:
getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponent
Overrides:
getRecognizedProperties in interface XMLDocumentFragmentScannerImpl

getScannerStateName

protected String getScannerStateName(int state)
Returns the scanner state name.
Overrides:
getScannerStateName in interface XMLDocumentFragmentScannerImpl

reset

public void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
            throws org.apache.xerces.xni.parser.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 org.apache.xerces.xni.parser.XMLComponent
Overrides:
reset in interface XMLDocumentFragmentScannerImpl
Parameters:
componentManager - The component manager.

scanDoctypeDecl

protected boolean scanDoctypeDecl()
            throws IOException,
                   org.apache.xerces.xni.XNIException
Scans a doctype declaration.

setFeature

public void setFeature(String featureId,
                       boolean state)
            throws org.apache.xerces.xni.parser.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 org.apache.xerces.xni.parser.XMLComponent
Overrides:
setFeature in interface XMLDocumentFragmentScannerImpl
Parameters:
featureId - The feature identifier.
state - The state of the feature.

setInputSource

public void setInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource)
            throws IOException
Sets the input source.
Overrides:
setInputSource in interface XMLDocumentFragmentScannerImpl
Parameters:
inputSource - The input source.

setProperty

public void setProperty(String propertyId,
                        Object value)
            throws org.apache.xerces.xni.parser.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 org.apache.xerces.xni.parser.XMLComponent
Overrides:
setProperty in interface XMLDocumentFragmentScannerImpl
Parameters:
propertyId - The property identifier.
value - The value of the property.

startEntity

public void startEntity(String name,
                        org.apache.xerces.xni.XMLResourceIdentifier identifier,
                        String encoding,
                        org.apache.xerces.xni.Augmentations augs)
            throws org.apache.xerces.xni.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 interface XMLDocumentFragmentScannerImpl
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:
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.

Copyright B) 1999-2006 The Apache Software Foundation. All Rights Reserved.