| java.lang.Object com.sun.xml.stream.XMLScanner
All known Subclasses: com.sun.xml.stream.XMLDTDScannerImpl, com.sun.xml.stream.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://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 author: K.Venugopal SUN Microsystems version: $Id: XMLScanner.java,v 1.5 2006/11/29 22:01:32 spericas Exp $ |
Method Summary | |
public void | endEntity(String name) This method notifies the end of an entity. | public boolean | getFeature(String featureId) | XMLStringBuffer | getStringBuffer() | protected static boolean | isInvalid(int value) | protected static boolean | isInvalidLiteral(int value) | protected static boolean | isValidNCName(int value) | protected static boolean | isValidNameChar(int value) | protected static boolean | isValidNameStartChar(int value) | protected void | normalizeWhitespace(XMLString value) 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) | public void | reset(PropertyManager propertyManager) | protected void | scanAttributeValue(XMLString value, XMLString nonNormalizedValue, String atName, XMLAttributes attributes, int attrIndex, boolean checkEntities) 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(XMLStringBuffer data) Scans a processing instruction. | protected void | scanPIData(String target, XMLStringBuffer 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. | protected void | setPropertyManager(PropertyManager propertyManager) | public void | startEntity(String name, XMLResourceIdentifier identifier, String encoding) 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.
|
NOTIFY_CHAR_REFS | final protected static String NOTIFY_CHAR_REFS(Code) | | Feature identifier: notify character references.
|
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".
|
fAttributeCacheInitDone | protected boolean fAttributeCacheInitDone(Code) | | |
fAttributeCacheUsedCount | protected int fAttributeCacheUsedCount(Code) | | |
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.
|
fEntityScanner | protected XMLEntityReaderImpl fEntityScanner(Code) | | Entity scanner, this alwasy works on last entity that was opened.
|
fEntityStore | protected XMLEntityStorage fEntityStore(Code) | | xxx this should be available from EntityManager Entity storage
|
fGtSymbol | final protected static String fGtSymbol(Code) | | Symbol: "gt".
|
fLtSymbol | final protected static String fLtSymbol(Code) | | Symbol: "lt".
|
fNotifyCharRefs | protected boolean fNotifyCharRefs(Code) | | Character references notification.
|
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".
|
fStringBufferIndex | protected int fStringBufferIndex(Code) | | |
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".
|
initialCacheCount | int initialCacheCount(Code) | | |
endEntity | public void endEntity(String name) throws IOException, 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. throws: XNIException - Thrown by handler to signal an error. |
isInvalid | protected static boolean isInvalid(int value)(Code) | | |
isInvalidLiteral | protected static boolean isInvalidLiteral(int value)(Code) | | |
isValidNCName | protected static boolean isValidNCName(int value)(Code) | | |
isValidNameChar | protected static boolean isValidNameChar(int value)(Code) | | |
isValidNameStartChar | protected static boolean isValidNameStartChar(int value)(Code) | | |
normalizeWhitespace | protected void normalizeWhitespace(XMLString value)(Code) | | Normalize whitespace in an XMLString converting all whitespace
characters to space characters.
|
scanAttributeValue | protected void scanAttributeValue(XMLString value, XMLString nonNormalizedValue, String atName, XMLAttributes attributes, int attrIndex, boolean checkEntities) 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 thenon-normalized value. Parameters: atName - The name of the attribute being parsed (for error msgs). Parameters: attributes - The attributes list for the scanned attribute. Parameters: attrIndex - The index of the attribute to use from the list. Parameters: checkEntities - true if undeclared entities should be reported as VC violation,false if undeclared entities should be reported as WFC violation.Note: 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(XMLStringBuffer data) throws IOException, XNIException(Code) | | Scans a processing instruction.
[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
|
scanPIData | protected void scanPIData(String target, XMLStringBuffer 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)
This method would always read the whole data. We have while loop and data is buffered
until delimeter is encountered.
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. Thisflag is needed to report the correct type oferror. Parameters: value - The string to fill in with the attributevalue. 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) 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). throws: XNIException - Thrown by handler to signal an error. |
versionSupported | protected boolean versionSupported(String version)(Code) | | |
|
|