public class XMLDocumentFragmentScannerImpl extends XMLScanner implements org.apache.xerces.xni.parser.XMLDocumentScanner, org.apache.xerces.xni.parser.XMLComponent, XMLEntityHandler
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 char[] |
cdata |
protected static boolean |
DEBUG
Debug driver next
|
protected static boolean |
DEBUG_COALESCE |
protected static boolean |
DEBUG_CONTENT_SCANNING
Debug content driver scanning.
|
protected static boolean |
DEBUG_NEXT
Debug driver next
|
protected DTDGrammarUtil |
dtdGrammarUtil |
protected static char[] |
endTag |
protected boolean |
fAdd |
protected boolean |
fAddDefaultAttr |
protected org.apache.xerces.xni.QName |
fAttributeQName
Attribute QName.
|
protected org.apache.xerces.util.XMLAttributesIteratorImpl |
fAttributes
CHANGED: Using XMLAttributesIteratorImpl instead of XMLAttributesImpl.
|
protected org.apache.xerces.util.XMLStringBuffer |
fContentBuffer
Making the buffer accesible to derived class -- stores PI data
|
protected XMLDocumentFragmentScannerImpl.Driver |
fContentDriver
Content driver.
|
protected org.apache.xerces.xni.QName |
fCurrentElement
Current element.
|
protected java.lang.String |
fDeclaredEncoding |
protected boolean |
fDisallowDoctype
Disallow doctype declaration.
|
protected org.apache.xerces.xni.XMLDocumentHandler |
fDocumentHandler
Document handler.
|
protected XMLDocumentFragmentScannerImpl.Driver |
fDriver
Active driver.
|
protected org.apache.xerces.xni.QName |
fElementQName
Element QName.
|
protected java.lang.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 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 |
fNamespaces
Namespaces.
|
protected boolean |
fNotifyBuiltInRefs
Notify built-in references.
|
protected boolean |
foundBuiltInRefs |
protected org.apache.xerces.xni.XMLString |
fPIData |
protected java.lang.String |
fPITarget
Document system identifier.
|
protected boolean |
fReplaceEntityReferences |
protected boolean |
fReportCdataEvent |
protected int |
fScannerState
Scanner state.
|
protected boolean |
fScanToEnd |
protected boolean |
fShouldSkip |
protected boolean |
fSkip |
protected boolean |
fStandalone |
protected boolean |
fStandaloneSet
Standalone.
|
protected org.apache.xerces.util.XMLStringBuffer |
fStringBuffer
Making the buffer accesible to derived class -- String buffer.
|
protected org.apache.xerces.util.XMLStringBuffer |
fStringBuffer2
Making the buffer accesible to derived class -- String buffer.
|
protected boolean |
fSupportExternalEntities |
protected org.apache.xerces.xni.XMLString |
fTempString
String.
|
protected org.apache.xerces.xni.XMLString |
fTempString2
String.
|
protected java.lang.String |
fVersion |
protected static java.lang.String |
NAMESPACES
Feature identifier: namespaces.
|
protected static java.lang.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 char[] |
xmlDecl |
attributeValueCache, DEBUG_ATTR_NORMALIZATION, ENTITY_MANAGER, ERROR_REPORTER, fAmpSymbol, fAposSymbol, fAttributeCacheInitDone, fAttributeCacheUsedCount, fCharRefLiteral, fEncodingSymbol, fEntityDepth, fEntityManager, fEntityScanner, fErrorReporter, fEvent, fGtSymbol, fLtSymbol, fNotifyCharRefs, fPropertyManager, fQuotSymbol, fReportEntity, fResourceIdentifier, fScanningAttribute, fStandaloneSymbol, fStringBufferIndex, fSymbolTable, fValidation, fVersionSymbol, NOTIFY_CHAR_REFS, 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(java.lang.String name)
This method notifies the end of an entity.
|
org.apache.xerces.util.XMLAttributesIteratorImpl |
getAttributeIterator()
return the attribute iterator implementation
|
org.apache.xerces.xni.XMLString |
getCharacterData() |
java.lang.String |
getComment() |
org.apache.xerces.xni.XMLDocumentHandler |
getDocumentHandler()
Returns the document handler
|
java.lang.String |
getDriverName(XMLDocumentFragmentScannerImpl.Driver driver)
Returns the driver name.
|
java.lang.String |
getEntityName() |
java.lang.Boolean |
getFeatureDefault(java.lang.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.
|
org.apache.xerces.util.XMLStringBuffer |
getPIData() |
java.lang.String |
getPITarget() |
java.lang.Object |
getPropertyDefault(java.lang.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.
|
java.lang.String[] |
getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by
this component.
|
java.lang.String[] |
getRecognizedProperties()
Returns a list of property identifiers that are recognized by
this component.
|
protected java.lang.String |
getScannerStateName(int state)
Returns the scanner state name.
|
boolean |
hasAttributes() |
boolean |
isStandAlone()
return if the doucment is standalone
|
int |
next()
return the next state on the input
|
void |
reset(PropertyManager propertyManager) |
void |
reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
Resets the component.
|
protected void |
scanAttribute(org.apache.xerces.xni.XMLAttributes attributes)
Scans an attribute name value pair.
|
protected boolean |
scanCDATASection(org.apache.xerces.util.XMLStringBuffer contentBuffer,
boolean complete)
Scans a CDATA section.
|
protected void |
scanCharReference()
Scans a character reference.
|
protected void |
scanComment()
Scans a comment.
|
protected int |
scanContent(org.apache.xerces.util.XMLStringBuffer content)
Scans element content.
|
boolean |
scanDocument(boolean complete)
Scans a document.
|
protected int |
scanEndElement()
Scans an end element.
|
protected void |
scanEntityReference(org.apache.xerces.util.XMLStringBuffer content)
Scans an entity reference.
|
protected void |
scanPIData(java.lang.String target,
org.apache.xerces.util.XMLStringBuffer data)
Scans a processing data.
|
protected boolean |
scanStartElement()
Scans a start element.
|
protected void |
scanXMLDeclOrTextDecl(boolean scanningTextDecl)
Scans an XML or text declaration.
|
void |
setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler documentHandler)
setDocumentHandler
|
protected void |
setDriver(XMLDocumentFragmentScannerImpl.Driver driver)
Sets the Driver.
|
void |
setFeature(java.lang.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(java.lang.String propertyId,
java.lang.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(java.lang.String name,
org.apache.xerces.xni.XMLResourceIdentifier identifier,
java.lang.String encoding)
This method notifies of the start of an entity.
|
getFeature, isInvalid, isInvalidLiteral, isValidNameChar, isValidNameStartChar, isValidNCName, normalizeWhitespace, reportFatalError, scanAttributeValue, scanCharReferenceValue, scanComment, scanExternalID, scanPI, scanPseudoAttribute, scanPubidLiteral, scanSurrogates, scanXMLDeclOrTextDecl, setPropertyManager, versionSupported
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 java.lang.String NAMESPACES
protected static final java.lang.String NOTIFY_BUILTIN_REFS
protected static final char[] cdata
protected static final char[] xmlDecl
protected static final char[] endTag
protected static final boolean DEBUG_CONTENT_SCANNING
protected static final boolean DEBUG_NEXT
protected static final boolean DEBUG
protected static final boolean DEBUG_COALESCE
protected org.apache.xerces.xni.XMLDocumentHandler fDocumentHandler
protected XMLEntityStorage fEntityStore
protected int[] fEntityStack
protected int fMarkupDepth
protected boolean fEmptyElement
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 java.lang.String fVersion
protected org.apache.xerces.xni.QName fCurrentElement
protected XMLDocumentFragmentScannerImpl.ElementStack fElementStack
protected XMLDocumentFragmentScannerImpl.ElementStack2 fElementStack2
protected java.lang.String fPITarget
protected org.apache.xerces.xni.XMLString fPIData
protected boolean fNamespaces
protected boolean fNotifyBuiltInRefs
protected boolean fReplaceEntityReferences
protected boolean fSupportExternalEntities
protected boolean fReportCdataEvent
protected boolean fIsCoalesce
protected java.lang.String fDeclaredEncoding
protected boolean fDisallowDoctype
protected XMLDocumentFragmentScannerImpl.Driver fDriver
protected XMLDocumentFragmentScannerImpl.Driver fContentDriver
protected org.apache.xerces.xni.QName fElementQName
protected org.apache.xerces.xni.QName fAttributeQName
protected org.apache.xerces.util.XMLAttributesIteratorImpl fAttributes
protected org.apache.xerces.xni.XMLString fTempString
protected org.apache.xerces.xni.XMLString fTempString2
protected org.apache.xerces.util.XMLStringBuffer fStringBuffer
protected org.apache.xerces.util.XMLStringBuffer fStringBuffer2
protected org.apache.xerces.util.XMLStringBuffer fContentBuffer
protected boolean fScanToEnd
protected DTDGrammarUtil dtdGrammarUtil
protected boolean fAddDefaultAttr
protected boolean foundBuiltInRefs
protected java.lang.String fElementRawname
protected boolean fShouldSkip
protected boolean fAdd
protected boolean fSkip
public XMLDocumentFragmentScannerImpl()
public void setInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource) throws java.io.IOException
setInputSource
in interface org.apache.xerces.xni.parser.XMLDocumentScanner
inputSource
- The input source.java.io.IOException
- Thrown on i/o error.public boolean scanDocument(boolean complete) throws java.io.IOException, org.apache.xerces.xni.XNIException
scanDocument
in interface org.apache.xerces.xni.parser.XMLDocumentScanner
complete
- 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.java.io.IOException
org.apache.xerces.xni.XNIException
public int next() throws java.io.IOException, org.apache.xerces.xni.XNIException
next
in interface org.apache.xerces.xni.parser.XMLDocumentScanner
java.io.IOException
org.apache.xerces.xni.XNIException
public void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager) throws org.apache.xerces.xni.parser.XMLConfigurationException
reset
in interface org.apache.xerces.xni.parser.XMLComponent
reset
in class XMLScanner
componentManager
- 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.org.apache.xerces.xni.parser.XMLConfigurationException
public void reset(PropertyManager propertyManager)
reset
in class XMLScanner
public java.lang.String[] getRecognizedFeatures()
getRecognizedFeatures
in interface org.apache.xerces.xni.parser.XMLComponent
public void setFeature(java.lang.String featureId, boolean state) throws org.apache.xerces.xni.parser.XMLConfigurationException
Note: Components should silently ignore features that do not affect the operation of the component.
setFeature
in interface org.apache.xerces.xni.parser.XMLComponent
setFeature
in class XMLScanner
featureId
- 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.org.apache.xerces.xni.parser.XMLConfigurationException
- Thrown for configuration error.
In general, components should
only throw this exception if
it is really
a critical error.public java.lang.String[] getRecognizedProperties()
getRecognizedProperties
in interface org.apache.xerces.xni.parser.XMLComponent
public void setProperty(java.lang.String propertyId, java.lang.Object value) throws org.apache.xerces.xni.parser.XMLConfigurationException
Note: Components should silently ignore properties that do not affect the operation of the component.
setProperty
in interface org.apache.xerces.xni.parser.XMLComponent
setProperty
in class XMLScanner
propertyId
- 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.org.apache.xerces.xni.parser.XMLConfigurationException
- Thrown for configuration error.
In general, components should
only throw this exception if
it is really
a critical error.public java.lang.Boolean getFeatureDefault(java.lang.String featureId)
getFeatureDefault
in interface org.apache.xerces.xni.parser.XMLComponent
featureId
- The feature identifier.public java.lang.Object getPropertyDefault(java.lang.String propertyId)
getPropertyDefault
in interface org.apache.xerces.xni.parser.XMLComponent
propertyId
- The property identifier.public void setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler documentHandler)
setDocumentHandler
in interface org.apache.xerces.xni.parser.XMLDocumentSource
documentHandler
- public org.apache.xerces.xni.XMLDocumentHandler getDocumentHandler()
getDocumentHandler
in interface org.apache.xerces.xni.parser.XMLDocumentSource
public void startEntity(java.lang.String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, java.lang.String encoding) throws org.apache.xerces.xni.XNIException
startEntity
in interface XMLEntityHandler
startEntity
in class XMLScanner
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).org.apache.xerces.xni.XNIException
- Thrown by handler to signal an error.public void endEntity(java.lang.String name) throws java.io.IOException, org.apache.xerces.xni.XNIException
endEntity
in interface XMLEntityHandler
endEntity
in class XMLScanner
name
- The name of the entity.org.apache.xerces.xni.XNIException
- Thrown by handler to signal an error.java.io.IOException
protected XMLDocumentFragmentScannerImpl.Driver createContentDriver()
protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl) throws java.io.IOException, org.apache.xerces.xni.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.java.io.IOException
org.apache.xerces.xni.XNIException
public java.lang.String getPITarget()
public org.apache.xerces.util.XMLStringBuffer getPIData()
public org.apache.xerces.xni.XMLString getCharacterData()
protected void scanPIData(java.lang.String target, org.apache.xerces.util.XMLStringBuffer data) throws java.io.IOException, org.apache.xerces.xni.XNIException
scanPIData
in class XMLScanner
target
- The PI targetdata
- The XMLStringBuffer to fill in with the datajava.io.IOException
org.apache.xerces.xni.XNIException
protected void scanComment() throws java.io.IOException, org.apache.xerces.xni.XNIException
[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Note: Called after scanning past '<!--'
java.io.IOException
org.apache.xerces.xni.XNIException
public java.lang.String getComment()
protected boolean skipElement() throws java.io.IOException
java.io.IOException
protected boolean scanStartElement() throws java.io.IOException, org.apache.xerces.xni.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
java.io.IOException
org.apache.xerces.xni.XNIException
public boolean hasAttributes()
public org.apache.xerces.util.XMLAttributesIteratorImpl getAttributeIterator()
public boolean standaloneSet()
public boolean isStandAlone()
protected void scanAttribute(org.apache.xerces.xni.XMLAttributes attributes) throws java.io.IOException, org.apache.xerces.xni.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.java.io.IOException
org.apache.xerces.xni.XNIException
protected int scanContent(org.apache.xerces.util.XMLStringBuffer content) throws java.io.IOException, org.apache.xerces.xni.XNIException
java.io.IOException
org.apache.xerces.xni.XNIException
protected boolean scanCDATASection(org.apache.xerces.util.XMLStringBuffer contentBuffer, boolean complete) throws java.io.IOException, org.apache.xerces.xni.XNIException
Note: This method uses the fTempString and fStringBuffer variables.
complete
- True if the CDATA section is to be scanned
completely.java.io.IOException
org.apache.xerces.xni.XNIException
protected int scanEndElement() throws java.io.IOException, org.apache.xerces.xni.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.
java.io.IOException
org.apache.xerces.xni.XNIException
protected void scanCharReference() throws java.io.IOException, org.apache.xerces.xni.XNIException
[66] CharRef ::= '' [0-9]+ ';' | '' [0-9a-fA-F]+ ';'
java.io.IOException
org.apache.xerces.xni.XNIException
protected void scanEntityReference(org.apache.xerces.util.XMLStringBuffer content) throws java.io.IOException, org.apache.xerces.xni.XNIException
java.io.IOException
- Thrown if i/o error occurs.org.apache.xerces.xni.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 java.lang.String getScannerStateName(int state)
public java.lang.String getEntityName()
public java.lang.String getDriverName(XMLDocumentFragmentScannerImpl.Driver driver)
Copyright ? 2002-2003 Apache XML Project. All Rights Reserved.