public class StreamReaderBufferProcessor extends AbstractProcessor implements org.jvnet.staxex.XMLStreamReaderEx
XMLStreamBuffer
that reads the XML infoset as
XMLStreamReader
.
Because of XMLStreamReader
design, this processor always produce
a full document infoset, even if the buffer just contains a fragment.
When XMLStreamBuffer
contains a multiple tree (AKA "forest"),
XMLStreamReader
will behave as if there are multiple root elements
(so you'll see XMLStreamConstants.START_ELEMENT
event where you'd normally expect
XMLStreamConstants.END_DOCUMENT
.)
Modifier and Type | Field and Description |
---|---|
protected AttributesHolder |
_attributeCache
Holder of the attributes.
|
protected char[] |
_characters |
protected CharSequence |
_charSequence |
protected int |
_depth
The element depth that we are in.
|
protected int |
_eventType |
protected int |
_namespaceAIIsEnd |
protected String[] |
_namespaceAIIsNamespaceName |
protected String[] |
_namespaceAIIsPrefix
Namespace prefixes.
|
protected com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor.InternalNamespaceContext |
_nsCtx |
protected String |
_piData |
protected String |
_piTarget |
protected com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor.ElementStackEntry[] |
_stack |
protected com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor.ElementStackEntry |
_stackTop
The top-most active entry of the
_stack . |
protected int |
_textLen |
protected int |
_textOffset |
_buffer, _fragmentMode, _qNameBuffer, _stringInterningFeature, _treeCount, STATE_ATTRIBUTE_LN, STATE_ATTRIBUTE_LN_OBJECT, STATE_ATTRIBUTE_P_U_LN, STATE_ATTRIBUTE_P_U_LN_OBJECT, STATE_ATTRIBUTE_U_LN, STATE_ATTRIBUTE_U_LN_OBJECT, STATE_ATTRIBUTE_U_LN_QN, STATE_ATTRIBUTE_U_LN_QN_OBJECT, STATE_COMMENT_AS_CHAR_ARRAY_COPY, STATE_COMMENT_AS_CHAR_ARRAY_MEDIUM, STATE_COMMENT_AS_CHAR_ARRAY_SMALL, STATE_COMMENT_AS_STRING, STATE_DOCUMENT, STATE_DOCUMENT_FRAGMENT, STATE_ELEMENT_LN, STATE_ELEMENT_P_U_LN, STATE_ELEMENT_U_LN, STATE_ELEMENT_U_LN_QN, STATE_END, STATE_ILLEGAL, STATE_NAMESPACE_ATTRIBUTE, STATE_NAMESPACE_ATTRIBUTE_P, STATE_NAMESPACE_ATTRIBUTE_P_U, STATE_NAMESPACE_ATTRIBUTE_U, STATE_PROCESSING_INSTRUCTION, STATE_TEXT_AS_CHAR_ARRAY_COPY, STATE_TEXT_AS_CHAR_ARRAY_MEDIUM, STATE_TEXT_AS_CHAR_ARRAY_SMALL, STATE_TEXT_AS_OBJECT, STATE_TEXT_AS_STRING
_contentCharactersBuffer, _contentCharactersBufferPtr, _contentObjects, _contentObjectsPtr, _currentContentCharactersBufferFragment, _currentContentObjectFragment, _currentStructureFragment, _currentStructureStringFragment, _structure, _structurePtr, _structureStrings, _structureStringsPtr, CHAR_ARRAY_LENGTH_MEDIUM, CHAR_ARRAY_LENGTH_MEDIUM_SIZE, CHAR_ARRAY_LENGTH_SMALL, CHAR_ARRAY_LENGTH_SMALL_SIZE, CONTENT_TYPE_CHAR_ARRAY, CONTENT_TYPE_CHAR_ARRAY_COPY, CONTENT_TYPE_OBJECT, CONTENT_TYPE_STRING, FLAG_DOCUMENT_FRAGMENT, FLAG_PREFIX, FLAG_QUALIFIED_NAME, FLAG_URI, T_ATTRIBUTE, T_ATTRIBUTE_LN, T_ATTRIBUTE_LN_OBJECT, T_ATTRIBUTE_P_U_LN, T_ATTRIBUTE_P_U_LN_OBJECT, T_ATTRIBUTE_U_LN, T_ATTRIBUTE_U_LN_OBJECT, T_ATTRIBUTE_U_LN_QN, T_ATTRIBUTE_U_LN_QN_OBJECT, T_COMMENT, T_COMMENT_AS_CHAR_ARRAY, T_COMMENT_AS_CHAR_ARRAY_COPY, T_COMMENT_AS_CHAR_ARRAY_MEDIUM, T_COMMENT_AS_CHAR_ARRAY_SMALL, T_COMMENT_AS_STRING, T_DOCUMENT, T_DOCUMENT_FRAGMENT, T_ELEMENT, T_ELEMENT_LN, T_ELEMENT_P_U_LN, T_ELEMENT_U_LN, T_ELEMENT_U_LN_QN, T_END, T_END_OF_BUFFER, T_NAMESPACE_ATTRIBUTE, T_NAMESPACE_ATTRIBUTE_P, T_NAMESPACE_ATTRIBUTE_P_U, T_NAMESPACE_ATTRIBUTE_U, T_PROCESSING_INSTRUCTION, T_TEXT, T_TEXT_AS_CHAR_ARRAY, T_TEXT_AS_CHAR_ARRAY_COPY, T_TEXT_AS_CHAR_ARRAY_MEDIUM, T_TEXT_AS_CHAR_ARRAY_SMALL, T_TEXT_AS_OBJECT, T_TEXT_AS_STRING, T_UNEXPANDED_ENTITY_REFERENCE, TYPE_MASK, VALUE_TYPE_OBJECT, VALUE_TYPE_STRING
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
Constructor and Description |
---|
StreamReaderBufferProcessor() |
StreamReaderBufferProcessor(XMLStreamBuffer buffer) |
getAIIState, getEIIState, getNIIState, getPrefixFromQName, getQName, peekStructure, readContentCharactersBuffer, readContentCharactersCopy, readContentObject, readContentString, readEiiState, readStructure, readStructure16, readStructureString, setBuffer, setBuffer
protected com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor.ElementStackEntry[] _stack
protected com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor.ElementStackEntry _stackTop
_stack
.protected int _depth
protected String[] _namespaceAIIsPrefix
protected String[] _namespaceAIIsNamespaceName
protected int _namespaceAIIsEnd
protected com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor.InternalNamespaceContext _nsCtx
protected int _eventType
protected AttributesHolder _attributeCache
protected CharSequence _charSequence
protected char[] _characters
protected int _textOffset
protected int _textLen
protected String _piTarget
protected String _piData
public StreamReaderBufferProcessor()
public StreamReaderBufferProcessor(XMLStreamBuffer buffer) throws XMLStreamException
XMLStreamException
public void setXMLStreamBuffer(XMLStreamBuffer buffer) throws XMLStreamException
XMLStreamException
public XMLStreamBuffer nextTagAndMark() throws XMLStreamException
nextTag()
and if the parser moved to a new start tag,
returns a XMLStreamBufferMark
that captures the infoset starting
from the newly discovered element.
(Ideally we should have a method that works against the current position,
but the way the data structure is read makes this somewhat difficult.)
This creates a new XMLStreamBufferMark
that shares the underlying
data storage, thus it's fairly efficient.
XMLStreamException
public Object getProperty(String name)
getProperty
in interface XMLStreamReader
public int next() throws XMLStreamException
next
in interface XMLStreamReader
XMLStreamException
public final void require(int type, String namespaceURI, String localName) throws XMLStreamException
require
in interface XMLStreamReader
XMLStreamException
public final String getElementTextTrim() throws XMLStreamException
getElementTextTrim
in interface org.jvnet.staxex.XMLStreamReaderEx
XMLStreamException
public final String getElementText() throws XMLStreamException
getElementText
in interface XMLStreamReader
XMLStreamException
public final String getElementText(boolean startElementRead) throws XMLStreamException
XMLStreamException
public final int nextTag() throws XMLStreamException
nextTag
in interface XMLStreamReader
XMLStreamException
public final int nextTag(boolean currentTagRead) throws XMLStreamException
XMLStreamException
public final boolean hasNext()
hasNext
in interface XMLStreamReader
public void close() throws XMLStreamException
close
in interface XMLStreamReader
XMLStreamException
public final boolean isStartElement()
isStartElement
in interface XMLStreamReader
public final boolean isEndElement()
isEndElement
in interface XMLStreamReader
public final boolean isCharacters()
isCharacters
in interface XMLStreamReader
public final boolean isWhiteSpace()
isWhiteSpace
in interface XMLStreamReader
public final String getAttributeValue(String namespaceURI, String localName)
getAttributeValue
in interface XMLStreamReader
public final int getAttributeCount()
getAttributeCount
in interface XMLStreamReader
public final QName getAttributeName(int index)
getAttributeName
in interface XMLStreamReader
public final String getAttributeNamespace(int index)
getAttributeNamespace
in interface XMLStreamReader
public final String getAttributeLocalName(int index)
getAttributeLocalName
in interface XMLStreamReader
public final String getAttributePrefix(int index)
getAttributePrefix
in interface XMLStreamReader
public final String getAttributeType(int index)
getAttributeType
in interface XMLStreamReader
public final String getAttributeValue(int index)
getAttributeValue
in interface XMLStreamReader
public final boolean isAttributeSpecified(int index)
isAttributeSpecified
in interface XMLStreamReader
public final int getNamespaceCount()
getNamespaceCount
in interface XMLStreamReader
public final String getNamespacePrefix(int index)
getNamespacePrefix
in interface XMLStreamReader
public final String getNamespaceURI(int index)
getNamespaceURI
in interface XMLStreamReader
public final String getNamespaceURI(String prefix)
getNamespaceURI
in interface XMLStreamReader
public final org.jvnet.staxex.NamespaceContextEx getNamespaceContext()
getNamespaceContext
in interface XMLStreamReader
getNamespaceContext
in interface org.jvnet.staxex.XMLStreamReaderEx
public final int getEventType()
getEventType
in interface XMLStreamReader
public final String getText()
getText
in interface XMLStreamReader
public final char[] getTextCharacters()
getTextCharacters
in interface XMLStreamReader
public final int getTextStart()
getTextStart
in interface XMLStreamReader
public final int getTextLength()
getTextLength
in interface XMLStreamReader
public final int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException
getTextCharacters
in interface XMLStreamReader
XMLStreamException
public final CharSequence getPCDATA()
getPCDATA
in interface org.jvnet.staxex.XMLStreamReaderEx
public final String getEncoding()
getEncoding
in interface XMLStreamReader
public final boolean hasText()
hasText
in interface XMLStreamReader
public final Location getLocation()
getLocation
in interface XMLStreamReader
public final boolean hasName()
hasName
in interface XMLStreamReader
public final QName getName()
getName
in interface XMLStreamReader
public final String getLocalName()
getLocalName
in interface XMLStreamReader
public final String getNamespaceURI()
getNamespaceURI
in interface XMLStreamReader
public final String getPrefix()
getPrefix
in interface XMLStreamReader
public final String getVersion()
getVersion
in interface XMLStreamReader
public final boolean isStandalone()
isStandalone
in interface XMLStreamReader
public final boolean standaloneSet()
standaloneSet
in interface XMLStreamReader
public final String getCharacterEncodingScheme()
getCharacterEncodingScheme
in interface XMLStreamReader
public final String getPITarget()
getPITarget
in interface XMLStreamReader
public final String getPIData()
getPIData
in interface XMLStreamReader
Copyright © 2006–2022. All rights reserved.