Class XmlTokenStream
- java.lang.Object
-
- com.fasterxml.jackson.dataformat.xml.deser.XmlTokenStream
-
public class XmlTokenStream extends java.lang.Object
Simple helper class used on top of STAXXMLStreamReader
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.
-
-
Field Summary
Fields Modifier and Type Field Description static int
XML_ATTRIBUTE_NAME
static int
XML_ATTRIBUTE_VALUE
static int
XML_END
static int
XML_END_ELEMENT
static int
XML_ROOT_TEXT
static int
XML_START_ELEMENT
static int
XML_TEXT
-
Constructor Summary
Constructors Constructor Description XmlTokenStream(javax.xml.stream.XMLStreamReader xmlReader, ContentReference sourceRef, int formatFeatures, XmlNameProcessor nameProcessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
closeCompletely()
JsonLocation
getCurrentLocation()
int
getCurrentToken()
java.lang.String
getLocalName()
Accessor for local name of current named event (that is,XML_START_ELEMENT
orXML_ATTRIBUTE_NAME
).java.lang.String
getNamespaceURI()
java.lang.String
getText()
JsonLocation
getTokenLocation()
org.codehaus.stax2.XMLStreamReader2
getXmlReader()
boolean
hasXsiNil()
int
initialize()
Second part of initialization, to be called immediately after constructionint
next()
void
skipEndElement()
-
-
-
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_ROOT_TEXT
public static final int XML_ROOT_TEXT
- See Also:
- Constant Field Values
-
XML_END
public static final int XML_END
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XmlTokenStream
public XmlTokenStream(javax.xml.stream.XMLStreamReader xmlReader, ContentReference sourceRef, int formatFeatures, XmlNameProcessor nameProcessor)
-
-
Method Detail
-
initialize
public int initialize() throws javax.xml.stream.XMLStreamException
Second part of initialization, to be called immediately after construction- Throws:
javax.xml.stream.XMLStreamException
- Since:
- 2.12
-
getXmlReader
public org.codehaus.stax2.XMLStreamReader2 getXmlReader()
-
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.IOException
javax.xml.stream.XMLStreamException
-
getCurrentToken
public int getCurrentToken()
-
getText
public java.lang.String getText()
-
getLocalName
public java.lang.String getLocalName()
Accessor for local name of current named event (that is,XML_START_ELEMENT
orXML_ATTRIBUTE_NAME
).NOTE: name NOT accessible on
XML_END_ELEMENT
-
getNamespaceURI
public java.lang.String getNamespaceURI()
-
hasXsiNil
public boolean hasXsiNil()
-
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 JsonLocation getCurrentLocation()
-
getTokenLocation
public JsonLocation getTokenLocation()
-
-