public class FromXmlParser
extends com.fasterxml.jackson.core.base.ParserMinimalBase
JsonParser
implementation that exposes XML structure as
set of JSON events that can be used for data binding.Modifier and Type | Class and Description |
---|---|
static class |
FromXmlParser.Feature
Enumeration that defines all togglable features for XML parsers.
|
Modifier and Type | Field and Description |
---|---|
protected byte[] |
_binaryValue
We will hold on to decoded binary data, for duration of
current event, so that multiple calls to
getBinaryValue(com.fasterxml.jackson.core.Base64Variant) will not need to decode data more
than once. |
protected com.fasterxml.jackson.core.util.ByteArrayBuilder |
_byteArrayBuilder
ByteArrayBuilder is needed if 'getBinaryValue' is called.
|
protected String |
_cfgNameForTextElement
In cases where a start element has both attributes and non-empty textual
value, we have to create a bogus property; we will use this as
the property name.
|
protected boolean |
_closed
Flag that indicates whether parser is closed or not.
|
protected String |
_currText |
protected int |
_formatFeatures
Bit flag composed of bits that indicate which
FromXmlParser.Feature s
are enabled. |
protected com.fasterxml.jackson.core.io.IOContext |
_ioContext |
protected boolean |
_mayBeLeaf
We need special handling to keep track of whether a value
may be exposed as simple leaf value.
|
protected boolean |
_nextIsLeadingMixed
Additional flag that is strictly needed when exposing "mixed" leading
String value as "anonymous" property/string pair.
|
protected com.fasterxml.jackson.core.JsonToken |
_nextToken |
protected BigInteger |
_numberBigInt |
protected int |
_numberInt |
protected long |
_numberLong |
protected int |
_numTypesValid
Bitfield that indicates which numeric representations
have been calculated for the current type
|
protected com.fasterxml.jackson.core.ObjectCodec |
_objectCodec |
protected XmlReadContext |
_parsingContext
Information about parser context, context in which
the next token is to be parsed (root, array, object).
|
protected XmlTokenStream |
_xmlTokens |
static String |
DEFAULT_UNNAMED_TEXT_PROPERTY
The default name placeholder for XML text segments is empty
String ("").
|
protected static com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> |
XML_READ_CAPABILITIES
XML format has some peculiarities, indicated via new (2.12) capability
system.
|
_currToken, _lastClearedToken, BD_MAX_INT, BD_MAX_LONG, BD_MIN_INT, BD_MIN_LONG, BI_MAX_INT, BI_MAX_LONG, BI_MIN_INT, BI_MIN_LONG, CHAR_NULL, INT_0, INT_9, INT_APOS, INT_ASTERISK, INT_BACKSLASH, INT_COLON, INT_COMMA, INT_CR, INT_e, INT_E, INT_HASH, INT_LBRACKET, INT_LCURLY, INT_LF, INT_MINUS, INT_PERIOD, INT_PLUS, INT_QUOTE, INT_RBRACKET, INT_RCURLY, INT_SLASH, INT_SPACE, INT_TAB, MAX_ERROR_TOKEN_LENGTH, MAX_INT_D, MAX_INT_L, MAX_LONG_D, MIN_INT_D, MIN_INT_L, MIN_LONG_D, NO_BYTES, NO_INTS, NR_BIGDECIMAL, NR_BIGINT, NR_DOUBLE, NR_FLOAT, NR_INT, NR_LONG, NR_UNKNOWN
Constructor and Description |
---|
FromXmlParser(com.fasterxml.jackson.core.io.IOContext ctxt,
int genericParserFeatures,
int xmlFeatures,
com.fasterxml.jackson.core.ObjectCodec codec,
XMLStreamReader xmlReader,
XmlNameProcessor tagProcessor) |
Modifier and Type | Method and Description |
---|---|
protected void |
_checkNumericValue(int expType) |
protected BigDecimal |
_convertNumberToBigDecimal() |
protected void |
_convertNumberToBigInteger() |
protected double |
_convertNumberToDouble() |
protected float |
_convertNumberToFloat() |
protected void |
_convertNumberToInt() |
protected void |
_convertNumberToLong() |
protected byte[] |
_decodeBase64(com.fasterxml.jackson.core.Base64Variant b64variant) |
protected com.fasterxml.jackson.core.util.ByteArrayBuilder |
_getByteArrayBuilder() |
protected void |
_handleEOF()
Method called when an EOF is encountered between tokens.
|
protected int |
_isIntNumber(String text) |
protected int |
_nextToken() |
protected void |
_releaseBuffers()
Method called to release internal buffers owned by the base
parser.
|
protected void |
_skipEndElement() |
void |
addVirtualWrapping(Set<String> namesToWrap)
Deprecated.
|
void |
addVirtualWrapping(Set<String> namesToWrap0,
boolean caseInsensitive)
Method that may be called to indicate that specified names
(only local parts retained currently: this may be changed in
future) should be considered "auto-wrapping", meaning that
they will be doubled to contain two opening elements, two
matching closing elements.
|
boolean |
canReadObjectId() |
boolean |
canReadTypeId() |
void |
close() |
FromXmlParser |
configure(FromXmlParser.Feature f,
boolean state) |
FromXmlParser |
disable(FromXmlParser.Feature f) |
FromXmlParser |
enable(FromXmlParser.Feature f) |
BigInteger |
getBigIntegerValue() |
byte[] |
getBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant) |
com.fasterxml.jackson.core.ObjectCodec |
getCodec() |
com.fasterxml.jackson.core.JsonLocation |
getCurrentLocation()
Method that returns location of the last processed character;
usually for error reporting purposes
|
String |
getCurrentName()
Method that can be called to get the name associated with
the current event.
|
BigDecimal |
getDecimalValue() |
double |
getDoubleValue() |
Object |
getEmbeddedObject() |
float |
getFloatValue() |
int |
getFormatFeatures() |
int |
getIntValue() |
long |
getLongValue() |
com.fasterxml.jackson.core.JsonParser.NumberType |
getNumberType() |
Number |
getNumberValue() |
XmlReadContext |
getParsingContext() |
com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> |
getReadCapabilities() |
XMLStreamReader |
getStaxReader()
Method that allows application direct access to underlying
Stax
XMLStreamWriter . |
String |
getText() |
int |
getText(Writer writer) |
char[] |
getTextCharacters() |
int |
getTextLength() |
int |
getTextOffset() |
com.fasterxml.jackson.core.JsonLocation |
getTokenLocation()
Method that return the starting location of the current
token; that is, position of the first character from input
that starts the current token.
|
boolean |
hasTextCharacters()
XML input actually would offer access to character arrays; but since
we must coalesce things it cannot really be exposed.
|
boolean |
isClosed() |
boolean |
isEnabled(FromXmlParser.Feature f) |
boolean |
isExpectedNumberIntToken()
Since xml representation can not really distinguish between different
scalar types (numbers, booleans) -- they are all just Character Data,
without schema -- we can try to infer type from intent here.
|
boolean |
isExpectedStartArrayToken()
Since xml representation can not really distinguish between array
and object starts (both are represented with elements), this method
is overridden and taken to mean that expecation is that the current
start element is to mean 'start array', instead of default of
'start object'.
|
boolean |
isNaN() |
String |
nextTextValue()
Method overridden to support more reliable deserialization of
String collections.
|
com.fasterxml.jackson.core.JsonToken |
nextToken() |
void |
overrideCurrentName(String name) |
com.fasterxml.jackson.core.JsonParser |
overrideFormatFeatures(int values,
int mask) |
boolean |
requiresCustomCodec()
XML format does require support from custom
ObjectCodec
(that is, XmlMapper ), so need to return true here. |
void |
setCodec(com.fasterxml.jackson.core.ObjectCodec c) |
void |
setXMLTextElementName(String name) |
com.fasterxml.jackson.core.Version |
version() |
_ascii, _asciiBytes, _constructError, _decodeBase64, _getCharDesc, _hasTextualNull, _longIntegerDesc, _longNumberDesc, _reportError, _reportError, _reportError, _reportInputCoercion, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportInvalidEOFInValue, _reportMissingRootWS, _reportUnexpectedChar, _reportUnexpectedNumberChar, _throwInternal, _throwInvalidSpace, _wrapError, clearCurrentToken, currentToken, currentTokenId, getCurrentToken, getCurrentTokenId, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, getValueAsString, getValueAsString, hasCurrentToken, hasToken, hasTokenId, isExpectedStartObjectToken, nextValue, reportInvalidNumber, reportOverflowInt, reportOverflowInt, reportOverflowInt, reportOverflowLong, reportOverflowLong, reportOverflowLong, reportUnexpectedNumberChar, skipChildren
_codec, _constructError, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _reportUnsupportedOperation, assignCurrentValue, canParseAsync, canUseSchema, configure, currentLocation, currentName, currentTokenLocation, currentValue, disable, enable, finishToken, getBinaryValue, getBooleanValue, getByteValue, getCurrentValue, getFeatureMask, getInputSource, getNonBlockingInputFeeder, getNumberValueExact, getObjectId, getSchema, getShortValue, getTypeId, getValueAsBoolean, getValueAsDouble, isEnabled, isEnabled, nextBooleanValue, nextFieldName, nextFieldName, nextIntValue, nextLongValue, overrideStdFeatures, readBinaryValue, readBinaryValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, releaseBuffered, setCurrentValue, setFeatureMask, setRequestPayloadOnError, setRequestPayloadOnError, setRequestPayloadOnError, setSchema
public static final String DEFAULT_UNNAMED_TEXT_PROPERTY
protected static final com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> XML_READ_CAPABILITIES
protected String _cfgNameForTextElement
Name used for pseudo-property used for returning XML Text value (which does not have actual element name to use). Defaults to empty String, but may be changed for inter-operability reasons: JAXB, for example, uses "value" as name.
protected int _formatFeatures
FromXmlParser.Feature
s
are enabled.protected com.fasterxml.jackson.core.ObjectCodec _objectCodec
protected boolean _closed
close()
) or when end-of-input is reached.protected final com.fasterxml.jackson.core.io.IOContext _ioContext
protected XmlReadContext _parsingContext
protected final XmlTokenStream _xmlTokens
protected boolean _mayBeLeaf
protected com.fasterxml.jackson.core.JsonToken _nextToken
protected String _currText
protected boolean _nextIsLeadingMixed
_nextToken
to be FIELD_NAME
and sets this flag to indicate use of "anonymous" marker.protected com.fasterxml.jackson.core.util.ByteArrayBuilder _byteArrayBuilder
protected byte[] _binaryValue
getBinaryValue(com.fasterxml.jackson.core.Base64Variant)
will not need to decode data more
than once.protected int _numTypesValid
protected int _numberInt
protected long _numberLong
protected BigInteger _numberBigInt
public FromXmlParser(com.fasterxml.jackson.core.io.IOContext ctxt, int genericParserFeatures, int xmlFeatures, com.fasterxml.jackson.core.ObjectCodec codec, XMLStreamReader xmlReader, XmlNameProcessor tagProcessor) throws IOException
IOException
public com.fasterxml.jackson.core.Version version()
version
in interface com.fasterxml.jackson.core.Versioned
version
in class com.fasterxml.jackson.core.JsonParser
public com.fasterxml.jackson.core.ObjectCodec getCodec()
getCodec
in class com.fasterxml.jackson.core.JsonParser
public void setCodec(com.fasterxml.jackson.core.ObjectCodec c)
setCodec
in class com.fasterxml.jackson.core.JsonParser
public void setXMLTextElementName(String name)
public boolean requiresCustomCodec()
ObjectCodec
(that is, XmlMapper
), so need to return true here.requiresCustomCodec
in class com.fasterxml.jackson.core.JsonParser
public boolean canReadObjectId()
canReadObjectId
in class com.fasterxml.jackson.core.JsonParser
public boolean canReadTypeId()
canReadTypeId
in class com.fasterxml.jackson.core.JsonParser
public com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> getReadCapabilities()
getReadCapabilities
in class com.fasterxml.jackson.core.JsonParser
public FromXmlParser enable(FromXmlParser.Feature f)
public FromXmlParser disable(FromXmlParser.Feature f)
public final boolean isEnabled(FromXmlParser.Feature f)
public FromXmlParser configure(FromXmlParser.Feature f, boolean state)
public int getFormatFeatures()
getFormatFeatures
in class com.fasterxml.jackson.core.JsonParser
public com.fasterxml.jackson.core.JsonParser overrideFormatFeatures(int values, int mask)
overrideFormatFeatures
in class com.fasterxml.jackson.core.JsonParser
public XMLStreamReader getStaxReader()
XMLStreamWriter
. Note that use of writer is
discouraged, and may interfere with processing of this writer;
however, occasionally it may be necessary.
Note: writer instance will always be of type
XMLStreamWriter2
(including
Typed Access API) so upcasts are safe.
public void addVirtualWrapping(Set<String> namesToWrap0, boolean caseInsensitive)
NOTE: this method is considered part of internal implementation interface, and it is NOT guaranteed to remain unchanged between minor versions (it is however expected not to change in patch versions). So if you have to use it, be prepared for possible additional work.
@Deprecated public void addVirtualWrapping(Set<String> namesToWrap)
public String getCurrentName() throws IOException
getCurrentName
in class com.fasterxml.jackson.core.base.ParserMinimalBase
IOException
public void overrideCurrentName(String name)
overrideCurrentName
in class com.fasterxml.jackson.core.base.ParserMinimalBase
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class com.fasterxml.jackson.core.base.ParserMinimalBase
IOException
public boolean isClosed()
isClosed
in class com.fasterxml.jackson.core.base.ParserMinimalBase
public XmlReadContext getParsingContext()
getParsingContext
in class com.fasterxml.jackson.core.base.ParserMinimalBase
public com.fasterxml.jackson.core.JsonLocation getTokenLocation()
getTokenLocation
in class com.fasterxml.jackson.core.JsonParser
public com.fasterxml.jackson.core.JsonLocation getCurrentLocation()
getCurrentLocation
in class com.fasterxml.jackson.core.JsonParser
public boolean isExpectedStartArrayToken()
isExpectedStartArrayToken
in class com.fasterxml.jackson.core.base.ParserMinimalBase
public boolean isExpectedNumberIntToken()
isExpectedNumberIntToken
in class com.fasterxml.jackson.core.base.ParserMinimalBase
public com.fasterxml.jackson.core.JsonToken nextToken() throws IOException
nextToken
in class com.fasterxml.jackson.core.base.ParserMinimalBase
IOException
public String nextTextValue() throws IOException
nextTextValue
in class com.fasterxml.jackson.core.JsonParser
IOException
public String getText() throws IOException
getText
in class com.fasterxml.jackson.core.base.ParserMinimalBase
IOException
public char[] getTextCharacters() throws IOException
getTextCharacters
in class com.fasterxml.jackson.core.base.ParserMinimalBase
IOException
public int getTextLength() throws IOException
getTextLength
in class com.fasterxml.jackson.core.base.ParserMinimalBase
IOException
public int getTextOffset() throws IOException
getTextOffset
in class com.fasterxml.jackson.core.base.ParserMinimalBase
IOException
public boolean hasTextCharacters()
hasTextCharacters
in class com.fasterxml.jackson.core.base.ParserMinimalBase
public int getText(Writer writer) throws IOException
getText
in class com.fasterxml.jackson.core.JsonParser
IOException
public Object getEmbeddedObject() throws IOException
getEmbeddedObject
in class com.fasterxml.jackson.core.JsonParser
IOException
public byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant) throws IOException
getBinaryValue
in class com.fasterxml.jackson.core.base.ParserMinimalBase
IOException
protected byte[] _decodeBase64(com.fasterxml.jackson.core.Base64Variant b64variant) throws IOException
IOException
public boolean isNaN()
isNaN
in class com.fasterxml.jackson.core.JsonParser
public com.fasterxml.jackson.core.JsonParser.NumberType getNumberType() throws IOException
getNumberType
in class com.fasterxml.jackson.core.JsonParser
IOException
public Number getNumberValue() throws IOException
getNumberValue
in class com.fasterxml.jackson.core.JsonParser
IOException
public int getIntValue() throws IOException
getIntValue
in class com.fasterxml.jackson.core.JsonParser
IOException
public long getLongValue() throws IOException
getLongValue
in class com.fasterxml.jackson.core.JsonParser
IOException
public BigInteger getBigIntegerValue() throws IOException
getBigIntegerValue
in class com.fasterxml.jackson.core.JsonParser
IOException
public float getFloatValue() throws IOException
getFloatValue
in class com.fasterxml.jackson.core.JsonParser
IOException
public double getDoubleValue() throws IOException
getDoubleValue
in class com.fasterxml.jackson.core.JsonParser
IOException
public BigDecimal getDecimalValue() throws IOException
getDecimalValue
in class com.fasterxml.jackson.core.JsonParser
IOException
protected final void _checkNumericValue(int expType) throws IOException
IOException
protected final int _isIntNumber(String text)
protected void _convertNumberToInt() throws IOException
IOException
protected void _convertNumberToLong() throws IOException
IOException
protected void _convertNumberToBigInteger() throws IOException
IOException
protected float _convertNumberToFloat() throws IOException
IOException
protected double _convertNumberToDouble() throws IOException
IOException
protected BigDecimal _convertNumberToBigDecimal() throws IOException
IOException
protected void _handleEOF() throws com.fasterxml.jackson.core.JsonParseException
_handleEOF
in class com.fasterxml.jackson.core.base.ParserMinimalBase
com.fasterxml.jackson.core.JsonParseException
protected void _releaseBuffers() throws IOException
IOException
protected com.fasterxml.jackson.core.util.ByteArrayBuilder _getByteArrayBuilder()
protected int _nextToken() throws IOException
IOException
protected void _skipEndElement() throws IOException
IOException
Copyright © 2022 FasterXML. All rights reserved.