Top Description Inners Fields Constructors Methods
org.apache.xerces.impl

public Class XMLDocumentFragmentScannerImpl

extends XMLScanner
implements XMLDocumentScanner, XMLComponent, XMLEntityHandler
Class Inheritance
All Implemented Interfaces
org.apache.xerces.impl.XMLEntityHandler, org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.parser.XMLDocumentScanner, org.apache.xerces.xni.parser.XMLDocumentSource
Known Direct Subclasses
org.apache.xerces.impl.XMLDocumentScannerImpl
Imports
java.io.CharConversionException, .EOFException, .IOException, org.apache.xerces.impl.io.MalformedByteSequenceException, org.apache.xerces.impl.msg.XMLMessageFormatter, org.apache.xerces.util.AugmentationsImpl, .XMLAttributesImpl, .XMLChar, .XMLStringBuffer, .XMLSymbols, org.apache.xerces.xni.Augmentations, .QName, .XMLAttributes, .XMLDocumentHandler, .XMLResourceIdentifier, .XMLString, .XNIException, org.apache.xerces.xni.parser.XMLComponent, .XMLComponentManager, .XMLConfigurationException, .XMLDocumentScanner, .XMLInputSource

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:

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static interface
XMLDocumentFragmentScannerImpl.Dispatcher

This interface defines an XML "event" dispatching model.

protected static class
protected class
XMLDocumentFragmentScannerImpl.FragmentContentDispatcher

Dispatcher to handle content scanning.

Field Summary

Modifier and TypeField and Description
protected static final boolean
DEBUG_CONTENT_SCANNING

Debug content dispatcher scanning.

private static final boolean
DEBUG_DISPATCHER

Debug dispatcher.

private static final boolean
DEBUG_SCANNER_STATE

Debug scanner state.

protected static final String
ENTITY_RESOLVER

Property identifier: entity resolver.

protected final QName
fAttributeQName

Attribute QName.

protected final XMLAttributesImpl
fAttributes

Element attributes.

protected final XMLDocumentFragmentScannerImpl.Dispatcher
fContentDispatcher

Content dispatcher.

protected QName
fCurrentElement

Current element.

protected XMLDocumentFragmentScannerImpl.Dispatcher
fDispatcher

Active dispatcher.

protected XMLDocumentHandler
fDocumentHandler

Document handler.

private static final Boolean[]
FEATURE_DEFAULTS

Feature defaults.

protected final QName
fElementQName

Element QName.

protected final XMLDocumentFragmentScannerImpl.ElementStack
fElementStack

Element stack.

protected int[]
fEntityStack

Entity stack.

protected ExternalSubsetResolver
fExternalSubsetResolver

External subset resolver.

protected boolean
fHasExternalDTD

has external dtd

protected boolean
fInScanContent

SubScanner state: inside scanContent method.

protected boolean
fIsEntityDeclaredVC

True if [Entity Declared] is a VC; false if it is a WFC.

protected int
fMarkupDepth

Markup depth.

protected boolean
fNotifyBuiltInRefs

Notify built-in references.

private final QName
fQName

Another QName.

private boolean
fSawSpace

Saw spaces after element name or between attributes.

protected int
fScannerState

Scanner state.

private final char[]
fSingleChar

Single character array.

protected boolean
fStandalone

Standalone.

private final XMLStringBuffer
private final XMLStringBuffer
private final String[]
fStrings

Array of 3 strings.

private Augmentations
fTempAugmentations

Reusable Augmentations.

protected final XMLString
fTempString

String.

protected final XMLString
fTempString2

String.

protected static final String
NAMESPACES

Hides org.apache.xerces.impl.XMLScanner.NAMESPACES.

Feature identifier: namespaces.
protected static final String
NOTIFY_BUILTIN_REFS

Feature identifier: notify built-in refereces.

private static final Object[]
PROPERTY_DEFAULTS

Property defaults.

private static final String[]
RECOGNIZED_FEATURES

Recognized features.

private static final String[]
RECOGNIZED_PROPERTIES

Recognized properties.

protected static final int
SCANNER_STATE_CDATA

Scanner state: CDATA section.

protected static final int
SCANNER_STATE_COMMENT

Scanner state: comment.

protected static final int
SCANNER_STATE_CONTENT

Scanner state: content.

protected static final int
SCANNER_STATE_DOCTYPE

Scanner state: DOCTYPE.

protected static final int
SCANNER_STATE_END_OF_INPUT

Scanner state: end of input.

protected static final int
SCANNER_STATE_PI

Scanner state: processing instruction.

protected static final int
SCANNER_STATE_REFERENCE

Scanner state: reference.

protected static final int
SCANNER_STATE_ROOT_ELEMENT

Scanner state: root element.

protected static final int
SCANNER_STATE_START_OF_MARKUP

Scanner state: start of markup.

protected static final int
SCANNER_STATE_TERMINATED

Scanner state: terminated.

protected static final int
SCANNER_STATE_TEXT_DECL

Scanner state: Text declaration.

Inherited from org.apache.xerces.impl.XMLScanner:
DEBUG_ATTR_NORMALIZATIONENTITY_MANAGERERROR_REPORTERfAmpSymbolfAposSymbolfCharRefLiteralfEncodingSymbolfEntityDepthfEntityManagerfEntityScannerfErrorReporterfGtSymbolfLtSymbolfNamespacesfNotifyCharRefsfParserSettingsfQuotSymbolfReportEntityfResourceIdentifierfScanningAttributefStandaloneSymbolfSymbolTablefValidationfVersionSymbolNOTIFY_CHAR_REFSPARSER_SETTINGSSYMBOL_TABLEVALIDATION

Constructor Summary

AccessConstructor and Description
public
XMLDocumentFragmentScannerImpl()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
protected XMLDocumentFragmentScannerImpl.Dispatcher
createContentDispatcher()

Creates a content dispatcher.

