public final class Utf8Scanner extends StreamScanner
_in, _inputBuffer_charTypes, _inputEnd, _inputPtr, _quadBuffer, _symbols, _tmpChar, BYTE_a, BYTE_A, BYTE_AMP, BYTE_APOS, BYTE_C, BYTE_CR, BYTE_D, BYTE_EQ, BYTE_EXCL, BYTE_g, BYTE_GT, BYTE_HASH, BYTE_HYPHEN, BYTE_l, BYTE_LBRACKET, BYTE_LF, BYTE_LT, BYTE_m, BYTE_NULL, BYTE_o, BYTE_p, BYTE_P, BYTE_q, BYTE_QMARK, BYTE_QUOT, BYTE_RBRACKET, BYTE_s, BYTE_S, BYTE_SEMICOLON, BYTE_SLASH, BYTE_SPACE, BYTE_t, BYTE_T, BYTE_TAB, BYTE_u, BYTE_x_attrCollector, _attrCount, _cfgCoalescing, _cfgLazyParsing, _config, _currElem, _currNsCount, _currRow, _currToken, _defaultNs, _depth, _entityPending, _isEmptyTag, _lastNsContext, _lastNsDecl, _nameBuffer, _nsBindingCache, _nsBindingCount, _nsBindings, _nsBindMisses, _pastBytesOrChars, _publicId, _rowStartOffset, _startColumn, _startRawOffset, _startRow, _systemId, _textBuilder, _tokenIncomplete, _tokenName, _xml11, CDATA_STR, INT_0, INT_9, INT_a, INT_A, INT_AMP, INT_APOS, INT_COLON, INT_CR, INT_EQ, INT_EXCL, INT_f, INT_F, INT_GT, INT_HYPHEN, INT_LBRACKET, INT_LF, INT_LT, INT_NULL, INT_QMARK, INT_QUOTE, INT_RBRACKET, INT_SLASH, INT_SPACE, INT_TAB, INT_z, MAX_UNICODE_CHAR, TOKEN_EOICHAR_CR, CHAR_LF, CHAR_NULL, CHAR_SPACE, STAX_DEFAULT_OUTPUT_ENCODING, STAX_DEFAULT_OUTPUT_VERSION, XML_DECL_KW_ENCODING, XML_DECL_KW_STANDALONE, XML_DECL_KW_VERSION, XML_SA_NO, XML_SA_YES, XML_V_10, XML_V_10_STR, XML_V_11, XML_V_11_STR, XML_V_UNKNOWN| Constructor and Description |
|---|
Utf8Scanner(ReaderConfig cfg,
java.io.InputStream in,
byte[] buffer,
int ptr,
int last) |
| Modifier and Type | Method and Description |
|---|---|
private int |
collectValue(int attrPtr,
byte quoteByte,
PName attrName)
This method implements the tight loop for parsing attribute
values.
|
int |
decodeCharForError(byte b)
Method called called to decode a full UTF-8 characters, given
its first byte.
|
private int |
decodeMultiByteChar(int c,
int ptr) |
private int |
decodeUtf8_2(int c) |
private int |
decodeUtf8_3(int c1) |
private int |
decodeUtf8_3fast(int c1) |
private int |
decodeUtf8_4(int c) |
protected void |
finishCData() |
protected void |
finishCharacters() |
protected void |
finishCoalescedCData() |
protected void |
finishCoalescedCharacters() |
protected void |
finishCoalescedText()
Method that gets called after a primary text segment (of type
CHARACTERS or CDATA, not applicable to SPACE) has been read in
text buffer.
|
protected void |
finishComment() |
protected void |
finishDTD(boolean copyContents)
When this method gets called we know that we have an internal subset,
and that the opening '[' has already been read.
|
protected void |
finishPI() |
protected void |
finishSpace()
Note: this method is only called in cases where it is known
that only space chars are legal.
|
protected void |
finishToken()
This method is called to ensure that the current token/event has been
completely parsed, such that we have all the data needed to return
it (textual content, PI data, comment text etc)
|
protected int |
handleEntityInText(boolean inAttr)
Method called when an ampersand is encounter in text segment.
|
private void |
handleNsDeclaration(PName name,
byte quoteByte)
Method called from the main START_ELEMENT handling loop, to
parse namespace URI values.
|
protected int |
handleStartElement(byte b)
Parsing of start element requires parsing of the element name
(and attribute names), and is thus encoding-specific.
|
protected java.lang.String |
parsePublicId(byte quoteChar)
Parsing of public ids is bit more complicated than that of system
ids, since white space is to be coalesced.
|
protected java.lang.String |
parseSystemId(byte quoteChar) |
protected void |
reportInvalidOther(int mask,
int ptr) |
protected void |
skipCData() |
protected boolean |
skipCharacters() |
protected boolean |
skipCoalescedText()
Method that gets called after a primary text segment (of type
CHARACTERS or CDATA, not applicable to SPACE) has been skipped.
|
protected void |
skipComment() |
protected void |
skipPI() |
protected void |
skipSpace() |
private void |
skipUtf8_2(int c) |
private void |
skipUtf8_3(int c) |
private void |
skipUtf8_4(int c) |
private void |
skipUtf8_4Slow(int c) |
_closeSource, _nextEntity, _releaseBuffers, checkInTreeIndentation, checkPrologIndentation, handleCharEntity, handleEndElement, loadAndRetain, loadMore, loadOne, loadOne, nextByte, nextByte, nextFromProlog, nextFromTree, parsePName, parsePNameLong, parsePNameMedium, parsePNameSlow, skipInternalWsaddPName, addUtfPName, getCurrentColumnNr, getCurrentLocation, getEndingByteOffset, getEndingCharOffset, getStartingByteOffset, getStartingCharOffset, markLF, markLF, reportInvalidInitial, reportInvalidOther, setStartLocationbindName, bindNs, checkImmutableBinding, close, decodeAttrBinaryValue, decodeAttrValue, decodeAttrValues, decodeElements, findAttrIndex, findOrCreateBinding, fireSaxCharacterEvents, fireSaxCommentEvent, fireSaxEndElement, fireSaxPIEvent, fireSaxSpaceEvents, fireSaxStartElement, getAttrCollector, getAttrCount, getAttrLocalName, getAttrNsURI, getAttrPrefix, getAttrPrefixedName, getAttrQName, getAttrType, getAttrValue, getAttrValue, getConfig, getCurrentLineNr, getDepth, getDTDPublicId, getDTDSystemId, getEndLocation, getInputPublicId, getInputSystemId, getName, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getNonTransientNamespaceContext, getNsCount, getPrefix, getPrefixes, getQName, getStartLocation, getText, getText, getTextCharacters, getTextCharacters, getTextLength, handleInvalidXmlChar, hasEmptyStack, isAttrSpecified, isEmptyTag, isTextWhitespace, loadMoreGuaranteed, loadMoreGuaranteed, reportDoubleHyphenInComments, reportDuplicateNsDecl, reportEntityOverflow, reportEofInName, reportIllegalCDataEnd, reportIllegalNsDecl, reportIllegalNsDecl, reportInputProblem, reportInvalidNameChar, reportInvalidNsIndex, reportInvalidXmlChar, reportMissingPISpace, reportMultipleColonsInName, reportPrologProblem, reportPrologUnexpChar, reportTreeUnexpChar, reportUnboundPrefix, reportUnexpandedEntityInAttr, reportUnexpectedEndTag, resetForDecoding, skipToken, throwInvalidSpace, throwNullChar, throwUnexpectedChar, verifyXmlCharpublic Utf8Scanner(ReaderConfig cfg, java.io.InputStream in, byte[] buffer, int ptr, int last)
protected final void finishToken()
throws javax.xml.stream.XMLStreamException
XmlScannerfinishToken in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected int handleStartElement(byte b)
throws javax.xml.stream.XMLStreamException
StreamScannerhandleStartElement in class StreamScannerjavax.xml.stream.XMLStreamExceptionprivate final int collectValue(int attrPtr,
byte quoteByte,
PName attrName)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate void handleNsDeclaration(PName name, byte quoteByte) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected final int handleEntityInText(boolean inAttr)
throws javax.xml.stream.XMLStreamException
handleEntityInText in class StreamScannerinAttr - True, if reference is from attribute value; false
if from normal text contentjavax.xml.stream.XMLStreamExceptionprotected java.lang.String parsePublicId(byte quoteChar)
throws javax.xml.stream.XMLStreamException
parsePublicId in class StreamScannerjavax.xml.stream.XMLStreamExceptionprotected java.lang.String parseSystemId(byte quoteChar)
throws javax.xml.stream.XMLStreamException
parseSystemId in class StreamScannerjavax.xml.stream.XMLStreamExceptionprotected final boolean skipCharacters()
throws javax.xml.stream.XMLStreamException
skipCharacters in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void skipComment()
throws javax.xml.stream.XMLStreamException
skipComment in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void skipCData()
throws javax.xml.stream.XMLStreamException
skipCData in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void skipPI()
throws javax.xml.stream.XMLStreamException
skipPI in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void skipSpace()
throws javax.xml.stream.XMLStreamException
skipSpace in class XmlScannerjavax.xml.stream.XMLStreamExceptionprivate final void skipUtf8_2(int c)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate final void skipUtf8_3(int c)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate final void skipUtf8_4(int c)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate final void skipUtf8_4Slow(int c)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected final void finishCData()
throws javax.xml.stream.XMLStreamException
finishCData in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void finishCharacters()
throws javax.xml.stream.XMLStreamException
finishCharacters in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void finishComment()
throws javax.xml.stream.XMLStreamException
finishComment in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void finishDTD(boolean copyContents)
throws javax.xml.stream.XMLStreamException
finishDTD in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void finishPI()
throws javax.xml.stream.XMLStreamException
finishPI in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void finishSpace()
throws javax.xml.stream.XMLStreamException
finishSpace in class XmlScannerjavax.xml.stream.XMLStreamExceptionprotected final void finishCoalescedText()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected final void finishCoalescedCharacters()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected final void finishCoalescedCData()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected final boolean skipCoalescedText()
throws javax.xml.stream.XMLStreamException
skipCoalescedText in class XmlScannerjavax.xml.stream.XMLStreamExceptionprivate final int decodeMultiByteChar(int c,
int ptr)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate final int decodeUtf8_2(int c)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate final int decodeUtf8_3(int c1)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate final int decodeUtf8_3fast(int c1)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate final int decodeUtf8_4(int c)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int decodeCharForError(byte b)
throws javax.xml.stream.XMLStreamException
decodeCharForError in class ByteBasedScannerjavax.xml.stream.XMLStreamExceptionprotected void reportInvalidOther(int mask,
int ptr)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException