APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.org.apache.xerces.internal.impl

public Class XMLDocumentFragmentScannerImpl

extends XMLScanner
implements XMLDocumentScanner, XMLComponent, XMLEntityHandler, XMLBufferListener
Class Inheritance
All Implemented Interfaces
com.sun.xml.internal.stream.XMLBufferListener, com.sun.org.apache.xerces.internal.impl.XMLEntityHandler, com.sun.org.apache.xerces.internal.xni.parser.XMLComponent, com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner, com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource
Known Direct Subclasses
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl
Imports
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException, com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter, com.sun.org.apache.xerces.internal.util.AugmentationsImpl, .XMLAttributesIteratorImpl, .XMLChar, .XMLStringBuffer, .XMLSymbols, com.sun.org.apache.xerces.internal.xni.Augmentations, .QName, .XMLAttributes, .XMLDocumentHandler, .XMLResourceIdentifier, .XMLString, .XNIException, com.sun.org.apache.xerces.internal.xni.parser.XMLComponent, .XMLComponentManager, .XMLConfigurationException, .XMLDocumentScanner, .XMLInputSource, com.sun.xml.internal.stream.XMLBufferListener, .XMLEntityStorage, com.sun.xml.internal.stream.dtd.DTDGrammarUtil, java.io.CharConversionException, .EOFException, .IOException, javax.xml.XMLConstants, javax.xml.stream.XMLInputFactory, .XMLStreamConstants, javax.xml.stream.events.XMLEvent, jdk.xml.internal.JdkConstants, .JdkXmlUtils, .SecuritySupport, .XMLSecurityManager, .XMLSecurityManager.Limit, .XMLSecurityPropertyManager

This class is responsible for scanning the structure and content of document fragments. This class has been modified as per the new design which is more suited to efficiently build pull parser. Lot of improvements have been done and the code has been added to support stax functionality/features.
Authors
Neeraj Bajaj SUN Microsystems, K.Venugopal SUN Microsystems, Glenn Marcy, IBM, Andy Clark, IBM, Arnaud Le Hors, IBM, Eric Ye, IBM, Sunitha Reddy, SUN Microsystems

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static interface
XMLDocumentFragmentScannerImpl.Driver

Drives the parser to the next state/event on the input.

protected static class
protected class
protected class
protected class
XMLDocumentFragmentScannerImpl.FragmentContentDriver

Driver to handle content scanning.

Field Summary

Modifier and TypeField and Description
protected boolean
builtInRefCharacterHandled

Built-in reference character event

private static final char[]
protected static final String
CREATE_ENTITY_REF_NODES

Feature id: create entity ref nodes.

protected static final boolean
DEBUG

Debug driver next

private static final boolean
DEBUG_DISPATCHER

Debug driver.

private static final boolean
DEBUG_SCANNER_STATE

Debug scanner state.

pack-priv static final boolean
protected static final boolean
DEBUG_START_END_ELEMENT

Debug content driver scanning.

protected DTDGrammarUtil
pack-priv static final short
protected static final String
ENTITY_RESOLVER

Property identifier: entity resolver.

pack-priv static final String
EXTERNAL_ACCESS_DEFAULT

access external dtd: file protocol For DOM/SAX, the secure feature is set to true by default

protected String
fAccessExternalDTD

comma-delimited list of protocols that are allowed for the purpose of accessing external dtd or entity references

protected boolean
protected boolean
protected QName
fAttributeQName

Attribute QName.

protected XMLAttributesIteratorImpl
fAttributes

CHANGED: Using XMLAttributesIteratorImpl instead of XMLAttributesImpl.

protected String
protected boolean
protected boolean
private int
fChunkSize

CDATA chunk size limit

protected XMLStringBuffer
fContentBuffer

Making the buffer accessible to derived class -- stores PI data

protected XMLDocumentFragmentScannerImpl.Driver
fContentDriver

Content driver.

protected boolean
fCreateEntityRefNodes

Create entity reference nodes.

protected QName
fCurrentElement

Current element.

private String
protected String
protected boolean
fDisallowDoctype

Xerces Feature: Disallow doctype declaration.

