public class StAXDocumentParser extends Decoder implements XMLStreamReader, FastInfosetStreamReader, OctetBufferListener
Instantiate this parser to parse a fast infoset document in accordance with the StAX API.
More than one fast infoset document may be decoded from the
InputStream.
| Modifier and Type | Class and Description |
|---|---|
protected class |
StAXDocumentParser.NamespaceContextImpl |
Decoder.EncodingAlgorithmInputStream| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
_algorithmData |
protected int |
_algorithmDataLength |
protected int |
_algorithmDataOffset |
protected int |
_algorithmId |
protected String |
_algorithmURI |
protected AttributesHolder |
_attributes
List of attributes
|
protected String |
_characterEncodingScheme |
protected char[] |
_characters
Characters associated with event.
|
protected int |
_charactersOffset |
protected boolean |
_clearAttributes |
protected int |
_currentNamespaceAIIsEnd |
protected int |
_currentNamespaceAIIsStart
Namespaces associated with START_ELEMENT or END_ELEMENT
|
protected int |
_eventType
Current event
|
protected int |
_internalState |
protected boolean |
_isAlgorithmDataCloned |
protected StAXManager |
_manager |
protected int[] |
_namespaceAIIsEndStack |
protected int |
_namespaceAIIsIndex |
protected String[] |
_namespaceAIIsNamespaceName |
protected String[] |
_namespaceAIIsPrefix |
protected int[] |
_namespaceAIIsPrefixIndex |
protected int[] |
_namespaceAIIsStartStack |
protected StAXDocumentParser.NamespaceContextImpl |
_nsContext |
protected String |
_piData |
protected String |
_piTarget
State for processing instruction
|
protected QualifiedName[] |
_qNameStack
Stack of qualified names and namespaces
|
protected QualifiedName |
_qualifiedName
Qualified name associated with START_ELEMENT or END_ELEMENT.
|
protected int |
_stackCount |
protected static int |
INTERNAL_STATE_DOUBLE_TERMINATE_ELEMENT |
protected static int |
INTERNAL_STATE_END_DOCUMENT |
protected static int |
INTERNAL_STATE_SINGLE_TERMINATE_ELEMENT_WITH_NAMESPACES |
protected static int |
INTERNAL_STATE_START_DOCUMENT |
protected static int |
INTERNAL_STATE_START_ELEMENT_TERMINATE |
protected static int |
INTERNAL_STATE_VOID |
_addToTable, _attributeNameTable, _attributeValueTable, _b, _bufferSize, _characterContentChunkTable, _charBuffer, _charBufferLength, _doubleTerminate, _duplicateAttributeVerifier, _elementNameTable, _identifier, _integer, _namespaceNameIndex, _needForceStreamClose, _notations, _octetBuffer, _octetBufferEnd, _octetBufferLength, _octetBufferOffset, _octetBufferStart, _parseFragments, _prefixIndex, _prefixTable, _registeredEncodingAlgorithms, _terminate, _unparsedEntities, _v, BUFFER_SIZE_SYSTEM_PROPERTY, NISTRING_EMPTY_STRING, NISTRING_ENCODING_ALGORITHM, NISTRING_INDEX, NISTRING_STRING, STRING_INTERNING_SYSTEM_PROPERTYATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENTBUFFER_SIZE_PROPERTY, EXTERNAL_VOCABULARIES_PROPERTY, FORCE_STREAM_CLOSE_PROPERTY, REGISTERED_ENCODING_ALGORITHMS_PROPERTY, STRING_INTERNING_PROPERTY| Constructor and Description |
|---|
StAXDocumentParser() |
StAXDocumentParser(InputStream s) |
StAXDocumentParser(InputStream s,
StAXManager manager) |
| Modifier and Type | Method and Description |
|---|---|
String |
accessLocalName() |
int |
accessNamespaceCount() |
String |
accessNamespaceURI() |
String |
accessPrefix() |
char[] |
accessTextCharacters()
Returns a cloned char[] representation of the internal char[] buffer.
|
int |
accessTextLength() |
int |
accessTextStart() |
protected void |
checkTextState() |
void |
close() |
protected void |
convertBase64AlorithmDataToCharacters(StringBuffer buffer) |
protected void |
convertEncodingAlgorithmDataToCharacters() |
int |
getAttributeCount() |
String |
getAttributeLocalName(int index) |
QName |
getAttributeName(int index) |
String |
getAttributeNamespace(int index) |
String |
getAttributeNameString(int index) |
String |
getAttributePrefix(int index) |
AttributesHolder |
getAttributesHolder() |
String |
getAttributeType(int index) |
String |
getAttributeValue(int index) |
String |
getAttributeValue(String namespaceURI,
String localName) |
String |
getCharacterEncodingScheme() |
String |
getElementText()
Reads the content of a text-only element.
|
String |
getElementText(boolean startElementRead) |
String |
getEncoding() |
int |
getEventType() |
String |
getLocalName() |
Location |
getLocation() |
QName |
getName() |
NamespaceContext |
getNamespaceContext() |
int |
getNamespaceCount() |
String |
getNamespaceDecl(String prefix) |
String |
getNamespacePrefix(int index) |
String |
getNamespaceURI() |
String |
getNamespaceURI(int index) |
String |
getNamespaceURI(String prefix) |
String |
getNameString() |
String |
getPIData() |
String |
getPITarget() |
String |
getPrefix() |
Iterator |
getPrefixes() |
Object |
getProperty(String name) |
String |
getText() |
byte[] |
getTextAlgorithmBytes()
Deprecated.
was deprecated due to security reasons. Now the method return cloned byte[].
|
int |
getTextAlgorithmBytes(int sourceStart,
byte[] target,
int targetStart,
int length) |
byte[] |
getTextAlgorithmBytesClone() |
int |
getTextAlgorithmIndex() |
int |
getTextAlgorithmLength() |
int |
getTextAlgorithmStart() |
String |
getTextAlgorithmURI() |
char[] |
getTextCharacters() |
int |
getTextCharacters(int sourceStart,
char[] target,
int targetStart,
int length) |
int |
getTextLength() |
int |
getTextStart() |
String |
getURI(String prefix) |
String |
getVersion() |
boolean |
hasName() |
boolean |
hasNext() |
boolean |
hasText() |
boolean |
hasTextAlgorithmBytes() |
boolean |
isAttributeSpecified(int index) |
boolean |
isBase64Follows() |
boolean |
isCharacters() |
boolean |
isEndElement() |
boolean |
isStandalone() |
boolean |
isStartElement() |
boolean |
isWhiteSpace()
Returns true if the cursor points to a character data event that consists of all whitespace
Application calling this method needs to cache the value and avoid calling this method again
for the same event.
|
int |
next() |
int |
nextTag()
Skips any white space (isWhiteSpace() returns true), COMMENT,
or PROCESSING_INSTRUCTION,
until a START_ELEMENT or END_ELEMENT is reached.
|
int |
nextTag(boolean currentTagRead)
if the current tag has already read, such as in the case EventReader's
peek() has been called, the current cursor should not move before the loop
|
void |
onBeforeOctetBufferOverwrite()
Callback method that will be called before the
(@link Decoder) octet buffer content is going to be changed.
|
int |
peekNext()
Peek at the next event.
|
protected void |
processAIIEncodingAlgorithm(QualifiedName name,
boolean addToTable) |
protected void |
processAIIs() |
protected void |
processCIIEncodingAlgorithm(boolean addToTable) |
protected void |
processCommentII() |
protected void |
processDII() |
protected void |
processDIIOptionalProperties(int b) |
protected void |
processEII(QualifiedName name,
boolean hasAttributes) |
protected QualifiedName |
processEIIIndexLarge(int b) |
protected QualifiedName |
processEIIIndexMedium(int b) |
protected void |
processEIIWithNamespaces(boolean hasAttributes) |
protected QualifiedName |
processLiteralQualifiedName(int state,
QualifiedName q) |
protected void |
processProcessingII() |
protected void |
processUnexpandedEntityReference(int b) |
void |
require(int type,
String namespaceURI,
String localName)
Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event.
|
void |
reset()
Reset the decoder for reuse decoding another XML infoset.
|
protected void |
resetOnError() |
protected void |
resizeNamespaceAIIs() |
void |
setInputStream(InputStream s)
Set the InputStream to decode the fast infoset document.
|
void |
setManager(StAXManager manager) |
boolean |
standaloneSet() |
_isFastInfosetDocument, closeIfRequired, createQualifiedNameString, createQualifiedNameString, decodeAdditionalData, decodeAlphabetOctetsAsCharBuffer, decodeCharacterEncodingScheme, decodeDII, decodeEIIIndexLarge, decodeEIIIndexMedium, decodeFourBitAlphabetOctetsAsCharBuffer, decodeHeader, decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName, decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix, decodeIdentifyingNonEmptyStringOnFirstBit, decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName, decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix, decodeInitialVocabulary, decodeIntegerIndexOnSecondBit, decodeLiteralQualifiedName, decodeNonEmptyOctetStringLengthOnSecondBit, decodeNonEmptyOctetStringOnSecondBitAsUtf8CharArray, decodeNonEmptyOctetStringOnSecondBitAsUtf8String, decodeNonIdentifyingStringOnFirstBit, decodeNotations, decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit, decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit, decodeRAOctetsAsString, decodeRestrictedAlphabetAsCharBuffer, decodeRestrictedAlphabetAsString, decodeUnparsedEntities, decodeUtf16StringAsCharBuffer, decodeUtf16StringAsString, decodeUtf8NCNameIntoCharBuffer, decodeUtf8StringAsCharBuffer, decodeUtf8StringAsCharBuffer, decodeUtf8StringAsString, decodeUtf8StringIntoCharBuffer, decodeUtf8StringIntoCharBuffer, decodeVersion, getBufferSize, getExternalVocabularies, getForceStreamClose, getParseFragments, getRegisteredEncodingAlgorithms, getStringInterning, isFastInfosetDocument, peek, peek, peek2, read, setBufferSize, setExternalVocabularies, setForceStreamClose, setParseFragments, setRegisteredEncodingAlgorithms, setStringInterning, setVocabularyprotected static final int INTERNAL_STATE_START_DOCUMENT
protected static final int INTERNAL_STATE_START_ELEMENT_TERMINATE
protected static final int INTERNAL_STATE_SINGLE_TERMINATE_ELEMENT_WITH_NAMESPACES
protected static final int INTERNAL_STATE_DOUBLE_TERMINATE_ELEMENT
protected static final int INTERNAL_STATE_END_DOCUMENT
protected static final int INTERNAL_STATE_VOID
protected int _internalState
protected int _eventType
protected QualifiedName[] _qNameStack
protected int[] _namespaceAIIsStartStack
protected int[] _namespaceAIIsEndStack
protected int _stackCount
protected String[] _namespaceAIIsPrefix
protected String[] _namespaceAIIsNamespaceName
protected int[] _namespaceAIIsPrefixIndex
protected int _namespaceAIIsIndex
protected int _currentNamespaceAIIsStart
protected int _currentNamespaceAIIsEnd
protected QualifiedName _qualifiedName
protected AttributesHolder _attributes
protected boolean _clearAttributes
protected char[] _characters
protected int _charactersOffset
protected String _algorithmURI
protected int _algorithmId
protected boolean _isAlgorithmDataCloned
protected byte[] _algorithmData
protected int _algorithmDataOffset
protected int _algorithmDataLength
protected String _piTarget
protected String _piData
protected StAXDocumentParser.NamespaceContextImpl _nsContext
protected String _characterEncodingScheme
protected StAXManager _manager
public StAXDocumentParser()
public StAXDocumentParser(InputStream s)
public StAXDocumentParser(InputStream s, StAXManager manager)
public void setInputStream(InputStream s)
DecodersetInputStream in class Decoders - the InputStream where the fast infoset document is decoded from.public void reset()
Decoderprotected void resetOnError()
public Object getProperty(String name) throws IllegalArgumentException
getProperty in interface XMLStreamReaderIllegalArgumentExceptionpublic int next()
throws XMLStreamException
next in interface XMLStreamReaderXMLStreamExceptionpublic final void require(int type,
String namespaceURI,
String localName)
throws XMLStreamException
require in interface XMLStreamReadertype - the event typenamespaceURI - the uri of the event, may be nulllocalName - the localName of the event, may be nullXMLStreamException - if the required values are not matched.public final String getElementText() throws XMLStreamException
getElementText in interface XMLStreamReaderXMLStreamException - if the current event is not a START_ELEMENT or if
a non text element is encounteredpublic final String getElementText(boolean startElementRead) throws XMLStreamException
startElementRead - flag if start element has already been readXMLStreamExceptionpublic final int nextTag()
throws XMLStreamException
nextTag in interface XMLStreamReaderXMLStreamException - if the current event is not white spacepublic final int nextTag(boolean currentTagRead)
throws XMLStreamException
XMLStreamExceptionpublic final boolean hasNext()
throws XMLStreamException
hasNext in interface XMLStreamReaderXMLStreamExceptionpublic void close()
throws XMLStreamException
close in interface XMLStreamReaderXMLStreamExceptionpublic final String getNamespaceURI(String prefix)
getNamespaceURI in interface XMLStreamReaderpublic final boolean isStartElement()
isStartElement in interface XMLStreamReaderpublic final boolean isEndElement()
isEndElement in interface XMLStreamReaderpublic final boolean isCharacters()
isCharacters in interface XMLStreamReaderpublic final boolean isWhiteSpace()
isWhiteSpace in interface XMLStreamReaderpublic final String getAttributeValue(String namespaceURI, String localName)
getAttributeValue in interface XMLStreamReaderpublic final int getAttributeCount()
getAttributeCount in interface XMLStreamReaderpublic final QName getAttributeName(int index)
getAttributeName in interface XMLStreamReaderpublic final String getAttributeNamespace(int index)
getAttributeNamespace in interface XMLStreamReaderpublic final String getAttributeLocalName(int index)
getAttributeLocalName in interface XMLStreamReaderpublic final String getAttributePrefix(int index)
getAttributePrefix in interface XMLStreamReaderpublic final String getAttributeType(int index)
getAttributeType in interface XMLStreamReaderpublic final String getAttributeValue(int index)
getAttributeValue in interface XMLStreamReaderpublic final boolean isAttributeSpecified(int index)
isAttributeSpecified in interface XMLStreamReaderpublic final int getNamespaceCount()
getNamespaceCount in interface XMLStreamReaderpublic final String getNamespacePrefix(int index)
getNamespacePrefix in interface XMLStreamReaderpublic final String getNamespaceURI(int index)
getNamespaceURI in interface XMLStreamReaderpublic final NamespaceContext getNamespaceContext()
getNamespaceContext in interface XMLStreamReaderpublic final int getEventType()
getEventType in interface XMLStreamReaderpublic final String getText()
getText in interface XMLStreamReaderpublic final char[] getTextCharacters()
getTextCharacters in interface XMLStreamReaderpublic final int getTextStart()
getTextStart in interface XMLStreamReaderpublic final int getTextLength()
getTextLength in interface XMLStreamReaderpublic final int getTextCharacters(int sourceStart,
char[] target,
int targetStart,
int length)
throws XMLStreamException
getTextCharacters in interface XMLStreamReaderXMLStreamExceptionprotected final void checkTextState()
public final String getEncoding()
getEncoding in interface XMLStreamReaderpublic final boolean hasText()
hasText in interface XMLStreamReaderpublic final Location getLocation()
getLocation in interface XMLStreamReaderpublic final QName getName()
getName in interface XMLStreamReaderpublic final String getLocalName()
getLocalName in interface XMLStreamReaderpublic final boolean hasName()
hasName in interface XMLStreamReaderpublic final String getNamespaceURI()
getNamespaceURI in interface XMLStreamReaderpublic final String getPrefix()
getPrefix in interface XMLStreamReaderpublic final String getVersion()
getVersion in interface XMLStreamReaderpublic final boolean isStandalone()
isStandalone in interface XMLStreamReaderpublic final boolean standaloneSet()
standaloneSet in interface XMLStreamReaderpublic final String getCharacterEncodingScheme()
getCharacterEncodingScheme in interface XMLStreamReaderpublic final String getPITarget()
getPITarget in interface XMLStreamReaderpublic final String getPIData()
getPIData in interface XMLStreamReaderpublic final String getNameString()
public final String getAttributeNameString(int index)
public final String getTextAlgorithmURI()
public final int getTextAlgorithmIndex()
public final boolean hasTextAlgorithmBytes()
public final byte[] getTextAlgorithmBytes()
public final byte[] getTextAlgorithmBytesClone()
public final int getTextAlgorithmStart()
public final int getTextAlgorithmLength()
public final int getTextAlgorithmBytes(int sourceStart,
byte[] target,
int targetStart,
int length)
throws XMLStreamException
XMLStreamExceptionpublic final int peekNext()
throws XMLStreamException
FastInfosetStreamReaderpeekNext in interface FastInfosetStreamReader#next.XMLStreamExceptionpublic void onBeforeOctetBufferOverwrite()
OctetBufferListeneronBeforeOctetBufferOverwrite in interface OctetBufferListenerpublic final int accessNamespaceCount()
accessNamespaceCount in interface FastInfosetStreamReaderpublic final String accessLocalName()
accessLocalName in interface FastInfosetStreamReaderpublic final String accessNamespaceURI()
accessNamespaceURI in interface FastInfosetStreamReaderpublic final String accessPrefix()
accessPrefix in interface FastInfosetStreamReaderpublic final char[] accessTextCharacters()
FastInfosetStreamReaderaccessTextCharacters in interface FastInfosetStreamReaderpublic final int accessTextStart()
accessTextStart in interface FastInfosetStreamReaderpublic final int accessTextLength()
accessTextLength in interface FastInfosetStreamReaderprotected final void processDII()
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected final void processDIIOptionalProperties(int b)
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected final void resizeNamespaceAIIs()
protected final void processEIIWithNamespaces(boolean hasAttributes)
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, IOException
FastInfosetExceptionIOExceptionprotected final void processAIIs()
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected final QualifiedName processEIIIndexMedium(int b) throws FastInfosetException, IOException
FastInfosetExceptionIOExceptionprotected final QualifiedName processEIIIndexLarge(int b) throws FastInfosetException, IOException
FastInfosetExceptionIOExceptionprotected final QualifiedName processLiteralQualifiedName(int state, QualifiedName q) throws FastInfosetException, IOException
FastInfosetExceptionIOExceptionprotected final void processCommentII()
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected final void processProcessingII()
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected final void processUnexpandedEntityReference(int b)
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected final void processCIIEncodingAlgorithm(boolean addToTable)
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected final void processAIIEncodingAlgorithm(QualifiedName name, boolean addToTable) throws FastInfosetException, IOException
FastInfosetExceptionIOExceptionprotected final void convertEncodingAlgorithmDataToCharacters()
throws FastInfosetException,
IOException
FastInfosetExceptionIOExceptionprotected void convertBase64AlorithmDataToCharacters(StringBuffer buffer) throws EncodingAlgorithmException, IOException
public boolean isBase64Follows()
throws IOException
IOExceptionpublic final Iterator getPrefixes()
public final AttributesHolder getAttributesHolder()
public final void setManager(StAXManager manager)
Copyright © 2005–2017 Oracle Corporation. All rights reserved.