public void
endEntity(String
The name of the entity.
name
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.impl.XMLScanner.endEntity.

Implements org.apache.xerces.impl.XMLEntityHandler.endEntity.

This method notifies the end of an entity.
public String
getDispatcherName(XMLDocumentFragmentScannerImpl.Dispatcher dispatcher)

Returns the dispatcher name.

public XMLDocumentHandler
public Boolean
getFeatureDefault(String
The feature identifier.
featureId
)

Implements org.apache.xerces.xni.parser.XMLComponent.getFeatureDefault.

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

Implements org.apache.xerces.xni.parser.XMLComponent.getPropertyDefault.

Returns the default state for a property, or null if this component does not want to report a default value for this property.
public String[]
getRecognizedFeatures()

Implements org.apache.xerces.xni.parser.XMLComponent.getRecognizedFeatures.

Returns a list of feature identifiers that are recognized by this component.
public String[]
getRecognizedProperties()

Implements org.apache.xerces.xni.parser.XMLComponent.getRecognizedProperties.

Returns a list of property identifiers that are recognized by this component.
protected String
getScannerStateName(int state)

Returns the scanner state name.

private void
handleCharacter(char c, String
built-in name
entity
)

Calls document handler with a single character resulting from built-in entity resolution.

protected int

Returns:

The element depth.
handleEndElement
(QName
The element.
element
,
boolean isEmpty)

Handles the end element.

public void
reset(XMLComponentManager
The component manager.
componentManager
)

Overrides org.apache.xerces.impl.XMLScanner.reset.

Implements org.apache.xerces.xni.parser.XMLComponent.reset.

Resets the component.
protected void
scanAttribute(XMLAttributes
The attributes list for the scanned attribute.
attributes
)

Scans an attribute.

protected boolean

Returns:

True if CDATA is completely scanned.
scanCDATASection
(boolean
True if the CDATA section is to be scanned completely.
complete
)

Scans a CDATA section.

protected void
scanCharReference()

Scans a character reference.

protected void
scanComment()

Scans a comment.

protected int

Returns:

Returns the next character on the stream.
scanContent
()

Scans element content.

public boolean

Returns:

True if there is more to scan, false otherwise.
scanDocument
(boolean
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.
complete
)

Implements org.apache.xerces.xni.parser.XMLDocumentScanner.scanDocument.

Scans a document.
protected int

Returns:

The element depth.
scanEndElement
()

Scans an end element.

protected void
scanEntityReference()

Scans an entity reference.

protected void
scanPIData(String
The PI target
target
,
XMLString
The string to fill in with the data
data
)

Overrides org.apache.xerces.impl.XMLScanner.scanPIData.

Scans a processing data.
protected boolean

Returns:

True if element is empty. (i.e. It matches production [44].
scanStartElement
()

Scans a start element.

protected boolean

Returns:

True if element is empty.
scanStartElementAfterName
()

Scans the remainder of a start or empty tag after the element name.

protected void
scanStartElementName()

Scans the name of an element in a start or empty tag.

protected void
scanXMLDeclOrTextDecl(boolean
True if a text declaration is to be scanned instead of an XML declaration.
scanningTextDecl
)

Scans an XML or text declaration.

protected final void
setDispatcher(XMLDocumentFragmentScannerImpl.Dispatcher
The new dispatcher.
dispatcher
)

Sets the dispatcher.

public void
public void
setFeature(String
The feature identifier.
featureId
,
boolean
The state of the feature.
state
)

Overrides org.apache.xerces.impl.XMLScanner.setFeature.

Implements org.apache.xerces.xni.parser.XMLComponent.setFeature.

Sets the state of a feature.
public void
setInputSource(XMLInputSource
The input source.
inputSource
)

Implements org.apache.xerces.xni.parser.XMLDocumentScanner.setInputSource.

Sets the input source.
public void
setProperty(String
The property identifier.
propertyId
,
Object
The value of the property.
value
)

Overrides org.apache.xerces.impl.XMLScanner.setProperty.

Implements org.apache.xerces.xni.parser.XMLComponent.setProperty.

Sets the value of a property.
protected final void
setScannerState(int
The new scanner state.
state
)

Sets the scanner state.

public void
startEntity(String
The name of the entity.
name
,
XMLResourceIdentifier
The resource identifier.
identifier
,
String
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).
encoding
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.impl.XMLScanner.startEntity.

Implements org.apache.xerces.impl.XMLEntityHandler.startEntity.

This method notifies of the start of an entity.
Inherited from org.apache.xerces.impl.XMLScanner:
getFeaturegetVersionNotSupportedKeyisInvalidisInvalidLiteralisUnchangedByNormalizationisValidNameCharisValidNameStartCharisValidNameStartHighSurrogateisValidNCNamenormalizeWhitespacenormalizeWhitespacereportFatalErrorresetscanAttributeValuescanCharReferenceValuescanCommentscanExternalIDscanPIscanPseudoAttributescanPubidLiteralscanSurrogatesscanXMLDeclOrTextDeclversionSupported

Field Detail

DEBUG_CONTENT_SCANNINGback to summary
protected static final boolean DEBUG_CONTENT_SCANNING

Debug content dispatcher scanning.

DEBUG_DISPATCHERback to summary
private static final boolean DEBUG_DISPATCHER

Debug dispatcher.

DEBUG_SCANNER_STATEback to summary
private static final boolean DEBUG_SCANNER_STATE

Debug scanner state.

ENTITY_RESOLVERback to summary
protected static final String ENTITY_RESOLVER

Property identifier: entity resolver.

fAttributeQNameback to summary
protected final QName fAttributeQName

Attribute QName.

fAttributesback to summary
protected final XMLAttributesImpl fAttributes

Element attributes.

fContentDispatcherback to summary
protected final XMLDocumentFragmentScannerImpl.Dispatcher fContentDispatcher

Content dispatcher.

fCurrentElementback to summary
protected QName fCurrentElement

Current element.

fDispatcherback to summary
protected XMLDocumentFragmentScannerImpl.Dispatcher fDispatcher

Active dispatcher.

fDocumentHandlerback to summary
protected XMLDocumentHandler fDocumentHandler

Document handler.

FEATURE_DEFAULTSback to summary
private static final Boolean[] FEATURE_DEFAULTS

Feature defaults.

fElementQNameback to summary
protected final QName fElementQName

Element QName.

fElementStackback to summary
protected final XMLDocumentFragmentScannerImpl.ElementStack fElementStack

Element stack.

fEntityStackback to summary
protected int[] fEntityStack

Entity stack.

fExternalSubsetResolverback to summary
protected ExternalSubsetResolver fExternalSubsetResolver

External subset resolver.

fHasExternalDTDback to summary
protected boolean fHasExternalDTD

has external dtd

fInScanContentback to summary
protected boolean fInScanContent

SubScanner state: inside scanContent method.

fIsEntityDeclaredVCback to summary
protected boolean fIsEntityDeclaredVC

True if [Entity Declared] is a VC; false if it is a WFC.

fMarkupDepthback to summary
protected int fMarkupDepth

Markup depth.

fNotifyBuiltInRefsback to summary
protected boolean fNotifyBuiltInRefs

Notify built-in references.

fQNameback to summary
private final QName fQName

Another QName.

fSawSpaceback to summary
private boolean fSawSpace

Saw spaces after element name or between attributes. This is reserved for the case where scanning of a start element spans several methods, as is the case when scanning the start of a root element where a DTD external subset may be read after scanning the element name.

fScannerStateback to summary
protected int fScannerState

Scanner state.

fSingleCharback to summary
private final char[] fSingleChar

Single character array.

fStandaloneback to summary
protected boolean fStandalone

Standalone.

fStringBufferback to summary
private final XMLStringBuffer fStringBuffer

Hides org.apache.xerces.impl.XMLScanner.fStringBuffer.

String buffer.

fStringBuffer2back to summary
private final XMLStringBuffer fStringBuffer2

Hides org.apache.xerces.impl.XMLScanner.fStringBuffer2.

String buffer.

fStringsback to summary
private final String[] fStrings

Array of 3 strings.

fTempAugmentationsback to summary
private Augmentations fTempAugmentations

Reusable Augmentations.

fTempStringback to summary
protected final XMLString fTempString

String.

fTempString2back to summary
protected final XMLString fTempString2

String.

NAMESPACESback to summary
protected static final String NAMESPACES

Hides org.apache.xerces.impl.XMLScanner.NAMESPACES.

Feature identifier: namespaces.

NOTIFY_BUILTIN_REFSback to summary
protected static final String NOTIFY_BUILTIN_REFS

Feature identifier: notify built-in refereces.

PROPERTY_DEFAULTSback to summary
private static final Object[] PROPERTY_DEFAULTS

Property defaults.

RECOGNIZED_FEATURESback to summary
private static final String[] RECOGNIZED_FEATURES

Recognized features.

RECOGNIZED_PROPERTIESback to summary
private static final String[] RECOGNIZED_PROPERTIES

Recognized properties.

SCANNER_STATE_CDATAback to summary
protected static final int SCANNER_STATE_CDATA

Scanner state: CDATA section.

SCANNER_STATE_COMMENTback to summary
protected static final int SCANNER_STATE_COMMENT

Scanner state: comment.

SCANNER_STATE_CONTENTback to summary
protected static final int SCANNER_STATE_CONTENT

Scanner state: content.

SCANNER_STATE_DOCTYPEback to summary
protected static final int SCANNER_STATE_DOCTYPE

Scanner state: DOCTYPE.

SCANNER_STATE_END_OF_INPUTback to summary
protected static final int SCANNER_STATE_END_OF_INPUT

Scanner state: end of input.

SCANNER_STATE_PIback to summary
protected static final int SCANNER_STATE_PI

Scanner state: processing instruction.

SCANNER_STATE_REFERENCEback to summary
protected static final int SCANNER_STATE_REFERENCE

Scanner state: reference.

SCANNER_STATE_ROOT_ELEMENTback to summary
protected static final int SCANNER_STATE_ROOT_ELEMENT

Scanner state: root element.

SCANNER_STATE_START_OF_MARKUPback to summary
protected static final int SCANNER_STATE_START_OF_MARKUP

Scanner state: start of markup.

SCANNER_STATE_TERMINATEDback to summary
protected static final int SCANNER_STATE_TERMINATED

Scanner state: terminated.

SCANNER_STATE_TEXT_DECLback to summary
protected static final int SCANNER_STATE_TEXT_DECL

Scanner state: Text declaration.

Constructor Detail

XMLDocumentFragmentScannerImplback to summary
public XMLDocumentFragmentScannerImpl()

Default constructor.

Method Detail

createContentDispatcherback to summary
protected XMLDocumentFragmentScannerImpl.Dispatcher createContentDispatcher()

Creates a content dispatcher.

endEntityback to summary
public void endEntity(String name, Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.XMLScanner.endEntity.

Implements org.apache.xerces.impl.XMLEntityHandler.endEntity.

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

The name of the entity.

augs:Augmentations

Additional information that may include infoset augmentations

Exceptions
XNIException:
Thrown by handler to signal an error.
getDispatcherNameback to summary
public String getDispatcherName(XMLDocumentFragmentScannerImpl.Dispatcher dispatcher)

Returns the dispatcher name.

getDocumentHandlerback to summary
public XMLDocumentHandler getDocumentHandler()

Implements org.apache.xerces.xni.parser.XMLDocumentSource.getDocumentHandler.

Returns the document handler

getFeatureDefaultback to summary
public Boolean getFeatureDefault(String featureId)

Implements org.apache.xerces.xni.parser.XMLComponent.getFeatureDefault.

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

The feature identifier.

Since
Xerces 2.2.0
getPropertyDefaultback to summary
public Object getPropertyDefault(String propertyId)

Implements org.apache.xerces.xni.parser.XMLComponent.getPropertyDefault.

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

The property identifier.

Since
Xerces 2.2.0
getRecognizedFeaturesback to summary
public String[] getRecognizedFeatures()

Implements org.apache.xerces.xni.parser.XMLComponent.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.

getRecognizedPropertiesback to summary
public String[] getRecognizedProperties()

Implements org.apache.xerces.xni.parser.XMLComponent.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.

getScannerStateNameback to summary
protected String getScannerStateName(int state)

Returns the scanner state name.

handleCharacterback to summary
private void handleCharacter(char c, String entity) throws XNIException

Calls document handler with a single character resulting from built-in entity resolution.

Parameters
entity:String

built-in name

handleEndElementback to summary
protected int handleEndElement(QName element, boolean isEmpty) throws XNIException

Handles the end element. This method will make sure that the end element name matches the current element and notify the handler about the end of the element and the end of any relevent prefix mappings.

Note

This method uses the fQName variable. The contents of this variable will be destroyed.

Parameters
element:QName

The element.

Returns:int

The element depth.

Exceptions
XNIException:
Thrown if the handler throws a SAX exception upon notification.
resetback to summary
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException

Overrides org.apache.xerces.impl.XMLScanner.reset.

Implements org.apache.xerces.xni.parser.XMLComponent.reset.

Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.

Parameters
componentManager:XMLComponentManager

The component manager.

Exceptions
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.
scanAttributeback to summary
protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException

Scans an attribute.

[41] Attribute ::= Name Eq AttValue

Note

This method assumes that the next character on the stream is the first character of the attribute name.

Note

This method uses the fAttributeQName and fQName variables. The contents of these variables will be destroyed.

Parameters
attributes:XMLAttributes

The attributes list for the scanned attribute.

scanCDATASectionback to summary
protected boolean scanCDATASection(boolean complete) throws IOException, XNIException

Scans a CDATA section.

Note

This method uses the fTempString and fStringBuffer variables.

Parameters
complete:boolean

True if the CDATA section is to be scanned completely.

Returns:boolean

True if CDATA is completely scanned.

scanCharReferenceback to summary
protected void scanCharReference() throws IOException, XNIException

Scans a character reference.

[66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
scanCommentback to summary
protected void scanComment() throws IOException, XNIException

Scans a comment.

[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'

Note

Called after scanning past '<!--'

scanContentback to summary
protected int scanContent() throws IOException, XNIException

Scans element content.

Returns:int

Returns the next character on the stream.

scanDocumentback to summary
public boolean scanDocument(boolean complete) throws IOException, XNIException

Implements org.apache.xerces.xni.parser.XMLDocumentScanner.scanDocument.

Scans a document.

Parameters
complete:boolean

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

True if there is more to scan, false otherwise.

scanEndElementback to summary
protected int scanEndElement() throws IOException, XNIException

Scans an end element.

[42] ETag ::= '</' Name S? '>'

Note

This method uses the fElementQName variable. The contents of this variable will be destroyed. The caller should copy the needed information out of this variable before calling this method.

Returns:int

The element depth.

scanEntityReferenceback to summary
protected void scanEntityReference() throws IOException, XNIException

Scans an entity reference.

Exceptions
IOException:
Thrown if i/o error occurs.
XNIException:
Thrown if handler throws exception upon notification.
scanPIDataback to summary
protected void scanPIData(String target, XMLString data) throws IOException, XNIException

Overrides org.apache.xerces.impl.XMLScanner.scanPIData.

Scans a processing data. This is needed to handle the situation where a document starts with a processing instruction whose target name starts with "xml". (e.g. xmlfoo)

Parameters
target:String

The PI target

data:XMLString

The string to fill in with the data

scanStartElementback to summary
protected boolean scanStartElement() throws IOException, XNIException

Scans a start element. This method will handle the binding of namespace information and notifying the handler of the start of the element.

[44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
[40] STag ::= '<' Name (S Attribute)* S? '>'

Note

This method assumes that the leading '<' character has been consumed.

Note

This method uses the fElementQName and fAttributes variables. The contents of these variables will be destroyed. The caller should copy important information out of these variables before calling this method.

Returns:boolean

True if element is empty. (i.e. It matches production [44].

scanStartElementAfterNameback to summary
protected boolean scanStartElementAfterName() throws IOException, XNIException

Scans the remainder of a start or empty tag after the element name.

Returns:boolean

True if element is empty.

See Also
scanStartElement
scanStartElementNameback to summary
protected void scanStartElementName() throws IOException, XNIException

Scans the name of an element in a start or empty tag.

See Also
scanStartElement()
scanXMLDeclOrTextDeclback to summary
protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl) throws IOException, XNIException

Scans an XML or text declaration.

[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
[24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
[80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' |  "'" EncName "'" )
[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
[32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'")
                | ('"' ('yes' | 'no') '"'))

[77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
Parameters
scanningTextDecl:boolean

True if a text declaration is to be scanned instead of an XML declaration.

setDispatcherback to summary
protected final void setDispatcher(XMLDocumentFragmentScannerImpl.Dispatcher dispatcher)

Sets the dispatcher.

Parameters
dispatcher:XMLDocumentFragmentScannerImpl.Dispatcher

The new dispatcher.

setDocumentHandlerback to summary
public void setDocumentHandler(XMLDocumentHandler documentHandler)

Implements org.apache.xerces.xni.parser.XMLDocumentSource.setDocumentHandler.

setDocumentHandler

setFeatureback to summary
public void setFeature(String featureId, boolean state) throws XMLConfigurationException

Overrides org.apache.xerces.impl.XMLScanner.setFeature.

Implements org.apache.xerces.xni.parser.XMLComponent.setFeature.

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

The feature identifier.

state:boolean

The state of the feature.

Exceptions
XMLConfigurationException:

Doc from org.apache.xerces.xni.parser.XMLComponent.setFeature.

Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

SAXNotRecognizedException:
The component should not throw this exception.
SAXNotSupportedException:
The component should not throw this exception.
setInputSourceback to summary
public void setInputSource(XMLInputSource inputSource) throws IOException

Implements org.apache.xerces.xni.parser.XMLDocumentScanner.setInputSource.

Sets the input source.

Parameters
inputSource:XMLInputSource

The input source.

Exceptions
IOException:
Thrown on i/o error.
setPropertyback to summary
public void setProperty(String propertyId, Object value) throws XMLConfigurationException

Overrides org.apache.xerces.impl.XMLScanner.setProperty.

Implements org.apache.xerces.xni.parser.XMLComponent.setProperty.

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

The property identifier.

value:Object

The value of the property.

Exceptions
XMLConfigurationException:

Doc from org.apache.xerces.xni.parser.XMLComponent.setProperty.

Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

SAXNotRecognizedException:
The component should not throw this exception.
SAXNotSupportedException:
The component should not throw this exception.
setScannerStateback to summary
protected final void setScannerState(int state)

Sets the scanner state.

Parameters
state:int

The new scanner state.

startEntityback to summary
public void startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException

Overrides org.apache.xerces.impl.XMLScanner.startEntity.

Implements org.apache.xerces.impl.XMLEntityHandler.startEntity.

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

The name of the entity.

identifier:XMLResourceIdentifier

The resource identifier.

encoding:String

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

Additional information that may include infoset augmentations

Exceptions
XNIException:
Thrown by handler to signal an error.
org.apache.xerces.impl back to summary

protected Interface XMLDocumentFragmentScannerImpl.Dispatcher

Known Direct Implementers
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.FragmentContentDispatcher, org.apache.xerces.impl.XMLDocumentScannerImpl.XMLDeclDispatcher, org.apache.xerces.impl.XMLDocumentScannerImpl.PrologDispatcher, org.apache.xerces.impl.XMLDocumentScannerImpl.DTDDispatcher, org.apache.xerces.impl.XMLDocumentScannerImpl.TrailingMiscDispatcher

This interface defines an XML "event" dispatching model. Classes that implement this interface are responsible for scanning parts of the XML document and dispatching callbacks.
Author
Glenn Marcy, IBM

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True if there is more to dispatch either from this or a another dispatcher.
dispatch
(boolean
True if this dispatcher is intended to scan and dispatch as much as possible.
complete
)

Dispatch an XML "event".

Method Detail

dispatchback to summary
public boolean dispatch(boolean complete) throws IOException, XNIException

Dispatch an XML "event".

Parameters
complete:boolean

True if this dispatcher is intended to scan and dispatch as much as possible.

Returns:boolean

True if there is more to dispatch either from this or a another dispatcher.

Exceptions
IOException:
Thrown on i/o error.
XNIException:
Thrown on parse error.
org.apache.xerces.impl back to summary

protected Class XMLDocumentFragmentScannerImpl.ElementStack

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.ElementStack

Element stack. This stack operates without synchronization, error checking, and it re-uses objects instead of throwing popped items away.
Author
Andy Clark, IBM

Field Summary

Modifier and TypeField and Description
protected QName[]
fElements

The stack data.

protected int
fSize

The size of the stack.

Constructor Summary

AccessConstructor and Description
public
ElementStack()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clears the stack without throwing away existing QName objects.

public void
popElement(QName element)

Pops an element off of the stack by setting the values of the specified QName.

public QName

Returns:

Returns the actual QName object that stores the
pushElement
(QName
The element to push onto the stack.
element
)

Pushes an element on the stack.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fElementsback to summary
protected QName[] fElements

The stack data.

fSizeback to summary
protected int fSize

The size of the stack.

Constructor Detail

ElementStackback to summary
public ElementStack()

Default constructor.

Method Detail

clearback to summary
public void clear()

Clears the stack without throwing away existing QName objects.

popElementback to summary
public void popElement(QName element)

Pops an element off of the stack by setting the values of the specified QName.

Note

The object returned is not orphaned to the caller. Therefore, the caller should consider the object to be read-only.

pushElementback to summary
public QName pushElement(QName element)

Pushes an element on the stack.

Note

The QName values are copied into the stack. In other words, the caller does not orphan the element to the stack. Also, the QName object returned is not orphaned to the caller. It should be considered read-only.

Parameters
element:QName

The element to push onto the stack.

Returns:QName

Returns the actual QName object that stores the

org.apache.xerces.impl back to summary

protected Class XMLDocumentFragmentScannerImpl.FragmentContentDispatcher

extends Object
implements Dispatcher
Class Inheritance
  • java.lang.Object
  • org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.FragmentContentDispatcher
All Implemented Interfaces
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.Dispatcher
Known Direct Subclasses
org.apache.xerces.impl.XMLDocumentScannerImpl.ContentDispatcher

Dispatcher to handle content scanning.
Authors
Andy Clark, IBM, Eric Ye, IBM

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True if there is more to dispatch either from this or a another dispatcher.
dispatch
(boolean
True if this dispatcher is intended to scan and dispatch as much as possible.
complete
)

Implements org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.Dispatcher.dispatch.

Dispatch an XML "event".
protected boolean

Returns:

True if the caller should stop and return true which allows the scanner to switch to a new scanning dispatcher. A return value of false indicates that the content dispatcher should continue as normal.
elementDepthIsZeroHook
()

Element depth iz zero.

protected void
endOfFileHook(EOFException e)

End of file hook.

protected boolean

Returns:

True if the "DOCTYPE" was scanned; false if "DOCTYPE" was not scanned.
scanForDoctypeHook
()

Scan for DOCTYPE hook.

protected boolean

Returns:

True if the caller should stop and return true which allows the scanner to switch to a new scanning dispatcher. A return value of false indicates that the content dispatcher should continue as normal.
scanRootElementHook
()

Scan for root element hook.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FragmentContentDispatcherback to summary
protected FragmentContentDispatcher()

Method Detail

dispatchback to summary
public boolean dispatch(boolean complete) throws IOException, XNIException

Implements org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.Dispatcher.dispatch.

Dispatch an XML "event".

Parameters
complete:boolean

True if this dispatcher is intended to scan and dispatch as much as possible.

Returns:boolean

True if there is more to dispatch either from this or a another dispatcher.

Exceptions
IOException:
Thrown on i/o error.
XNIException:
Thrown on parse error.
elementDepthIsZeroHookback to summary
protected boolean elementDepthIsZeroHook() throws IOException, XNIException

Element depth iz zero. This methos is a hook for subclasses to add code to handle when the element depth hits zero. When scanning a document fragment, an element depth of zero is normal. However, when scanning a full XML document, the scanner must handle the trailing miscellanous section of the document after the end of the document's root element.

Returns:boolean

True if the caller should stop and return true which allows the scanner to switch to a new scanning dispatcher. A return value of false indicates that the content dispatcher should continue as normal.

endOfFileHookback to summary
protected void endOfFileHook(EOFException e) throws IOException, XNIException

End of file hook. This method is a hook for subclasses to add code that handles the end of file. The end of file in a document fragment is OK if the markup depth is zero. However, when scanning a full XML document, an end of file is always premature.

scanForDoctypeHookback to summary
protected boolean scanForDoctypeHook() throws IOException, XNIException

Scan for DOCTYPE hook. This method is a hook for subclasses to add code to handle scanning for a the "DOCTYPE" string after the string "

Returns:boolean

True if the "DOCTYPE" was scanned; false if "DOCTYPE" was not scanned.

scanRootElementHookback to summary
protected boolean scanRootElementHook() throws IOException, XNIException

Scan for root element hook. This method is a hook for subclasses to add code that handles scanning for the root element. When scanning a document fragment, there is no "root" element. However, when scanning a full XML document, the scanner must handle the root element specially.

Returns:boolean

True if the caller should stop and return true which allows the scanner to switch to a new scanning dispatcher. A return value of false indicates that the content dispatcher should continue as normal.