public class XMLDocumentFragmentScannerImpl extends XMLScanner implements XMLDocumentScanner, XMLComponent, XMLEntityHandler, XMLBufferListener
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
XMLDocumentFragmentScannerImpl.Driver
Drives the parser to the next state/event on the input.
|
protected static class |
XMLDocumentFragmentScannerImpl.Element |
protected class |
XMLDocumentFragmentScannerImpl.ElementStack
Element stack.
|
protected class |
XMLDocumentFragmentScannerImpl.ElementStack2
Element stack.
|
protected class |
XMLDocumentFragmentScannerImpl.FragmentContentDriver
Driver to handle content scanning.
|
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
DEBUG
Debug driver next
|
protected static boolean |
DEBUG_COALESCE |
protected static boolean |
DEBUG_NEXT
Debug driver next
|
protected static boolean |
DEBUG_START_END_ELEMENT
Debug content driver scanning.
|
protected DTDGrammarUtil |
dtdGrammarUtil |
protected static String |
ENTITY_RESOLVER
Property identifier: entity resolver.
|
protected String |
fAccessExternalDTD
comma-delimited list of protocols that are allowed for the purpose
of accessing external dtd or entity references
|
protected boolean |
fAdd |
protected boolean |
fAddDefaultAttr |
protected QName |
fAttributeQName
Attribute QName.
|
protected XMLAttributesIteratorImpl |
fAttributes
CHANGED: Using XMLAttributesIteratorImpl instead of XMLAttributesImpl.
|
protected XMLStringBuffer |
fContentBuffer
Making the buffer accesible to derived class -- stores PI data
|
protected XMLDocumentFragmentScannerImpl.Driver |
fContentDriver
Content driver.
|
protected QName |
fCurrentElement
Current element.
|
protected String |
fDeclaredEncoding |
protected boolean |
fDisallowDoctype
Xerces Feature: Disallow doctype declaration.
|
protected XMLDocumentHandler |
fDocumentHandler
Document handler.
|
protected XMLDocumentFragmentScannerImpl.Driver |
fDriver
Active driver.
|
protected int |
fElementAttributeLimit |
protected QName |
fElementQName
Element QName.
|
protected String |
fElementRawname |
protected XMLDocumentFragmentScannerImpl.ElementStack |
fElementStack
Element stack.
|
protected XMLDocumentFragmentScannerImpl.ElementStack2 |
fElementStack2 |
protected boolean |
fEmptyElement |
protected int[] |
fEntityStack
Entity stack.
|
protected XMLEntityStorage |
fEntityStore
Entity Storage
|
protected ExternalSubsetResolver |
fExternalSubsetResolver
External subset resolver.
|
protected boolean |
fHasExternalDTD
has external dtd
|
protected boolean |
fInScanContent
SubScanner state: inside scanContent method.
|
protected boolean |
fIsCoalesce |
protected boolean |
fLastSectionWasCData |
protected boolean |
fLastSectionWasCharacterData |
protected boolean |
fLastSectionWasEntityReference |
protected int |
fMarkupDepth
Markup depth.
|
protected boolean |
fNotifyBuiltInRefs
Notify built-in references.
|
protected boolean |
foundBuiltInRefs |
protected XMLString |
fPIData |
protected String |
fPITarget
Document system identifier.
|
protected boolean |
fReadingAttributes |
protected boolean |
fReplaceEntityReferences |
protected boolean |
fReportCdataEvent |
protected int |
fScannerLastState |
protected int |
fScannerState
Scanner state.
|
protected boolean |
fScanToEnd |
protected boolean |
fShouldSkip |
protected boolean |
fSkip |
protected boolean |
fStandalone |
protected boolean |
fStandaloneSet
Standalone.
|
protected boolean |
fStrictURI
standard uri conformant (strict uri).
|
protected XMLStringBuffer |
fStringBuffer
Making the buffer accesible to derived class -- String buffer.
|
protected XMLStringBuffer |
fStringBuffer2
Making the buffer accesible to derived class -- String buffer.
|
protected boolean |
fSupportDTD |
protected boolean |
fSupportExternalEntities |
protected XMLString |
fTempString
String.
|
protected XMLString |
fTempString2
String.
|
protected boolean |
fUsebuffer |
protected String |
fVersion |
protected static String |
NOTIFY_BUILTIN_REFS
Feature identifier: notify built-in refereces.
|
protected static int |
SCANNER_STATE_ATTRIBUTE |
protected static int |
SCANNER_STATE_ATTRIBUTE_VALUE |
protected static int |
SCANNER_STATE_BUILT_IN_REFS |
protected static int |
SCANNER_STATE_CDATA
Scanner state: CDATA section.
|
protected static int |
SCANNER_STATE_CHAR_REFERENCE |
protected static int |
SCANNER_STATE_CHARACTER_DATA
Scanner state: Text declaration.
|
protected static int |
SCANNER_STATE_COMMENT
Scanner state: comment.
|
protected static int |
SCANNER_STATE_CONTENT
Scanner state: content.
|
protected static int |
SCANNER_STATE_DOCTYPE
Scanner state: DOCTYPE.
|
protected static int |
SCANNER_STATE_END_ELEMENT_TAG |
protected static int |
SCANNER_STATE_END_OF_INPUT
Scanner state: end of input.
|
protected static int |
SCANNER_STATE_PI
Scanner state: processing instruction.
|
protected static int |
SCANNER_STATE_REFERENCE
Scanner state: reference.
|
protected static int |
SCANNER_STATE_ROOT_ELEMENT
Scanner state: root element.
|
protected static int |
SCANNER_STATE_START_ELEMENT_TAG |
protected static int |
SCANNER_STATE_START_OF_MARKUP
Scanner state: start of markup.
|
protected static int |
SCANNER_STATE_TERMINATED
Scanner state: terminated.
|
protected static int |
SCANNER_STATE_TEXT_DECL
Scanner state: Text declaration.
|
protected static int |
SCANNER_STATE_XML_DECL
Scanner state: XML Declaration
|
protected static String |
STANDARD_URI_CONFORMANT
Feature identifier: standard uri conformant
|
attributeValueCache, DEBUG_ATTR_NORMALIZATION, ENTITY_MANAGER, ERROR_REPORTER, fAmpSymbol, fAposSymbol, fAttributeCacheInitDone, fAttributeCacheUsedCount, fCharRefLiteral, fEncodingSymbol, fEntityDepth, fEntityManager, fEntityScanner, fErrorReporter, fEvent, fGtSymbol, fLimitAnalyzer, fLtSymbol, fNamespaces, fNotifyCharRefs, fParserSettings, fPropertyManager, fQuotSymbol, fReportEntity, fResourceIdentifier, fScanningAttribute, fSecurityManager, fStandaloneSymbol, fStringBufferIndex, fSymbolTable, fValidation, fVersionSymbol, NAMESPACES, NOTIFY_CHAR_REFS, PARSER_SETTINGS, stringBufferCache, SYMBOL_TABLE, VALIDATION| Constructor and Description |
|---|
XMLDocumentFragmentScannerImpl()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected XMLDocumentFragmentScannerImpl.Driver |
createContentDriver()
Creates a content Driver.
|
void |
endEntity(String name,
Augmentations augs)
This method notifies the end of an entity.
|
XMLAttributesIteratorImpl |
getAttributeIterator()
return the attribute iterator implementation
|
XMLString |
getCharacterData() |
String |
getComment() |
XMLDocumentHandler |
getDocumentHandler()
Returns the document handler
|
String |
getDriverName(XMLDocumentFragmentScannerImpl.Driver driver)
Returns the driver name.
|
QName |
getElementQName() |
String |
getEntityName() |
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.
|
XMLStringBuffer |
getPIData() |
String |
getPITarget() |
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.
|
protected XMLString |
getString()
this function gets an XMLString (which is used to store the attribute value) from the special pool
maintained for attributes.
|
boolean |
hasAttributes() |
boolean |
isStandAlone()
return if the doucment is standalone
|
int |
next()
return the next state on the input
|
void |
refresh()
Implements XMLBufferListener interface.
|
void |
refresh(int refreshPosition)
receives callbacks from
XMLEntityReader when buffer
is being changed. |
void |
reset(PropertyManager propertyManager) |
void |
reset(XMLComponentManager componentManager)
Resets the component.
|
protected void |
scanAttribute(XMLAttributes attributes)
Scans an attribute name value pair.
|
protected boolean |
scanCDATASection(XMLStringBuffer contentBuffer,
boolean complete)
Scans a CDATA section.
|
protected void |
scanCharReference()
Scans a character reference.
|
protected void |
scanComment()
Scans a comment.
|
protected int |
scanContent(XMLStringBuffer content)
Scans element content.
|
boolean |
scanDocument(boolean complete)
Scans a document.
|
protected int |
scanEndElement()
Scans an end element.
|
protected void |
scanEntityReference(XMLStringBuffer content)
Scans an entity reference.
|
protected void |
scanPIData(String target,
XMLStringBuffer data)
Scans a processing data.
|
protected boolean |
scanStartElement()
Scans a start element.
|
protected void |
scanXMLDeclOrTextDecl(boolean 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.
|
void |
setDocumentHandler(XMLDocumentHandler documentHandler)
setDocumentHandler
|
protected void |
setDriver(XMLDocumentFragmentScannerImpl.Driver driver)
Sets the Driver.
|
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.
|
protected void |
setScannerState(int state)
Sets the scanner state.
|
protected boolean |
skipElement() |
boolean |
standaloneSet()
return if standalone is set
|
void |
startEntity(String name,
XMLResourceIdentifier identifier,
String encoding,
Augmentations augs)
This method notifies of the start of an entity.
|
getFeature, isInvalid, isInvalidLiteral, isValidNameChar, isValidNameStartChar, isValidNCName, normalizeWhitespace, reportFatalError, reset, scanAttributeValue, scanCharReferenceValue, scanComment, scanExternalID, scanPI, scanPseudoAttribute, scanPubidLiteral, scanSurrogates, scanXMLDeclOrTextDecl, setPropertyManager, versionSupportedprotected int fElementAttributeLimit
protected ExternalSubsetResolver fExternalSubsetResolver
protected static final int SCANNER_STATE_START_OF_MARKUP
protected static final int SCANNER_STATE_CONTENT
protected static final int SCANNER_STATE_PI
protected static final int SCANNER_STATE_DOCTYPE
protected static final int SCANNER_STATE_XML_DECL
protected static final int SCANNER_STATE_ROOT_ELEMENT
protected static final int SCANNER_STATE_COMMENT
protected static final int SCANNER_STATE_REFERENCE
protected static final int SCANNER_STATE_ATTRIBUTE
protected static final int SCANNER_STATE_ATTRIBUTE_VALUE
protected static final int SCANNER_STATE_END_OF_INPUT
protected static final int SCANNER_STATE_TERMINATED
protected static final int SCANNER_STATE_CDATA
protected static final int SCANNER_STATE_TEXT_DECL
protected static final int SCANNER_STATE_CHARACTER_DATA
protected static final int SCANNER_STATE_START_ELEMENT_TAG
protected static final int SCANNER_STATE_END_ELEMENT_TAG
protected static final int SCANNER_STATE_CHAR_REFERENCE
protected static final int SCANNER_STATE_BUILT_IN_REFS
protected static final String NOTIFY_BUILTIN_REFS
protected static final String ENTITY_RESOLVER
protected static final String STANDARD_URI_CONFORMANT
protected static final boolean DEBUG_START_END_ELEMENT
protected static final boolean DEBUG_NEXT
protected static final boolean DEBUG
protected static final boolean DEBUG_COALESCE
protected XMLDocumentHandler fDocumentHandler
protected int fScannerLastState
protected XMLEntityStorage fEntityStore
protected int[] fEntityStack
protected int fMarkupDepth
protected boolean fEmptyElement
protected boolean fReadingAttributes
protected int fScannerState
protected boolean fInScanContent
protected boolean fLastSectionWasCData
protected boolean fLastSectionWasEntityReference
protected boolean fLastSectionWasCharacterData
protected boolean fHasExternalDTD
protected boolean fStandaloneSet
protected boolean fStandalone
protected String fVersion
protected QName fCurrentElement
protected XMLDocumentFragmentScannerImpl.ElementStack fElementStack
protected XMLDocumentFragmentScannerImpl.ElementStack2 fElementStack2
protected String fPITarget
protected XMLString fPIData
protected boolean fNotifyBuiltInRefs
protected boolean fSupportDTD
protected boolean fReplaceEntityReferences
protected boolean fSupportExternalEntities
protected boolean fReportCdataEvent
protected boolean fIsCoalesce
protected String fDeclaredEncoding
protected boolean fDisallowDoctype
protected String fAccessExternalDTD
protected boolean fStrictURI
protected XMLDocumentFragmentScannerImpl.Driver fDriver
protected XMLDocumentFragmentScannerImpl.Driver fContentDriver
protected QName fElementQName
protected QName fAttributeQName
protected XMLAttributesIteratorImpl fAttributes
protected XMLString fTempString
protected XMLString fTempString2
protected XMLStringBuffer fStringBuffer
protected XMLStringBuffer fStringBuffer2
protected XMLStringBuffer fContentBuffer
protected boolean fScanToEnd
protected DTDGrammarUtil dtdGrammarUtil
protected boolean fAddDefaultAttr
protected boolean foundBuiltInRefs
protected String fElementRawname
protected boolean fShouldSkip
protected boolean fAdd
protected boolean fSkip
protected boolean fUsebuffer
public XMLDocumentFragmentScannerImpl()
public void setInputSource(XMLInputSource inputSource) throws IOException
setInputSource in interface XMLDocumentScannerinputSource - The input source.IOException - Thrown on i/o error.public boolean scanDocument(boolean complete)
throws IOException,
XNIException
scanDocument in interface XMLDocumentScannercomplete - 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.IOExceptionXNIExceptionpublic QName getElementQName()
public int next()
throws IOException,
XNIException
next in interface XMLDocumentScannerIOExceptionXNIExceptionpublic void reset(XMLComponentManager componentManager) throws XMLConfigurationException
reset in interface XMLComponentreset in class XMLScannercomponentManager - The component manager.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.XMLConfigurationExceptionpublic void reset(PropertyManager propertyManager)
reset in class XMLScannerpublic String[] getRecognizedFeatures()
getRecognizedFeatures in interface XMLComponentpublic void setFeature(String featureId, boolean state) throws XMLConfigurationException
Note: Components should silently ignore features that do not affect the operation of the component.
setFeature in interface XMLComponentsetFeature in class XMLScannerfeatureId - The feature identifier.state - The state of the feature.SAXNotRecognizedException - The component should not throw
this exception.SAXNotSupportedException - The component should not throw
this exception.XMLConfigurationException - Thrown for configuration error.
In general, components should
only throw this exception if
it is really
a critical error.public String[] getRecognizedProperties()
getRecognizedProperties in interface XMLComponentpublic void setProperty(String propertyId, Object value) throws XMLConfigurationException
Note: Components should silently ignore properties that do not affect the operation of the component.
setProperty in interface XMLComponentsetProperty in class XMLScannerpropertyId - The property identifier.value - The value of the property.SAXNotRecognizedException - The component should not throw
this exception.SAXNotSupportedException - The component should not throw
this exception.XMLConfigurationException - Thrown for configuration error.
In general, components should
only throw this exception if
it is really
a critical error.public Boolean getFeatureDefault(String featureId)
getFeatureDefault in interface XMLComponentfeatureId - The feature identifier.public Object getPropertyDefault(String propertyId)
getPropertyDefault in interface XMLComponentpropertyId - The property identifier.public void setDocumentHandler(XMLDocumentHandler documentHandler)
setDocumentHandler in interface XMLDocumentSourcedocumentHandler - public XMLDocumentHandler getDocumentHandler()
getDocumentHandler in interface XMLDocumentSourcepublic void startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException
startEntity in interface XMLEntityHandlerstartEntity in class XMLScannername - 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 augmentationsXNIException - Thrown by handler to signal an error.public void endEntity(String name, Augmentations augs) throws IOException, XNIException
endEntity in interface XMLEntityHandlerendEntity in class XMLScannername - The name of the entity.augs - Additional information that may include infoset augmentationsXNIException - Thrown by handler to signal an error.IOException - This exception might be thrown when there is premature end of entityprotected XMLDocumentFragmentScannerImpl.Driver createContentDriver()
protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl)
throws IOException,
XNIException
[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? '?>'
scanningTextDecl - True if a text declaration is to
be scanned instead of an XML
declaration.IOExceptionXNIExceptionpublic String getPITarget()
public XMLStringBuffer getPIData()
public XMLString getCharacterData()
protected void scanPIData(String target, XMLStringBuffer data) throws IOException, XNIException
scanPIData in class XMLScannertarget - The PI targetdata - The XMLStringBuffer to fill in with the dataIOExceptionXNIExceptionprotected void scanComment()
throws IOException,
XNIException
[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Note: Called after scanning past '<!--'
IOExceptionXNIExceptionpublic String getComment()
protected boolean skipElement()
throws IOException
IOExceptionprotected boolean scanStartElement()
throws IOException,
XNIException
[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. NB: Content in fAttributes is valid only till the state of the parser is XMLEvent.START_ELEMENT
IOExceptionXNIExceptionprotected boolean seekCloseOfStartTag()
throws IOException,
XNIException
IOExceptionXNIExceptionpublic boolean hasAttributes()
public XMLAttributesIteratorImpl getAttributeIterator()
public boolean standaloneSet()
public boolean isStandAlone()
protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException
[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.
attributes - The attributes list for the scanned attribute.IOExceptionXNIExceptionprotected int scanContent(XMLStringBuffer content) throws IOException, XNIException
IOExceptionXNIExceptionprotected boolean scanCDATASection(XMLStringBuffer contentBuffer, boolean complete) throws IOException, XNIException
Note: This method uses the fTempString and fStringBuffer variables.
complete - True if the CDATA section is to be scanned
completely.IOExceptionXNIExceptionprotected int scanEndElement()
throws IOException,
XNIException
[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.
IOExceptionXNIExceptionprotected void scanCharReference()
throws IOException,
XNIException
[66] CharRef ::= '' [0-9]+ ';' | '' [0-9a-fA-F]+ ';'
IOExceptionXNIExceptionprotected void scanEntityReference(XMLStringBuffer content) throws IOException, XNIException
IOException - Thrown if i/o error occurs.XNIException - Thrown if handler throws exception upon
notification.protected final void setScannerState(int state)
state - The new scanner state.protected final void setDriver(XMLDocumentFragmentScannerImpl.Driver driver)
Driver - The new Driver.protected String getScannerStateName(int state)
public String getEntityName()
public String getDriverName(XMLDocumentFragmentScannerImpl.Driver driver)
protected XMLString getString()
public void refresh()
refresh in interface XMLBufferListenerpublic void refresh(int refreshPosition)
XMLEntityReader when buffer
is being changed.refresh in interface XMLBufferListenerrefreshPosition - Copyright © 2018–2021 mhoffrogge. All rights reserved.