protected XMLDocumentHandler
fDocumentHandler

Document handler.

protected XMLDocumentFragmentScannerImpl.Driver
fDriver

Active driver.

protected String
private static final Boolean[]
FEATURE_DEFAULTS

Feature defaults.

pack-priv String[]
protected int
pack-priv short
protected QName
fElementQName

Element QName.

protected String
protected XMLDocumentFragmentScannerImpl.ElementStack
fElementStack

Element stack.

protected XMLDocumentFragmentScannerImpl.ElementStack2
protected boolean
protected int[]
fEntityStack

Entity stack.

protected XMLEntityStorage
protected ExternalSubsetResolver
fExternalSubsetResolver

External subset resolver.

protected boolean
fHasExternalDTD

has external dtd

protected boolean
protected boolean
fInScanContent

SubScanner state: inside scanContent method.

protected boolean
pack-priv short
protected boolean
protected boolean
protected boolean
protected int
fMarkupDepth

Markup depth.

protected boolean
fNotifyBuiltInRefs

Notify built-in references.

protected boolean
protected XMLString
protected String
fPITarget

Document system identifier.

pack-priv short[][]
protected boolean
protected boolean
protected boolean
protected int
protected int
fScannerState

Scanner state.

protected boolean
protected boolean
private final char[]
fSingleChar

Single character array.

protected boolean
protected boolean
protected boolean
fStandaloneSet

Standalone.

protected boolean
fStrictURI

standard uri conformant (strict uri).

protected XMLStringBuffer
fStringBuffer

Hides com.sun.org.apache.xerces.internal.impl.XMLScanner.fStringBuffer.

Making the buffer accessible to derived class -- String buffer.
protected XMLStringBuffer
fStringBuffer2

Hides com.sun.org.apache.xerces.internal.impl.XMLScanner.fStringBuffer2.

Making the buffer accessible to derived class -- String buffer.
private final String[]
fStrings

Array of 3 strings.

protected boolean
protected boolean
private Augmentations
fTempAugmentations

Reusable Augmentations.

protected XMLString
fTempString

String.

protected XMLString
fTempString2

String.

protected boolean
protected boolean
fUseCatalog

Properties to determine whether to use a user-specified Catalog: Feature USE_CATALOG, Resolve and Catalog File

protected String
protected int
pack-priv static final short
pack-priv static final short
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
protected static final int
protected static final int
protected static final int
SCANNER_STATE_CDATA

Scanner state: CDATA section.

protected static final int
protected static final int
SCANNER_STATE_CHARACTER_DATA

Scanner state: Text declaration.

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

protected static final int
SCANNER_STATE_XML_DECL

Scanner state: XML Declaration

protected static final String
STANDARD_URI_CONFORMANT

Feature identifier: standard uri conformant

private static final String
XML_SECURITY_PROPERTY_MANAGER

Property identifier: Security property manager.

pack-priv static final char[]
Inherited from com.sun.org.apache.xerces.internal.impl.XMLScanner:
attributeValueCacheDEBUG_ATTR_NORMALIZATIONENTITY_MANAGERERROR_REPORTERfAmpSymbolfAposSymbolfAttributeCacheInitDonefAttributeCacheUsedCountfCharRefLiteralfEncodingSymbolfEntityDepthfEntityManagerfEntityScannerfErrorReporterfEventfGtSymbolfLimitAnalyzerfLtSymbolfNamespacesfNotifyCharRefsfParserSettingsfPropertyManagerfQuotSymbolfReportEntityfResourceIdentifierfScanningAttributefSecurityManagerfStandaloneSymbolfStringBufferIndexfSymbolTablefValidationfVersionSymbolinitialCacheCountNAMESPACESNOTIFY_CHAR_REFSPARSER_SETTINGSstringBufferCacheSYMBOL_TABLEVALIDATION

Constructor Summary

AccessConstructor and Description
public
XMLDocumentFragmentScannerImpl()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addElement(String rawname)

private void
bufferContent()

Since 'TempString' shares the buffer (a char array) with the CurrentEntity, when the cursor position reaches the end, that is, before the buffer is being loaded with new data, the content in the TempString needs to be copied into the ContentBuffer.

