Class XmlTokenStream
- java.lang.Object
-
- com.fasterxml.jackson.dataformat.xml.deser.XmlTokenStream
-
public class XmlTokenStream extends java.lang.ObjectSimple helper class used on top of STAXXMLStreamReaderto 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
-
-
Field Summary
Fields Modifier and Type Field Description protected int_attributeCountprotected int_currentStateprotected com.fasterxml.jackson.dataformat.xml.deser.ElementWrapper_currentWrapperWrapping state, if any active (null if none)protected int_formatFeaturesBit flag composed of bits that indicate whichFromXmlParser.Features are enabled.protected java.lang.String_localNameprotected boolean_mixedTextIf true we have a START_ELEMENT with mixed textprotected java.lang.String_namespaceURIprotected int_nextAttributeIndexIndex of the next attribute of the current START_ELEMENT to return (as field name and value pair), if any; -1 when no attributes to returnprotected java.lang.String_nextLocalNameIn 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 java.lang.String_nextNamespaceURIprotected int_repeatElementFlag used to indicate that given element should be "replayed".protected java.lang.Object_sourceReferenceprotected java.lang.String_textValueprotected org.codehaus.stax2.XMLStreamReader2_xmlReaderstatic intXML_ATTRIBUTE_NAMEstatic intXML_ATTRIBUTE_VALUEstatic intXML_ENDstatic intXML_END_ELEMENTstatic intXML_START_ELEMENTstatic intXML_TEXT
-
Constructor Summary
Constructors Constructor Description XmlTokenStream(javax.xml.stream.XMLStreamReader xmlReader, java.lang.Object sourceRef, int formatFeatures)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean_allWs(java.lang.String str)protected int_handleRepeatElement()Method called to handle details of repeating "virtual" start/end elements, needed for handling 'unwrapped' lists.voidclose()voidcloseCompletely()protected java.lang.StringconvertToString()com.fasterxml.jackson.core.JsonLocationgetCurrentLocation()intgetCurrentToken()java.lang.StringgetLocalName()java.lang.StringgetNamespaceURI()java.lang.StringgetText()com.fasterxml.jackson.core.JsonLocationgetTokenLocation()org.codehaus.stax2.XMLStreamReader2getXmlReader()booleanhasAttributes()intnext()protected voidrepeatStartElement()Method used to add virtual wrapping, which just duplicates START_ELEMENT stream points to, and its matching closing element.protected voidsetFormatFeatures(int f)protected voidskipAttributes()Method called to skip any attributes current START_ELEMENT may have, so that they are not returned as token.voidskipEndElement()java.lang.StringtoString()
-
-
-
Field Detail
-
XML_START_ELEMENT
public static final int XML_START_ELEMENT
- See Also:
- Constant Field Values
-
XML_END_ELEMENT
public static final int XML_END_ELEMENT
- See Also:
- Constant Field Values
-
XML_ATTRIBUTE_NAME
public static final int XML_ATTRIBUTE_NAME
- See Also:
- Constant Field Values
-
XML_ATTRIBUTE_VALUE
public static final int XML_ATTRIBUTE_VALUE
- See Also:
- Constant Field Values
-
XML_TEXT
public static final int XML_TEXT
- See Also:
- Constant Field Values
-
XML_END
public static final int XML_END
- See Also:
- Constant Field Values
-
_xmlReader
protected final org.codehaus.stax2.XMLStreamReader2 _xmlReader
-
_sourceReference
protected final java.lang.Object _sourceReference
-
_formatFeatures
protected int _formatFeatures
Bit flag composed of bits that indicate whichFromXmlParser.Features are enabled.
-
_currentState
protected int _currentState
-
_attributeCount
protected int _attributeCount
-
_mixedText
protected boolean _mixedText
If true we have a START_ELEMENT with mixed text- Since:
- 2.8
-
_nextAttributeIndex
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
-
_localName
protected java.lang.String _localName
-
_namespaceURI
protected java.lang.String _namespaceURI
-
_textValue
protected java.lang.String _textValue
-
_repeatElement
protected int _repeatElement
Flag used to indicate that given element should be "replayed".
-
_currentWrapper
protected com.fasterxml.jackson.dataformat.xml.deser.ElementWrapper _currentWrapper
Wrapping state, if any active (null if none)
-
_nextLocalName
protected java.lang.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
protected java.lang.String _nextNamespaceURI
-
-
Method Detail
-
getXmlReader
public org.codehaus.stax2.XMLStreamReader2 getXmlReader()
-
setFormatFeatures
protected void setFormatFeatures(int f)
- Since:
- 2.9
-
next
public int next() throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
skipEndElement
public void skipEndElement() throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
getCurrentToken
public int getCurrentToken()
-
getText
public java.lang.String getText()
-
getLocalName
public java.lang.String getLocalName()
-
getNamespaceURI
public java.lang.String getNamespaceURI()
-
hasAttributes
public boolean hasAttributes()
-
closeCompletely
public void closeCompletely() throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
close
public void close() throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
getCurrentLocation
public com.fasterxml.jackson.core.JsonLocation getCurrentLocation()
-
getTokenLocation
public com.fasterxml.jackson.core.JsonLocation getTokenLocation()
-
repeatStartElement
protected void repeatStartElement()
Method used to add virtual wrapping, which just duplicates START_ELEMENT stream points to, and its matching closing element.- Since:
- 2.1
-
skipAttributes
protected void skipAttributes()
Method called to skip any attributes current START_ELEMENT may have, so that they are not returned as token.- Since:
- 2.1
-
convertToString
protected java.lang.String convertToString() throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
_handleRepeatElement
protected int _handleRepeatElement() throws javax.xml.stream.XMLStreamExceptionMethod called to handle details of repeating "virtual" start/end elements, needed for handling 'unwrapped' lists.- Throws:
javax.xml.stream.XMLStreamException
-
_allWs
protected boolean _allWs(java.lang.String str)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-