public class StAXDocumentParser extends Decoder implements javax.xml.stream.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_PROPERTY
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
BUFFER_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() |
javax.xml.stream.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, setVocabulary
protected 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)
Decoder
setInputStream
in class Decoder
s
- the InputStream where the fast infoset document is decoded from.public void reset()
Decoder
protected void resetOnError()
public Object getProperty(String name) throws IllegalArgumentException
getProperty
in interface javax.xml.stream.XMLStreamReader
IllegalArgumentException
public int next() throws javax.xml.stream.XMLStreamException
next
in interface javax.xml.stream.XMLStreamReader
javax.xml.stream.XMLStreamException
public final void require(int type, String namespaceURI, String localName) throws javax.xml.stream.XMLStreamException
require
in interface javax.xml.stream.XMLStreamReader
type
- the event typenamespaceURI
- the uri of the event, may be nulllocalName
- the localName of the event, may be nulljavax.xml.stream.XMLStreamException
- if the required values are not matched.public final String getElementText() throws javax.xml.stream.XMLStreamException
getElementText
in interface javax.xml.stream.XMLStreamReader
javax.xml.stream.XMLStreamException
- if the current event is not a START_ELEMENT or if
a non text element is encounteredpublic final String getElementText(boolean startElementRead) throws javax.xml.stream.XMLStreamException
startElementRead
- flag if start element has already been readjavax.xml.stream.XMLStreamException
public final int nextTag() throws javax.xml.stream.XMLStreamException
nextTag
in interface javax.xml.stream.XMLStreamReader
javax.xml.stream.XMLStreamException
- if the current event is not white spacepublic final int nextTag(boolean currentTagRead) throws javax.xml.stream.XMLStreamException
public final boolean hasNext() throws javax.xml.stream.XMLStreamException
hasNext
in interface javax.xml.stream.XMLStreamReader
javax.xml.stream.XMLStreamException
public void close() throws javax.xml.stream.XMLStreamException
close
in interface javax.xml.stream.XMLStreamReader
javax.xml.stream.XMLStreamException
public final String getNamespaceURI(String prefix)
getNamespaceURI
in interface javax.xml.stream.XMLStreamReader
public final boolean isStartElement()
isStartElement
in interface javax.xml.stream.XMLStreamReader
public final boolean isEndElement()
isEndElement
in interface javax.xml.stream.XMLStreamReader
public final boolean isCharacters()
isCharacters
in interface javax.xml.stream.XMLStreamReader
public final boolean isWhiteSpace()
isWhiteSpace
in interface javax.xml.stream.XMLStreamReader
public final String getAttributeValue(String namespaceURI, String localName)
getAttributeValue
in interface javax.xml.stream.XMLStreamReader
public final int getAttributeCount()
getAttributeCount
in interface javax.xml.stream.XMLStreamReader
public final QName getAttributeName(int index)
getAttributeName
in interface javax.xml.stream.XMLStreamReader
public final String getAttributeNamespace(int index)
getAttributeNamespace
in interface javax.xml.stream.XMLStreamReader
public final String getAttributeLocalName(int index)
getAttributeLocalName
in interface javax.xml.stream.XMLStreamReader
public final String getAttributePrefix(int index)
getAttributePrefix
in interface javax.xml.stream.XMLStreamReader
public final String getAttributeType(int index)
getAttributeType
in interface javax.xml.stream.XMLStreamReader
public final String getAttributeValue(int index)
getAttributeValue
in interface javax.xml.stream.XMLStreamReader
public final boolean isAttributeSpecified(int index)
isAttributeSpecified
in interface javax.xml.stream.XMLStreamReader
public final int getNamespaceCount()
getNamespaceCount
in interface javax.xml.stream.XMLStreamReader
public final String getNamespacePrefix(int index)
getNamespacePrefix
in interface javax.xml.stream.XMLStreamReader
public final String getNamespaceURI(int index)
getNamespaceURI
in interface javax.xml.stream.XMLStreamReader
public final NamespaceContext getNamespaceContext()
getNamespaceContext
in interface javax.xml.stream.XMLStreamReader
public final int getEventType()
getEventType
in interface javax.xml.stream.XMLStreamReader
public final String getText()
getText
in interface javax.xml.stream.XMLStreamReader
public final char[] getTextCharacters()
getTextCharacters
in interface javax.xml.stream.XMLStreamReader
public final int getTextStart()
getTextStart
in interface javax.xml.stream.XMLStreamReader
public final int getTextLength()
getTextLength
in interface javax.xml.stream.XMLStreamReader
public final int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws javax.xml.stream.XMLStreamException
getTextCharacters
in interface javax.xml.stream.XMLStreamReader
javax.xml.stream.XMLStreamException
protected final void checkTextState()
public final String getEncoding()
getEncoding
in interface javax.xml.stream.XMLStreamReader
public final boolean hasText()
hasText
in interface javax.xml.stream.XMLStreamReader
public final javax.xml.stream.Location getLocation()
getLocation
in interface javax.xml.stream.XMLStreamReader
public final QName getName()
getName
in interface javax.xml.stream.XMLStreamReader
public final String getLocalName()
getLocalName
in interface javax.xml.stream.XMLStreamReader
public final boolean hasName()
hasName
in interface javax.xml.stream.XMLStreamReader
public final String getNamespaceURI()
getNamespaceURI
in interface javax.xml.stream.XMLStreamReader
public final String getPrefix()
getPrefix
in interface javax.xml.stream.XMLStreamReader
public final String getVersion()
getVersion
in interface javax.xml.stream.XMLStreamReader
public final boolean isStandalone()
isStandalone
in interface javax.xml.stream.XMLStreamReader
public final boolean standaloneSet()
standaloneSet
in interface javax.xml.stream.XMLStreamReader
public final String getCharacterEncodingScheme()
getCharacterEncodingScheme
in interface javax.xml.stream.XMLStreamReader
public final String getPITarget()
getPITarget
in interface javax.xml.stream.XMLStreamReader
public final String getPIData()
getPIData
in interface javax.xml.stream.XMLStreamReader
public 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 javax.xml.stream.XMLStreamException
public final int peekNext() throws javax.xml.stream.XMLStreamException
FastInfosetStreamReader
peekNext
in interface FastInfosetStreamReader
#next
.javax.xml.stream.XMLStreamException
public void onBeforeOctetBufferOverwrite()
OctetBufferListener
onBeforeOctetBufferOverwrite
in interface OctetBufferListener
public final int accessNamespaceCount()
accessNamespaceCount
in interface FastInfosetStreamReader
public final String accessLocalName()
accessLocalName
in interface FastInfosetStreamReader
public final String accessNamespaceURI()
accessNamespaceURI
in interface FastInfosetStreamReader
public final String accessPrefix()
accessPrefix
in interface FastInfosetStreamReader
public final char[] accessTextCharacters()
FastInfosetStreamReader
accessTextCharacters
in interface FastInfosetStreamReader
public final int accessTextStart()
accessTextStart
in interface FastInfosetStreamReader
public final int accessTextLength()
accessTextLength
in interface FastInfosetStreamReader
protected final void processDII() throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void processDIIOptionalProperties(int b) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void resizeNamespaceAIIs()
protected final void processEIIWithNamespaces(boolean hasAttributes) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void processAIIs() throws FastInfosetException, IOException
FastInfosetException
IOException
protected final QualifiedName processEIIIndexMedium(int b) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final QualifiedName processEIIIndexLarge(int b) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final QualifiedName processLiteralQualifiedName(int state, QualifiedName q) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void processCommentII() throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void processProcessingII() throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void processUnexpandedEntityReference(int b) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void processCIIEncodingAlgorithm(boolean addToTable) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void processAIIEncodingAlgorithm(QualifiedName name, boolean addToTable) throws FastInfosetException, IOException
FastInfosetException
IOException
protected final void convertEncodingAlgorithmDataToCharacters() throws FastInfosetException, IOException
FastInfosetException
IOException
protected void convertBase64AlorithmDataToCharacters(StringBuffer buffer) throws EncodingAlgorithmException, IOException
public boolean isBase64Follows() throws IOException
IOException
public final Iterator getPrefixes()
public final AttributesHolder getAttributesHolder()
public final void setManager(StAXManager manager)
Copyright © 2019 Oracle Corpration. All Rights Reserved.