org.apache.xerces.impl
public abstract class XMLScanner extends Object implements XMLComponent
This component requires the following features and properties from the component manager that uses it:
Version: $Id: XMLScanner.java,v 1.51 2004/10/04 21:45:48 mrglavas Exp $
Field Summary | |
---|---|
protected static boolean | DEBUG_ATTR_NORMALIZATION Debug attribute normalization. |
protected static String | ENTITY_MANAGER Property identifier: entity manager. |
protected static String | ERROR_REPORTER Property identifier: error reporter. |
protected static String | fAmpSymbol Symbol: "amp". |
protected static String | fAposSymbol Symbol: "apos". |
protected String | fCharRefLiteral Literal value of the last character refence scanned. |
protected static 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 String | fGtSymbol Symbol: "gt". |
protected static String | fLtSymbol Symbol: "lt". |
protected boolean | fNamespaces Namespaces. |
protected boolean | fNotifyCharRefs Character references notification. |
protected boolean | fParserSettings Internal parser-settings feature |
protected static String | fQuotSymbol Symbol: "quot". |
protected boolean | fReportEntity Report entity boundary. |
protected XMLResourceIdentifierImpl | fResourceIdentifier |
protected boolean | fScanningAttribute Scanning attribute. |
protected static String | fStandaloneSymbol Symbol: "standalone". |
protected SymbolTable | fSymbolTable Symbol table. |
protected boolean | fValidation
Validation. |
protected static String | fVersionSymbol Symbol: "version". |
protected static String | NAMESPACES Feature identifier: namespaces. |
protected static String | NOTIFY_CHAR_REFS Feature identifier: notify character references. |
protected static String | PARSER_SETTINGS |
protected static String | SYMBOL_TABLE Property identifier: symbol table. |
protected static String | VALIDATION Feature identifier: validation. |
Method Summary | |
---|---|
void | endEntity(String name, Augmentations augs)
This method notifies the end of an entity. |
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 | isValidNameChar(int value) |
protected boolean | isValidNameStartChar(int value) |
protected boolean | isValidNameStartHighSurrogate(int value) |
protected boolean | isValidNCName(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. |
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.
|
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. |
String | scanPseudoAttribute(boolean scanningTextDecl, XMLString value)
Scans a pseudo attribute.
|
protected boolean | scanPubidLiteral(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, String[] pseudoAttributeValues)
Scans an XML or text declaration.
|
void | setFeature(String featureId, boolean value) |
void | setProperty(String propertyId, Object value)
Sets the value of a property during parsing.
|
void | startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs)
This method notifies of the start of an entity. |
protected boolean | versionSupported(String version) |
Parameters: name The name of the entity. augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Returns: -1 if the value would be unchanged by normalization, otherwise the index of the first whitespace character which would be transformed.
Parameters: componentManager The component manager.
Throws: SAXException Throws exception if required features and properties cannot be found.
Parameters: 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.
Returns: true if the non-normalized and normalized value are the same Note: This method uses fStringBuffer2, anything in it at the time of calling is lost.
[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 buf2 the character buffer to append non-normalized chars to
Returns: the character value or (-1) on conversion failure
[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.
Parameters: 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.
[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.
Parameters: target The PI target data The string to fill in with the data
Parameters: 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.
Returns: The name of the attribute Note: This method uses fStringBuffer2, anything in it at the time of calling is lost.
Parameters: literal The string to fill in with the public ID literal.
Returns: True on success. Note: This method uses fStringBuffer, anything in it at the time of calling is lost.
Note: This assumes the current char has already been identified as a high surrogate.
Parameters: buf The StringBuffer to append the read surrogates to.
Returns: True if it succeeded.
[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 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.
Parameters: propertyId value
Parameters: 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 augmentations
Throws: XNIException Thrown by handler to signal an error.