pack-priv boolean
canStore(short depth, short column)

pack-priv String

Returns:

the name of the protocol if rejected, null otherwise
checkAccess
(String
the Id of the URI
systemId
,
String
a list of allowed protocols separated by comma
allowedProtocols
)

Check the protocol used in the systemId against allowed protocols

pack-priv void
checkDepth(String
name of the current element
elementName
)

Check if the depth exceeds the maxElementDepth limit

protected XMLDocumentFragmentScannerImpl.Driver
createContentDriver()

Creates a content Driver.

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

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.endEntity.

Implements com.sun.org.apache.xerces.internal.impl.XMLEntityHandler.endEntity.

This method notifies the end of an entity.

public XMLAttributesIteratorImpl
getAttributeIterator()

return the attribute iterator implementation

public XMLString
public String
public XMLDocumentHandler
public String
getDriverName(XMLDocumentFragmentScannerImpl.Driver driver)

Returns the driver name.

pack-priv short
getElementPointer(short depth, short column)

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

Implements com.sun.org.apache.xerces.internal.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 XMLStringBuffer
public String
public Object
getPropertyDefault(String
The property identifier.
propertyId
)

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

Returns a list of feature identifiers that are recognized by this component.

public String[]
getRecognizedProperties()

Implements com.sun.org.apache.xerces.internal.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.

protected XMLString

Returns:

XMLString XMLString used to store an attribute value.
getString
()

this function gets an XMLString (which is used to store the attribute value) from the special pool maintained for attributes.

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

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

public boolean
public boolean
isStandAlone()

return if the doucment is standalone

public int

Returns:

int
next
()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner.next.

return the next state on the input

pack-priv static void
pr(String str)

public void
refresh()

Implements com.sun.xml.internal.stream.XMLBufferListener.refresh.

Implements XMLBufferListener interface.

public void
refresh(int refreshPosition)

Implements com.sun.xml.internal.stream.XMLBufferListener.refresh.

receives callbacks from XMLEntityReader when buffer is being changed.

public void
public void
pack-priv void
pack-priv void
resetPointer(short depth, short column)

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

Scans an attribute name value pair.

protected boolean

Returns:

True if CDATA is completely scanned.
scanCDATASection
(XMLStringBuffer contentBuffer, 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
(XMLStringBuffer content)

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 com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner.scanDocument.

Scans a document.

protected int

Returns:

The element depth.
scanEndElement
()

Scans an end element.

protected void

Returns:

returns true if the new entity is started. If it was built-in entity 'false' is returned.
scanEntityReference
(XMLStringBuffer content)

Scans an entity reference.

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

Overrides com.sun.org.apache.xerces.internal.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 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 boolean
seekCloseOfStartTag()

Looks for the close of start tag, i.e. if it finds '>' or '/>' Characters are consumed.

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

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.setFeature.

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.setFeature.

Sets the state of a feature.

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

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.setProperty.

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.setProperty.

Sets the value of a property.

protected final void
setScannerState(int
The new scanner state.
state
)

Sets the scanner state.

protected boolean
pack-priv boolean
skipElement(short column)

pack-priv boolean
pack-priv boolean
public boolean
standaloneSet()

return if standalone is set

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 com.sun.org.apache.xerces.internal.impl.XMLScanner.startEntity.

Implements com.sun.org.apache.xerces.internal.impl.XMLEntityHandler.startEntity.

This method notifies of the start of an entity.

pack-priv short
storePointerForADepth(short elementPointer)

Inherited from com.sun.org.apache.xerces.internal.impl.XMLScanner:
checkEntityLimitcheckEntityLimitgetFeaturegetStringBufferisInvalidisInvalidLiteralisValidNameCharisValidNameStartCharisValidNameStartHighSurrogateisValidNCNamenormalizeWhitespacereportFatalErrorresetresolveCharacterscanAttributeValuescanCharReferenceValuescanCommentscanExternalIDscanPIscanPseudoAttributescanPubidLiteralscanSurrogatesscanXMLDeclOrTextDeclsetPropertyManagerversionSupported