XMLStreamReader to further
abstract out all irrelevant details, and to expose equivalent of flat token
stream with no "fluff" tokens (comments, processing instructions, mixed
content) all of which is just to simplify
actual higher-level conversion to JSON tokens.
Beyond initial idea there are also couple of other detours like ability to "replay" some tokens, add virtual wrappers (ironically to support "unwrapped" array values), and to unroll "Objects" into String values in some cases.
| Modifier and Type | Field and Description |
|---|---|
| protected int | |
| protected boolean | |
| protected boolean | |
| protected int | |
| protected ElementWrapper | _currentWrapper
Wrapping state, if any active (null if none) |
| protected int | _formatFeatures
Bit flag composed of bits that indicate which
|
| protected String | |
| protected XmlNameProcessor | |
| protected String | |
| protected XmlNameProcessor. | _nameToDecode
Reusable internal value object |
| protected int | _nextAttributeIndex
Index of the next attribute of the current START_ELEMENT to return (as field name and value pair), if any; -1 when no attributes to return |
| protected String | _nextLocalName
In cases where we need to 'inject' a virtual END_ELEMENT, we may also need to restore START_ELEMENT afterwards; if so, this is where names are held. |
| protected String | |
| protected boolean | _repeatCurrentToken
Marker flag set if caller wants to "push back" current token so
that next call to |
| protected int | _repeatElement
Flag used to indicate that given element should be "replayed". |
| protected final ContentReference | |
| protected boolean | _startElementAfterText
Flag set true if current event is |
| protected String | _textValue
Current text value for TEXT_VALUE returned |
| protected final XMLStreamReader2 | |
| protected boolean | _xsiNilFound
Marker used to indicate presence of `xsi:nil="true"' in current START_ELEMENT. |
| private static final int | |
| private static final int | |
| private static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public | XmlTokenStream(XMLStreamReader xmlReader, ContentReference sourceRef, int formatFeatures, XmlNameProcessor nameProcessor)
|
| Modifier and Type | Method and Description |
|---|---|
| protected static boolean | |
| private final void | |
| private final String | Returns: Collected text, if any, EXCEPT that ifFromXmlParser.Feature.EMPTY_ELEMENT_AS_NULL
AND empty element, returns null
|
| protected String | |
| protected void | |
| protected void | |
| private JsonLocation | |
| private final String | |
| private final int | |
| protected int | _handleRepeatElement()
Method called to handle details of repeating "virtual" start/end elements, needed for handling 'unwrapped' lists. |
| private final int | |
| private final int | |
| private final int | |
| protected String | |
| public void | |
| public void | |
| public JsonLocation | |
| public int | |
| public String | getLocalName()
Accessor for local name of current named event (that is,
|
| public String | |
| public String | |
| public JsonLocation | |
| public XMLStreamReader2 | |
| public boolean | |
| public int | |
| public int | |
| protected void | pushbackCurrentToken()
Method that can be called to ask stream to literally just return current token
with the next call to |
| protected void | repeatStartElement()
Method used to add virtual wrapping, which just duplicates START_ELEMENT stream points to, and its matching closing element. |
| protected void | |
| protected void | skipAttributes()
Method called to skip any attributes current START_ELEMENT may have, so that they are not returned as token. |
| public void |
| _attributeCount | back to summary |
|---|---|
| protected int _attributeCount | |
| _cfgProcessXsiNil | back to summary |
|---|---|
| protected boolean _cfgProcessXsiNil | |
| _cfgProcessXsiType | back to summary |
|---|---|
| protected boolean _cfgProcessXsiType | |
| _currentState | back to summary |
|---|---|
| protected int _currentState | |
| _currentWrapper | back to summary |
|---|---|
| protected ElementWrapper _currentWrapper Wrapping state, if any active (null if none) | |
| _formatFeatures | back to summary |
|---|---|
| protected int _formatFeatures Bit flag composed of bits that indicate which
| |
| _localName | back to summary |
|---|---|
| protected String _localName | |
| _nameProcessor | back to summary |
|---|---|
| protected XmlNameProcessor _nameProcessor | |
| _namespaceURI | back to summary |
|---|---|
| protected String _namespaceURI | |
| _nameToDecode | back to summary |
|---|---|
| protected XmlNameProcessor. Reusable internal value object
| |
| _nextAttributeIndex | back to summary |
|---|---|
| protected int _nextAttributeIndex Index of the next attribute of the current START_ELEMENT to return (as field name and value pair), if any; -1 when no attributes to return | |
| _nextLocalName | back to summary |
|---|---|
| protected String _nextLocalName In cases where we need to 'inject' a virtual END_ELEMENT, we may also need to restore START_ELEMENT afterwards; if so, this is where names are held. | |
| _nextNamespaceURI | back to summary |
|---|---|
| protected String _nextNamespaceURI | |
| _repeatCurrentToken | back to summary |
|---|---|
| protected boolean _repeatCurrentToken Marker flag set if caller wants to "push back" current token so
that next call to
| |
| _repeatElement | back to summary |
|---|---|
| protected int _repeatElement Flag used to indicate that given element should be "replayed". | |
| _sourceReference | back to summary |
|---|---|
| protected final ContentReference _sourceReference | |
| _startElementAfterText | back to summary |
|---|---|
| protected boolean _startElementAfterText Flag set true if current event is
| |
| _textValue | back to summary |
|---|---|
| protected String _textValue Current text value for TEXT_VALUE returned | |
| _xmlReader | back to summary |
|---|---|
| protected final XMLStreamReader2 _xmlReader | |
| _xsiNilFound | back to summary |
|---|---|
| protected boolean _xsiNilFound Marker used to indicate presence of `xsi:nil="true"' in current START_ELEMENT.
| |
| REPLAY_END | back to summary |
|---|---|
| private static final int REPLAY_END | |
| REPLAY_START_DELAYED | back to summary |
|---|---|
| private static final int REPLAY_START_DELAYED | |
| REPLAY_START_DUP | back to summary |
|---|---|
| private static final int REPLAY_START_DUP | |
| XML_ATTRIBUTE_NAME | back to summary |
|---|---|
| public static final int XML_ATTRIBUTE_NAME | |
| XML_ATTRIBUTE_VALUE | back to summary |
|---|---|
| public static final int XML_ATTRIBUTE_VALUE | |
| XML_END | back to summary |
|---|---|
| public static final int XML_END | |
| XML_END_ELEMENT | back to summary |
|---|---|
| public static final int XML_END_ELEMENT | |
| XML_ROOT_TEXT | back to summary |
|---|---|
| public static final int XML_ROOT_TEXT | |
| XML_START_ELEMENT | back to summary |
|---|---|
| public static final int XML_START_ELEMENT | |
| XML_TEXT | back to summary |
|---|---|
| public static final int XML_TEXT | |
| XSI_NAMESPACE | back to summary |
|---|---|
| private static final String XSI_NAMESPACE | |
| XmlTokenStream | back to summary |
|---|---|
| public XmlTokenStream(XMLStreamReader xmlReader, ContentReference sourceRef, int formatFeatures, XmlNameProcessor nameProcessor) | |
| _allWs | back to summary |
|---|---|
| protected static boolean _allWs(String str) | |
| _checkXsiAttributes | back to summary |
|---|---|
private final void _checkXsiAttributes()
| |
| _collectUntilTag | back to summary |
|---|---|
private final String _collectUntilTag() throws XMLStreamException
| |
| _currentStateDesc | back to summary |
|---|---|
| protected String _currentStateDesc() | |
| _decodeAttributeName | back to summary |
|---|---|
protected void _decodeAttributeName(String namespaceURI, String localName)
| |
| _decodeElementName | back to summary |
|---|---|
protected void _decodeElementName(String namespaceURI, String localName)
| |
| _extractLocation | back to summary |
|---|---|
| private JsonLocation _extractLocation(XMLStreamLocation2 location) | |
| _getText | back to summary |
|---|---|
| private final String _getText(XMLStreamReader2 r) throws XMLStreamException | |
| _handleEndElement | back to summary |
|---|---|
| private final int _handleEndElement() | |
| _handleRepeatElement | back to summary |
|---|---|
| protected int _handleRepeatElement() throws XMLStreamException Method called to handle details of repeating "virtual" start/end elements, needed for handling 'unwrapped' lists. | |
| _initStartElement | back to summary |
|---|---|
| private final int _initStartElement() throws XMLStreamException | |
| _next | back to summary |
|---|---|
| private final int _next() throws XMLStreamException | |
| _skipAndCollectTextUntilTag | back to summary |
|---|---|
| private final int _skipAndCollectTextUntilTag() throws XMLStreamException | |
| _stateDesc | back to summary |
|---|---|
| protected String _stateDesc(int state) | |
| close | back to summary |
|---|---|
| public void close() throws XMLStreamException | |
| closeCompletely | back to summary |
|---|---|
| public void closeCompletely() throws XMLStreamException | |
| getCurrentLocation | back to summary |
|---|---|
| public JsonLocation getCurrentLocation() | |
| getCurrentToken | back to summary |
|---|---|
| public int getCurrentToken() | |
| getLocalName | back to summary |
|---|---|
| public String getLocalName() Accessor for local name of current named event (that is,
Note name NOT accessible on | |
| getNamespaceURI | back to summary |
|---|---|
| public String getNamespaceURI() | |
| getText | back to summary |
|---|---|
| public String getText() | |
| getTokenLocation | back to summary |
|---|---|
| public JsonLocation getTokenLocation() | |
| getXmlReader | back to summary |
|---|---|
| public XMLStreamReader2 getXmlReader() | |
| hasXsiNil | back to summary |
|---|---|
| public boolean hasXsiNil() | |
| initialize | back to summary |
|---|---|
| public int initialize() throws XMLStreamException Second part of initialization, to be called immediately after construction
| |
| next | back to summary |
|---|---|
| public int next() throws XMLStreamException | |
| pushbackCurrentToken | back to summary |
|---|---|
| protected void pushbackCurrentToken() Method that can be called to ask stream to literally just return current token
with the next call to
| |
| repeatStartElement | back to summary |
|---|---|
| protected void repeatStartElement() Method used to add virtual wrapping, which just duplicates START_ELEMENT stream points to, and its matching closing element. | |
| setFormatFeatures | back to summary |
|---|---|
protected void setFormatFeatures(int f)
| |
| skipAttributes | back to summary |
|---|---|
| protected void skipAttributes() Method called to skip any attributes current START_ELEMENT may have, so that they are not returned as token.
| |
| skipEndElement | back to summary |
|---|---|
| public void skipEndElement() throws IOException, XMLStreamException | |