Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.xml.util

public Class Stax2JacksonReaderAdapter

extends Stax2ReaderAdapter
Class Inheritance
Imports
javax.xml.stream.XMLStreamException, .XMLStreamReader, org.codehaus.stax2.XMLStreamReader2, org.codehaus.stax2.ri.Stax2ReaderAdapter, com.fasterxml.jackson.databind.util.ClassUtil

Refinement of Stax2ReaderAdapter to override certain methods, to patch over flaws of JDK-provided default Stax implementation, SJSXP
Since
2.17

Field Summary

Modifier and TypeField and Description
private final XMLStreamReader
Inherited from org.codehaus.stax2.ri.Stax2ReaderAdapter:
_base64Decoder_decoderFactory_depth_typedContentMASK_TYPED_ACCESS_BINARY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
next()

Overrides org.codehaus.stax2.ri.Stax2ReaderAdapter.next.

Implements javax.xml.stream.XMLStreamReader.next.

Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks.

public static XMLStreamReader2
wrapIfNecessary(XMLStreamReader sr)

Hides org.codehaus.stax2.ri.Stax2ReaderAdapter.wrapIfNecessary.

Method that should be used to add dynamic support for XMLStreamReader2.

Inherited from org.codehaus.stax2.ri.Stax2ReaderAdapter:
_base64Decoder_constructTypeException_constructTypeException_decoderFactory_getAttributeAsArraycloseCompletelyfindAttributeIndexgetAttributeAsgetAttributeAsArraygetAttributeAsBinarygetAttributeAsBinarygetAttributeAsBooleangetAttributeAsDecimalgetAttributeAsDoublegetAttributeAsDoubleArraygetAttributeAsFloatgetAttributeAsFloatArraygetAttributeAsIntgetAttributeAsIntArraygetAttributeAsIntegergetAttributeAsLonggetAttributeAsLongArraygetAttributeAsQNamegetAttributeIndexgetAttributeInfogetCurrentLocationgetDepthgetDTDInfogetDTDInternalSubsetgetDTDPublicIdgetDTDRootNamegetDTDSystemIdgetElementAsgetElementAsBinarygetElementAsBinarygetElementAsBooleangetElementAsDecimalgetElementAsDoublegetElementAsFloatgetElementAsIntgetElementAsIntegergetElementAsLonggetElementAsQNamegetElementTextgetEndingByteOffsetgetEndingCharOffsetgetEndLocationgetFeaturegetIdAttributeIndexgetLocationInfogetNonTransientNamespaceContextgetNotationAttributeIndexgetPrefixedNamegetProcessedDTDgetProcessedDTDSchemagetStartingByteOffsetgetStartingCharOffsetgetStartLocationgetTextisEmptyElementisPropertySupportedreadElementAsArrayreadElementAsBinaryreadElementAsBinaryreadElementAsDoubleArrayreadElementAsFloatArrayreadElementAsIntArrayreadElementAsLongArraysetFeaturesetPropertysetValidationProblemHandlerskipElementstopValidatingAgainststopValidatingAgainstthrowNotStartElemthrowNotStartElemOrTextualthrowUnsupportedvalidateAgainst

Field Detail

_delegateback to summary
private final XMLStreamReader _delegate

Constructor Detail

Stax2JacksonReaderAdapterback to summary
public Stax2JacksonReaderAdapter(XMLStreamReader sr)

Method Detail

nextback to summary
public int next() throws XMLStreamException

Overrides org.codehaus.stax2.ri.Stax2ReaderAdapter.next.

Implements javax.xml.stream.XMLStreamReader.next.

Doc from javax.xml.stream.XMLStreamReader.next.

Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks. If the property javax.xml.stream.isCoalescing is set to true element content must be coalesced and only one CHARACTERS event must be returned for contiguous element content or CDATA Sections. By default entity references must be expanded and reported transparently to the application. An exception will be thrown if an entity reference cannot be expanded. If element content is empty (i.e. content is "") then no CHARACTERS event will be reported.

Given the following XML:
<foo><!--description-->content text<![CDATA[<greeting>Hello>/greeting>]]>other content>/foo>
The behavior of calling next() when being on foo will be:
1- the comment (COMMENT)
2- then the characters section (CHARACTERS)
3- then the CDATA section (another CHARACTERS)
4- then the next characters section (another CHARACTERS)
5- then the END_ELEMENT

Note

empty element (such as <tag/>) will be reported with two separate events: START_ELEMENT, END_ELEMENT - This preserves parsing equivalency of empty element to <tag></tag>.

Returns:int

the integer code corresponding to the current parse event

Annotations
@Override
Exceptions
XMLStreamException:
if there is an error processing the underlying XML source
wrapIfNecessaryback to summary
public static XMLStreamReader2 wrapIfNecessary(XMLStreamReader sr)

Hides org.codehaus.stax2.ri.Stax2ReaderAdapter.wrapIfNecessary.

Doc from org.codehaus.stax2.ri.Stax2ReaderAdapter.wrapIfNecessary.

Method that should be used to add dynamic support for XMLStreamReader2. Method will check whether the stream reader passed happens to be a XMLStreamReader2; and if it is, return it properly cast. If not, it will create necessary wrapper.