public abstract class XMLScanner
extends java.lang.Object
implements org.apache.xerces.xni.parser.XMLComponent
This component requires the following features and properties from the component manager that uses it:
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEBUG_ATTR_NORMALIZATION
Debug attribute normalization.
|
protected static java.lang.String |
ENTITY_MANAGER
Property identifier: entity manager.
|
protected static java.lang.String |
ERROR_REPORTER
Property identifier: error reporter.
|
protected static java.lang.String |
fAmpSymbol
Symbol: "amp".
|
protected static java.lang.String |
fAposSymbol
Symbol: "apos".
|
protected java.lang.String |
fCharRefLiteral
Literal value of the last character refence scanned.
|
protected static java.lang.String |
fEncodingSymbol
Symbol: "encoding".
|
protected int |
fEntityDepth
Entity depth.
|
protected XMLEntityManager |
fEntityManager
Entity manager.
|
protected XMLEntityScanner |
fEntityScanner
Entity scanner.
|
protected XMLErrorReporter |
fErrorReporter
Error reporter.
|
protected static java.lang.String |
fGtSymbol
Symbol: "gt".
|
protected static java.lang.String |
fLtSymbol
Symbol: "lt".
|
protected boolean |
fNamespaces
Namespaces.
|
protected boolean |
fNotifyCharRefs
Character references notification.
|
protected boolean |
fParserSettings
Internal parser-settings feature
|
protected static java.lang.String |
fQuotSymbol
Symbol: "quot".
|
protected boolean |
fReportEntity
Report entity boundary.
|
protected XMLResourceIdentifierImpl |
fResourceIdentifier |
protected boolean |
fScanningAttribute
Scanning attribute.
|
protected static java.lang.String |
fStandaloneSymbol
Symbol: "standalone".
|
protected SymbolTable |
fSymbolTable
Symbol table.
|
protected boolean |
fValidation
Validation.
|
protected static java.lang.String |
fVersionSymbol
Symbol: "version".
|
protected static java.lang.String |
NAMESPACES
Feature identifier: namespaces.
|
protected static java.lang.String |
NOTIFY_CHAR_REFS
Feature identifier: notify character references.
|
protected static java.lang.String |
PARSER_SETTINGS |
protected static java.lang.String |
SYMBOL_TABLE
Property identifier: symbol table.
|
protected static java.lang.String |
VALIDATION
Feature identifier: validation.
|
Constructor and Description |
---|
XMLScanner() |
Modifier and Type | Method and Description |
---|---|
void |
endEntity(java.lang.String name,
org.apache.xerces.xni.Augmentations augs)
This method notifies the end of an entity.
|
boolean |
getFeature(java.lang.String featureId) |
protected java.lang.String |
getVersionNotSupportedKey() |
protected boolean |
isInvalid(int value) |
protected boolean |
isInvalidLiteral(int value) |
protected int |
isUnchangedByNormalization(org.apache.xerces.xni.XMLString value)
Checks whether this string would be unchanged by normalization.
|
protected boolean |
isValidNameChar(int value) |
protected boolean |
isValidNameStartChar(int value) |
protected boolean |
isValidNameStartHighSurrogate(int value) |
protected boolean |
isValidNCName(int value) |
protected void |
normalizeWhitespace(org.apache.xerces.xni.XMLString value)
Normalize whitespace in an XMLString converting all whitespace
characters to space characters.
|
protected void |
normalizeWhitespace(org.apache.xerces.xni.XMLString value,
int fromIndex)
Normalize whitespace in an XMLString converting all whitespace
characters to space characters.
|
protected void |
reportFatalError(java.lang.String msgId,
java.lang.Object[] args)
Convenience function used in all XML scanners.
|
protected void |
reset() |
void |
reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
Resets the component.
|
protected boolean |
scanAttributeValue(org.apache.xerces.xni.XMLString value,
org.apache.xerces.xni.XMLString nonNormalizedValue,
java.lang.String atName,
boolean checkEntities,
java.lang.String eleName)
Scans an attribute value and normalizes whitespace converting all
whitespace characters to space characters.
|
protected int |
scanCharReferenceValue(XMLStringBuffer buf,
XMLStringBuffer buf2)
Scans a character reference and append the corresponding chars to the
specified buffer.
|
protected void |
scanComment(XMLStringBuffer text)
Scans a comment.
|
protected void |
scanExternalID(java.lang.String[] identifiers,
boolean optionalSystemId)
Scans External ID and return the public and system IDs.
|
protected void |
scanPI()
Scans a processing instruction.
|
protected void |
scanPIData(java.lang.String target,
org.apache.xerces.xni.XMLString data)
Scans a processing data.
|
java.lang.String |
scanPseudoAttribute(boolean scanningTextDecl,
org.apache.xerces.xni.XMLString value)
Scans a pseudo attribute.
|
protected boolean |
scanPubidLiteral(org.apache.xerces.xni.XMLString literal)
Scans public ID literal.
|
protected boolean |
scanSurrogates(XMLStringBuffer buf)
Scans surrogates and append them to the specified buffer.
|
protected void |
scanXMLDeclOrTextDecl(boolean scanningTextDecl,
java.lang.String[] pseudoAttributeValues)
Scans an XML or text declaration.
|
void |
setFeature(java.lang.String featureId,
boolean value)
Sets the state of a feature.
|
void |
setProperty(java.lang.String propertyId,
java.lang.Object value)
Sets the value of a property during parsing.
|
void |
startEntity(java.lang.String name,
org.apache.xerces.xni.XMLResourceIdentifier identifier,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
This method notifies of the start of an entity.
|
protected boolean |
versionSupported(java.lang.String version) |
protected static final java.lang.String VALIDATION
protected static final java.lang.String NAMESPACES
protected static final java.lang.String NOTIFY_CHAR_REFS
protected static final java.lang.String PARSER_SETTINGS
protected static final java.lang.String SYMBOL_TABLE
protected static final java.lang.String ERROR_REPORTER
protected static final java.lang.String ENTITY_MANAGER
protected static final boolean DEBUG_ATTR_NORMALIZATION
protected boolean fValidation
protected boolean fNamespaces
protected boolean fNotifyCharRefs
protected boolean fParserSettings
protected SymbolTable fSymbolTable
protected XMLErrorReporter fErrorReporter
protected XMLEntityManager fEntityManager
protected XMLEntityScanner fEntityScanner
protected int fEntityDepth
protected java.lang.String fCharRefLiteral
protected boolean fScanningAttribute
protected boolean fReportEntity
protected static final java.lang.String fVersionSymbol
protected static final java.lang.String fEncodingSymbol
protected static final java.lang.String fStandaloneSymbol
protected static final java.lang.String fAmpSymbol
protected static final java.lang.String fLtSymbol
protected static final java.lang.String fGtSymbol
protected static final java.lang.String fQuotSymbol
protected static final java.lang.String fAposSymbol
protected final XMLResourceIdentifierImpl fResourceIdentifier
public void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager) throws org.apache.xerces.xni.parser.XMLConfigurationException
org.apache.xerces.xni.parser.XMLComponent
reset
in interface org.apache.xerces.xni.parser.XMLComponent
componentManager
- The component manager.SAXException
- Throws exception if required features and
properties cannot be found.org.apache.xerces.xni.parser.XMLConfigurationException
public void setProperty(java.lang.String propertyId, java.lang.Object value) throws org.apache.xerces.xni.parser.XMLConfigurationException
setProperty
in interface org.apache.xerces.xni.parser.XMLComponent
propertyId
- value
- 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 void setFeature(java.lang.String featureId, boolean value) throws org.apache.xerces.xni.parser.XMLConfigurationException
org.apache.xerces.xni.parser.XMLComponent
Note: Components should silently ignore features that do not affect the operation of the component.
setFeature
in interface org.apache.xerces.xni.parser.XMLComponent
featureId
- The feature identifier.value
- The state of the feature.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 boolean getFeature(java.lang.String featureId) throws org.apache.xerces.xni.parser.XMLConfigurationException
org.apache.xerces.xni.parser.XMLConfigurationException
protected void reset()
protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl, java.lang.String[] pseudoAttributeValues) throws java.io.IOException, org.apache.xerces.xni.XNIException
[23] XMLDecl ::= '' [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 ::= ''
scanningTextDecl
- True if a text declaration is to
be scanned instead of an XML
declaration.pseudoAttributeValues
- An array of size 3 to return the version,
encoding and standalone pseudo attribute values
(in that order).
Note: This method uses fString, anything in it
at the time of calling is lost.java.io.IOException
org.apache.xerces.xni.XNIException
public java.lang.String scanPseudoAttribute(boolean scanningTextDecl, org.apache.xerces.xni.XMLString value) throws java.io.IOException, org.apache.xerces.xni.XNIException
scanningTextDecl
- True if scanning this pseudo-attribute for a
TextDecl; false if scanning XMLDecl. This
flag is needed to report the correct type of
error.value
- The string to fill in with the attribute
value.java.io.IOException
org.apache.xerces.xni.XNIException
protected void scanPI() throws java.io.IOException, org.apache.xerces.xni.XNIException
[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))Note: This method uses fString, anything in it at the time of calling is lost.
java.io.IOException
org.apache.xerces.xni.XNIException
protected void scanPIData(java.lang.String target, org.apache.xerces.xni.XMLString data) throws java.io.IOException, org.apache.xerces.xni.XNIException
target
- The PI targetdata
- The string to fill in with the datajava.io.IOException
org.apache.xerces.xni.XNIException
protected void scanComment(XMLStringBuffer text) throws java.io.IOException, org.apache.xerces.xni.XNIException
[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Note: Called after scanning past '<!--' Note: This method uses fString, anything in it at the time of calling is lost.
text
- The buffer to fill in with the text.java.io.IOException
org.apache.xerces.xni.XNIException
protected boolean scanAttributeValue(org.apache.xerces.xni.XMLString value, org.apache.xerces.xni.XMLString nonNormalizedValue, java.lang.String atName, boolean checkEntities, java.lang.String eleName) throws java.io.IOException, org.apache.xerces.xni.XNIException
value
- The XMLString to fill in with the value.nonNormalizedValue
- The XMLString to fill in with the
non-normalized value.atName
- The name of the attribute being parsed (for error msgs).checkEntities
- true if undeclared entities should be reported as VC violation,
false if undeclared entities should be reported as WFC violation.eleName
- The name of element to which this attribute belongs.java.io.IOException
org.apache.xerces.xni.XNIException
protected void scanExternalID(java.lang.String[] identifiers, boolean optionalSystemId) throws java.io.IOException, org.apache.xerces.xni.XNIException
identifiers
- An array of size 2 to return the system id,
and public id (in that order).optionalSystemId
- Specifies whether the system id is optional.
Note: This method uses fString and fStringBuffer,
anything in them at the time of calling is lost.java.io.IOException
org.apache.xerces.xni.XNIException
protected boolean scanPubidLiteral(org.apache.xerces.xni.XMLString literal) throws java.io.IOException, org.apache.xerces.xni.XNIException
literal
- The string to fill in with the public ID literal.java.io.IOException
org.apache.xerces.xni.XNIException
protected void normalizeWhitespace(org.apache.xerces.xni.XMLString value)
protected void normalizeWhitespace(org.apache.xerces.xni.XMLString value, int fromIndex)
protected int isUnchangedByNormalization(org.apache.xerces.xni.XMLString value)
public void startEntity(java.lang.String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, java.lang.String encoding, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
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).augs
- Additional information that may include infoset augmentationsorg.apache.xerces.xni.XNIException
- Thrown by handler to signal an error.public void endEntity(java.lang.String name, org.apache.xerces.xni.Augmentations augs) throws org.apache.xerces.xni.XNIException
name
- The name of the entity.augs
- Additional information that may include infoset augmentationsorg.apache.xerces.xni.XNIException
- Thrown by handler to signal an error.protected int scanCharReferenceValue(XMLStringBuffer buf, XMLStringBuffer buf2) throws java.io.IOException, org.apache.xerces.xni.XNIException
[66] CharRef ::= '' [0-9]+ ';' | '' [0-9a-fA-F]+ ';'Note: This method uses fStringBuffer, anything in it at the time of calling is lost.
buf
- the character buffer to append chars tobuf2
- the character buffer to append non-normalized chars tojava.io.IOException
org.apache.xerces.xni.XNIException
protected boolean isInvalid(int value)
protected boolean isInvalidLiteral(int value)
protected boolean isValidNameChar(int value)
protected boolean isValidNameStartChar(int value)
protected boolean isValidNCName(int value)
protected boolean isValidNameStartHighSurrogate(int value)
protected boolean versionSupported(java.lang.String version)
protected java.lang.String getVersionNotSupportedKey()
protected boolean scanSurrogates(XMLStringBuffer buf) throws java.io.IOException, org.apache.xerces.xni.XNIException
Note: This assumes the current char has already been identified as a high surrogate.
buf
- The StringBuffer to append the read surrogates to.java.io.IOException
org.apache.xerces.xni.XNIException
protected void reportFatalError(java.lang.String msgId, java.lang.Object[] args) throws org.apache.xerces.xni.XNIException
org.apache.xerces.xni.XNIException
Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.