| java.lang.Object org.apache.xerces.impl.XMLScanner
All known Subclasses: org.apache.xerces.impl.XMLDTDScannerImpl, org.apache.xerces.impl.XMLDocumentFragmentScannerImpl,
XMLScanner | abstract public class XMLScanner implements XMLComponent(Code) | | This class is responsible for holding scanning methods common to
scanning the XML document structure and content as well as the DTD
structure and content. Both XMLDocumentScanner and XMLDTDScanner inherit
from this base class.
This component requires the following features and properties from the
component manager that uses it:
- http://xml.org/sax/features/validation
- http://xml.org/sax/features/namespaces
- http://apache.org/xml/features/scanner/notify-char-refs
- http://apache.org/xml/properties/internal/symbol-table
- http://apache.org/xml/properties/internal/error-reporter
- http://apache.org/xml/properties/internal/entity-manager
author: Andy Clark, IBM author: Arnaud Le Hors, IBM author: Eric Ye, IBM version: $Id: XMLScanner.java 572055 2007-09-02 17:55:43Z mrglavas $ |
Method Summary | |
public void | endEntity(String name, Augmentations augs) This method notifies the end of an entity. | public boolean | getFeature(String featureId) | protected String | getVersionNotSupportedKey() | protected boolean | isInvalid(int value) | protected boolean | isInvalidLiteral(int value) | protected int | isUnchangedByNormalization(XMLString value) Checks whether this string would be unchanged by normalization. | protected boolean | isValidNCName(int value) | protected boolean | isValidNameChar(int value) | protected boolean | isValidNameStartChar(int value) | protected boolean | isValidNameStartHighSurrogate(int value) | protected void | normalizeWhitespace(XMLString value) Normalize whitespace in an XMLString converting all whitespace
characters to space characters. | protected void | normalizeWhitespace(XMLString value, int fromIndex) Normalize whitespace in an XMLString converting all whitespace
characters to space characters. | protected void | reportFatalError(String msgId, Object[] args) Convenience function used in all XML scanners. | public void | reset(XMLComponentManager componentManager) | protected void | reset() | protected boolean | scanAttributeValue(XMLString value, XMLString nonNormalizedValue, String atName, boolean checkEntities, String eleName) Scans an attribute value and normalizes whitespace converting all
whitespace characters to space characters.
[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
Parameters: value - The XMLString to fill in with the value. Parameters: nonNormalizedValue - The XMLString to fill in with the non-normalized value. Parameters: atName - The name of the attribute being parsed (for error msgs). Parameters: checkEntities - true if undeclared entities should be reported as VC violation, false if undeclared entities should be reported as WFC violation. Parameters: eleName - The name of element to which this attribute belongs. | 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(String[] identifiers, boolean optionalSystemId) Scans External ID and return the public and system IDs. | protected void | scanPI() Scans a processing instruction. | protected void | scanPIData(String target, XMLString data) Scans a processing data. | public String | scanPseudoAttribute(boolean scanningTextDecl, XMLString value) Scans a pseudo attribute.
Parameters: scanningTextDecl - True if scanning this pseudo-attribute for aTextDecl; false if scanning XMLDecl. | protected boolean | scanPubidLiteral(XMLString literal) Scans public ID literal.
[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
[13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
The returned string is normalized according to the following rule,
from http://www.w3.org/TR/REC-xml#dt-pubid:
Before a match is attempted, all strings of white space in the public
identifier must be normalized to single space characters (#x20), and
leading and trailing white space must be removed.
Parameters: literal - The string to fill in with the public ID literal. | protected boolean | scanSurrogates(XMLStringBuffer buf) Scans surrogates and append them to the specified buffer.
Note: This assumes the current char has already been
identified as a high surrogate.
Parameters: buf - The StringBuffer to append the read surrogates to. | protected void | scanXMLDeclOrTextDecl(boolean scanningTextDecl, String[] pseudoAttributeValues) Scans an XML or text declaration. | public void | setFeature(String featureId, boolean value) | public void | setProperty(String propertyId, Object value) Sets the value of a property during parsing. | public void | startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) This method notifies of the start of an entity. | protected boolean | versionSupported(String version) |
DEBUG_ATTR_NORMALIZATION | final protected static boolean DEBUG_ATTR_NORMALIZATION(Code) | | Debug attribute normalization.
|
ENTITY_MANAGER | final protected static String ENTITY_MANAGER(Code) | | Property identifier: entity manager.
|
ERROR_REPORTER | final protected static String ERROR_REPORTER(Code) | | Property identifier: error reporter.
|
NAMESPACES | final protected static String NAMESPACES(Code) | | Feature identifier: namespaces.
|
NOTIFY_CHAR_REFS | final protected static String NOTIFY_CHAR_REFS(Code) | | Feature identifier: notify character references.
|
PARSER_SETTINGS | final protected static String PARSER_SETTINGS(Code) | | |
SYMBOL_TABLE | final protected static String SYMBOL_TABLE(Code) | | Property identifier: symbol table.
|
VALIDATION | final protected static String VALIDATION(Code) | | Feature identifier: validation.
|
fAmpSymbol | final protected static String fAmpSymbol(Code) | | Symbol: "amp".
|
fAposSymbol | final protected static String fAposSymbol(Code) | | Symbol: "apos".
|
fCharRefLiteral | protected String fCharRefLiteral(Code) | | Literal value of the last character refence scanned.
|
fEncodingSymbol | final protected static String fEncodingSymbol(Code) | | Symbol: "encoding".
|
fEntityDepth | protected int fEntityDepth(Code) | | Entity depth.
|
fGtSymbol | final protected static String fGtSymbol(Code) | | Symbol: "gt".
|
fLtSymbol | final protected static String fLtSymbol(Code) | | Symbol: "lt".
|
fNamespaces | protected boolean fNamespaces(Code) | | Namespaces.
|
fNotifyCharRefs | protected boolean fNotifyCharRefs(Code) | | Character references notification.
|
fParserSettings | protected boolean fParserSettings(Code) | | Internal parser-settings feature
|
fQuotSymbol | final protected static String fQuotSymbol(Code) | | Symbol: "quot".
|
fReportEntity | protected boolean fReportEntity(Code) | | Report entity boundary.
|
fScanningAttribute | protected boolean fScanningAttribute(Code) | | Scanning attribute.
|
fStandaloneSymbol | final protected static String fStandaloneSymbol(Code) | | Symbol: "standalone".
|
fValidation | protected boolean fValidation(Code) | | Validation. This feature identifier is:
http://xml.org/sax/features/validation
|
fVersionSymbol | final protected static String fVersionSymbol(Code) | | Symbol: "version".
|
endEntity | public void endEntity(String name, Augmentations augs) throws XNIException(Code) | | This method notifies the end of an entity. The document entity has
the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]"
parameter entity names start with '%'; and general entities are just
specified by their name.
Parameters: name - The name of the entity. Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
getVersionNotSupportedKey | protected String getVersionNotSupportedKey()(Code) | | |
isInvalid | protected boolean isInvalid(int value)(Code) | | |
isInvalidLiteral | protected boolean isInvalidLiteral(int value)(Code) | | |
isUnchangedByNormalization | protected int isUnchangedByNormalization(XMLString value)(Code) | | Checks whether this string would be unchanged by normalization.
-1 if the value would be unchanged by normalization,otherwise the index of the first whitespace character whichwould be transformed. |
isValidNCName | protected boolean isValidNCName(int value)(Code) | | |
isValidNameChar | protected boolean isValidNameChar(int value)(Code) | | |
isValidNameStartChar | protected boolean isValidNameStartChar(int value)(Code) | | |
isValidNameStartHighSurrogate | protected boolean isValidNameStartHighSurrogate(int value)(Code) | | |
normalizeWhitespace | protected void normalizeWhitespace(XMLString value)(Code) | | Normalize whitespace in an XMLString converting all whitespace
characters to space characters.
|
normalizeWhitespace | protected void normalizeWhitespace(XMLString value, int fromIndex)(Code) | | Normalize whitespace in an XMLString converting all whitespace
characters to space characters.
|
reset | protected void reset()(Code) | | |
scanAttributeValue | protected boolean scanAttributeValue(XMLString value, XMLString nonNormalizedValue, String atName, boolean checkEntities, String eleName) throws IOException, XNIException(Code) | | Scans an attribute value and normalizes whitespace converting all
whitespace characters to space characters.
[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
Parameters: value - The XMLString to fill in with the value. Parameters: nonNormalizedValue - The XMLString to fill in with the non-normalized value. Parameters: atName - The name of the attribute being parsed (for error msgs). Parameters: checkEntities - true if undeclared entities should be reported as VC violation, false if undeclared entities should be reported as WFC violation. Parameters: eleName - The name of element to which this attribute belongs. true if the non-normalized and normalized value are the sameNote: This method uses fStringBuffer2, anything in itat the time of calling is lost. |
scanCharReferenceValue | protected int scanCharReferenceValue(XMLStringBuffer buf, XMLStringBuffer buf2) throws IOException, XNIException(Code) | | Scans a character reference and append the corresponding chars to the
specified buffer.
[66] CharRef ::= '' [0-9]+ ';' | '' [0-9a-fA-F]+ ';'
Note: This method uses fStringBuffer, anything in it
at the time of calling is lost.
Parameters: buf - the character buffer to append chars to Parameters: buf2 - the character buffer to append non-normalized chars to the character value or (-1) on conversion failure |
scanComment | protected void scanComment(XMLStringBuffer text) throws IOException, XNIException(Code) | | Scans a comment.
[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Note: Called after scanning past '<!--'
Note: This method uses fString, anything in it
at the time of calling is lost.
Parameters: text - The buffer to fill in with the text. |
scanExternalID | protected void scanExternalID(String[] identifiers, boolean optionalSystemId) throws IOException, XNIException(Code) | | Scans External ID and return the public and system IDs.
Parameters: identifiers - An array of size 2 to return the system id,and public id (in that order). Parameters: 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. |
scanPI | protected void scanPI() throws IOException, XNIException(Code) | | Scans a processing instruction.
[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.
|
scanPIData | protected void scanPIData(String target, XMLString data) throws IOException, XNIException(Code) | | 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)
Note: This method uses fStringBuffer, anything in it
at the time of calling is lost.
Parameters: target - The PI target Parameters: data - The string to fill in with the data |
scanPseudoAttribute | public String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException, XNIException(Code) | | Scans a pseudo attribute.
Parameters: scanningTextDecl - True if scanning this pseudo-attribute for aTextDecl; false if scanning XMLDecl. This flag is needed to report the correct type oferror. Parameters: value - The string to fill in with the attribute value. The name of the attributeNote: This method uses fStringBuffer2, anything in itat the time of calling is lost. |
scanPubidLiteral | protected boolean scanPubidLiteral(XMLString literal) throws IOException, XNIException(Code) | | Scans public ID literal.
[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
[13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
The returned string is normalized according to the following rule,
from http://www.w3.org/TR/REC-xml#dt-pubid:
Before a match is attempted, all strings of white space in the public
identifier must be normalized to single space characters (#x20), and
leading and trailing white space must be removed.
Parameters: literal - The string to fill in with the public ID literal. True on success.Note: This method uses fStringBuffer, anything in it atthe time of calling is lost. |
scanSurrogates | protected boolean scanSurrogates(XMLStringBuffer buf) throws IOException, XNIException(Code) | | Scans surrogates and append them to the specified buffer.
Note: This assumes the current char has already been
identified as a high surrogate.
Parameters: buf - The StringBuffer to append the read surrogates to. True if it succeeded. |
scanXMLDeclOrTextDecl | protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl, String[] pseudoAttributeValues) throws IOException, XNIException(Code) | | Scans an XML or text declaration.
[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 ::= ''
Parameters: scanningTextDecl - True if a text declaration is tobe scanned instead of an XMLdeclaration. Parameters: 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 itat the time of calling is lost. |
startEntity | public void startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException(Code) | | This method notifies of the start of an entity. The document entity
has the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]"
parameter entity names start with '%'; and general entities are just
specified by their name.
Parameters: name - The name of the entity. Parameters: identifier - The resource identifier. Parameters: encoding - The auto-detected IANA encoding name of the entitystream. This value will be null in those situationswhere the entity encoding is not auto-detected (e.g.internal entities or a document entity that isparsed from a java.io.Reader). Parameters: augs - Additional information that may include infoset augmentations throws: XNIException - Thrown by handler to signal an error. |
versionSupported | protected boolean versionSupported(String version)(Code) | | |
|
|