Package com.fasterxml.aalto.stax
Class StreamReaderImpl
- java.lang.Object
-
- com.fasterxml.aalto.stax.StreamReaderImpl
-
- All Implemented Interfaces:
javax.xml.stream.XMLStreamConstants
,javax.xml.stream.XMLStreamReader
,org.codehaus.stax2.AttributeInfo
,org.codehaus.stax2.DTDInfo
,org.codehaus.stax2.LocationInfo
,org.codehaus.stax2.typed.TypedXMLStreamReader
,org.codehaus.stax2.validation.Validatable
,org.codehaus.stax2.XMLStreamReader2
- Direct Known Subclasses:
AsyncStreamReaderImpl
public class StreamReaderImpl extends java.lang.Object implements org.codehaus.stax2.XMLStreamReader2, org.codehaus.stax2.AttributeInfo, org.codehaus.stax2.DTDInfo, org.codehaus.stax2.LocationInfo
Basic backend-independentXMLStreamReader
implementation. While the read implements Stax API, most of real work is delegated to input (and thereby, encoding) specific backend implementations.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
_attrCount
If the current event isSTART_ELEMENT
, number of attributes the start element has.protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder
_base64Decoder
Lazily-constructed decoder object for decoding base64 encoded element binary content.protected boolean
_cfgCoalesceText
protected boolean
_cfgReportTextAsChars
protected PName
_currName
Prefixed name associated with the current event, if any.protected int
_currToken
protected org.codehaus.stax2.ri.typed.ValueDecoderFactory
_decoderFactory
Factory used for constructing decoders we need for typed accessprotected PName
_dtdRootName
Prefixed root-name DOCTYPE declaration gave us, if any (note: also serves as a marker to know if we have seen DOCTYPE yet)protected int
_parseState
Main parsing/tokenization state (STATE_xxx)protected XmlScanner
_scanner
Underlying XML scannerprivate static int
MASK_GET_ELEMENT_TEXT
private static int
MASK_GET_TEXT
Bitmask for determining if it's ok to call 'getText'private static int
MASK_GET_TEXT_WITH_WRITER
This mask is used with Stax2 getText() method (one that takes Writer as an argument): accepts even wider range of event types.private static int
MASK_GET_TEXT_XXX
Bitmask for determining if it's ok to call 'getTextXXX' methods (not including 'getText' itself)private static int
MASK_TYPED_ACCESS_ARRAY
private static int
MASK_TYPED_ACCESS_BINARY
(package private) static int
STATE_CLOSED
(package private) static int
STATE_EPILOG
(package private) static int
STATE_PROLOG
(package private) static int
STATE_TREE
-
Constructor Summary
Constructors Constructor Description StreamReaderImpl(XmlScanner scanner)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder
_base64Decoder()
protected void
_closeScanner(boolean forceStreamClose)
Method called to close scanner, by asking it to release resource it has, and potentially also close the underlying stream.private org.codehaus.stax2.typed.TypedXMLStreamException
_constructTypeException(java.lang.IllegalArgumentException iae, java.lang.String lexicalValue)
Method called to wrap or convert given conversion-fail exception into a fullTypedXMLStreamException
.private org.codehaus.stax2.typed.TypedXMLStreamException
_constructTypeException(java.lang.String msg, java.lang.String lexicalValue)
protected javax.xml.stream.XMLStreamException
_constructUnexpectedInTyped(int nextToken)
protected org.codehaus.stax2.ri.typed.ValueDecoderFactory
_decoderFactory()
private void
_handleEmptyValue(org.codehaus.stax2.typed.TypedValueDecoder dec)
Method called to handle value that has empty String as representation.protected void
_reportNonTextEvent(int type)
Helper method called whengetElementText()
(et al) method encounters a token type it should not, during text coalescingvoid
close()
Note: as per StAX 1.0 specs, this method does NOT close the underlying input reader.void
closeCompletely()
static StreamReaderImpl
construct(InputBootstrapper bs)
int
findAttributeIndex(java.lang.String nsURI, java.lang.String localName)
void
getAttributeAs(int index, org.codehaus.stax2.typed.TypedValueDecoder tvd)
int
getAttributeAsArray(int index, org.codehaus.stax2.typed.TypedArrayDecoder tad)
Method that allows reading contents of an attribute as an array of whitespace-separate tokens, decoded using specified decoder.byte[]
getAttributeAsBinary(int index)
byte[]
getAttributeAsBinary(int index, org.codehaus.stax2.typed.Base64Variant v)
boolean
getAttributeAsBoolean(int index)
java.math.BigDecimal
getAttributeAsDecimal(int index)
double
getAttributeAsDouble(int index)
double[]
getAttributeAsDoubleArray(int index)
float
getAttributeAsFloat(int index)
float[]
getAttributeAsFloatArray(int index)
int
getAttributeAsInt(int index)
int[]
getAttributeAsIntArray(int index)
java.math.BigInteger
getAttributeAsInteger(int index)
long
getAttributeAsLong(int index)
long[]
getAttributeAsLongArray(int index)
javax.xml.namespace.QName
getAttributeAsQName(int index)
int
getAttributeCount()
int
getAttributeIndex(java.lang.String namespaceURI, java.lang.String localName)
org.codehaus.stax2.AttributeInfo
getAttributeInfo()
java.lang.String
getAttributeLocalName(int index)
javax.xml.namespace.QName
getAttributeName(int index)
java.lang.String
getAttributeNamespace(int index)
java.lang.String
getAttributePrefix(int index)
java.lang.String
getAttributeType(int index)
java.lang.String
getAttributeValue(int index)
java.lang.String
getAttributeValue(java.lang.String nsURI, java.lang.String localName)
java.lang.String
getCharacterEncodingScheme()
As per Stax (1.0) specs, needs to return whatever xml declaration claimed encoding is, if any; or null if no xml declaration found.ReaderConfig
getConfig()
org.codehaus.stax2.XMLStreamLocation2
getCurrentLocation()
int
getDepth()
org.codehaus.stax2.DTDInfo
getDTDInfo()
Since this class implementsDTDInfo
, method can just returnthis
.java.lang.String
getDTDInternalSubset()
java.lang.String
getDTDPublicId()
java.lang.String
getDTDRootName()
java.lang.String
getDTDSystemId()
void
getElementAs(org.codehaus.stax2.typed.TypedValueDecoder tvd)
byte[]
getElementAsBinary()
byte[]
getElementAsBinary(org.codehaus.stax2.typed.Base64Variant v)
boolean
getElementAsBoolean()
java.math.BigDecimal
getElementAsDecimal()
double
getElementAsDouble()
float
getElementAsFloat()
int
getElementAsInt()
java.math.BigInteger
getElementAsInteger()
long
getElementAsLong()
javax.xml.namespace.QName
getElementAsQName()
java.lang.String
getElementText()
From StAX specs: Reads the content of a text-only element, an exception is thrown if this is not a text-only element.java.lang.String
getEncoding()
As per Stax (1.0) specs, needs to return whatever parser determined the encoding was, if it was able to figure it out.long
getEndingByteOffset()
long
getEndingCharOffset()
org.codehaus.stax2.XMLStreamLocation2
getEndLocation()
int
getEventType()
Returns type of the last event returned; or START_DOCUMENT before any events has been explicitly returned.java.lang.Object
getFeature(java.lang.String name)
Deprecated.int
getIdAttributeIndex()
protected javax.xml.stream.Location
getLastCharLocation()
java.lang.String
getLocalName()
javax.xml.stream.Location
getLocation()
org.codehaus.stax2.LocationInfo
getLocationInfo()
Location information is always accessible, for this reader.javax.xml.namespace.QName
getName()
javax.xml.namespace.NamespaceContext
getNamespaceContext()
int
getNamespaceCount()
java.lang.String
getNamespacePrefix(int index)
java.lang.String
getNamespaceURI()
java.lang.String
getNamespaceURI(int index)
java.lang.String
getNamespaceURI(java.lang.String prefix)
javax.xml.namespace.NamespaceContext
getNonTransientNamespaceContext()
int
getNotationAttributeIndex()
java.lang.String
getPIData()
java.lang.String
getPITarget()
java.lang.String
getPrefix()
java.lang.String
getPrefixedName()
java.lang.Object
getProcessedDTD()
Note: DTD-handling sub-classes need to override this method.org.codehaus.stax2.validation.DTDValidationSchema
getProcessedDTDSchema()
Sub-class will override this methodjava.lang.Object
getProperty(java.lang.String name)
XmlScanner
getScanner()
Should not really be public, but needed by SAX codelong
getStartingByteOffset()
long
getStartingCharOffset()
org.codehaus.stax2.XMLStreamLocation2
getStartLocation()
java.lang.String
getText()
int
getText(java.io.Writer w, boolean preserveContents)
Method similar togetText()
, except that it just uses provided Writer to write all textual content.char[]
getTextCharacters()
int
getTextCharacters(int srcStart, char[] target, int targetStart, int len)
int
getTextLength()
int
getTextStart()
java.lang.String
getVersion()
protected int
handlePrologEoi(boolean isProlog)
protected void
handleTreeEoi()
Method called when hitting an end-of-input within tree, after a valid tokenboolean
hasName()
boolean
hasNext()
boolean
hasText()
boolean
isAttributeSpecified(int index)
boolean
isCharacters()
boolean
isEmptyElement()
boolean
isEndElement()
boolean
isPropertySupported(java.lang.String name)
boolean
isStandalone()
boolean
isStartElement()
boolean
isWhiteSpace()
int
next()
int
nextTag()
int
readElementAsArray(org.codehaus.stax2.typed.TypedArrayDecoder dec)
int
readElementAsBinary(byte[] resultBuffer, int offset, int maxLength)
int
readElementAsBinary(byte[] resultBuffer, int offset, int maxLength, org.codehaus.stax2.typed.Base64Variant v)
int
readElementAsDoubleArray(double[] value, int from, int length)
int
readElementAsFloatArray(float[] value, int from, int length)
int
readElementAsIntArray(int[] value, int from, int length)
int
readElementAsLongArray(long[] value, int from, int length)
protected void
reportInvalidAttrIndex(int index)
void
require(int type, java.lang.String nsUri, java.lang.String localName)
void
setFeature(java.lang.String name, java.lang.Object value)
Deprecated.boolean
setProperty(java.lang.String name, java.lang.Object value)
org.codehaus.stax2.validation.ValidationProblemHandler
setValidationProblemHandler(org.codehaus.stax2.validation.ValidationProblemHandler h)
void
skipElement()
boolean
standaloneSet()
org.codehaus.stax2.validation.XMLValidator
stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
org.codehaus.stax2.validation.XMLValidator
stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidator validator)
protected void
throwFromIOE(java.io.IOException ioe)
private void
throwNotTextual(int type)
private void
throwNotTextXxx(int type)
protected void
throwUnexpectedEOI(java.lang.String msg)
protected void
throwWfe(java.lang.String msg)
Throws generic parse error with specified message and current parsing location.java.lang.String
toString()
org.codehaus.stax2.validation.XMLValidator
validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
protected javax.xml.namespace.QName
verifyQName(javax.xml.namespace.QName n)
-
-
-
Field Detail
-
STATE_PROLOG
static final int STATE_PROLOG
- See Also:
- Constant Field Values
-
STATE_TREE
static final int STATE_TREE
- See Also:
- Constant Field Values
-
STATE_EPILOG
static final int STATE_EPILOG
- See Also:
- Constant Field Values
-
STATE_CLOSED
static final int STATE_CLOSED
- See Also:
- Constant Field Values
-
_scanner
protected final XmlScanner _scanner
Underlying XML scanner
-
_cfgCoalesceText
protected final boolean _cfgCoalesceText
-
_cfgReportTextAsChars
protected final boolean _cfgReportTextAsChars
-
_currToken
protected int _currToken
-
_parseState
protected int _parseState
Main parsing/tokenization state (STATE_xxx)
-
_currName
protected PName _currName
Prefixed name associated with the current event, if any.
-
_attrCount
protected int _attrCount
If the current event isSTART_ELEMENT
, number of attributes the start element has. Otherwise undefined. Updated by reader, to make index checks for other attribute access methods simpler.
-
_decoderFactory
protected org.codehaus.stax2.ri.typed.ValueDecoderFactory _decoderFactory
Factory used for constructing decoders we need for typed access
-
_base64Decoder
protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder _base64Decoder
Lazily-constructed decoder object for decoding base64 encoded element binary content.
-
_dtdRootName
protected PName _dtdRootName
Prefixed root-name DOCTYPE declaration gave us, if any (note: also serves as a marker to know if we have seen DOCTYPE yet)
-
MASK_GET_TEXT
private static final int MASK_GET_TEXT
Bitmask for determining if it's ok to call 'getText'- See Also:
- Constant Field Values
-
MASK_GET_TEXT_XXX
private static final int MASK_GET_TEXT_XXX
Bitmask for determining if it's ok to call 'getTextXXX' methods (not including 'getText' itself)- See Also:
- Constant Field Values
-
MASK_GET_TEXT_WITH_WRITER
private static final int MASK_GET_TEXT_WITH_WRITER
This mask is used with Stax2 getText() method (one that takes Writer as an argument): accepts even wider range of event types.- See Also:
- Constant Field Values
-
MASK_GET_ELEMENT_TEXT
private static final int MASK_GET_ELEMENT_TEXT
- See Also:
- Constant Field Values
-
MASK_TYPED_ACCESS_ARRAY
private static final int MASK_TYPED_ACCESS_ARRAY
- See Also:
- Constant Field Values
-
MASK_TYPED_ACCESS_BINARY
private static final int MASK_TYPED_ACCESS_BINARY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StreamReaderImpl
public StreamReaderImpl(XmlScanner scanner)
-
-
Method Detail
-
construct
public static StreamReaderImpl construct(InputBootstrapper bs) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
getScanner
public XmlScanner getScanner()
Should not really be public, but needed by SAX code
-
getCharacterEncodingScheme
public final java.lang.String getCharacterEncodingScheme()
As per Stax (1.0) specs, needs to return whatever xml declaration claimed encoding is, if any; or null if no xml declaration found.Note: method name is rather confusing (compare to
getEncoding()
).- Specified by:
getCharacterEncodingScheme
in interfacejavax.xml.stream.XMLStreamReader
-
getEncoding
public final java.lang.String getEncoding()
As per Stax (1.0) specs, needs to return whatever parser determined the encoding was, if it was able to figure it out. If not (there are cases where this can not be found; specifically when being passed aReader
), it should return null.- Specified by:
getEncoding
in interfacejavax.xml.stream.XMLStreamReader
-
getVersion
public java.lang.String getVersion()
- Specified by:
getVersion
in interfacejavax.xml.stream.XMLStreamReader
-
isStandalone
public final boolean isStandalone()
- Specified by:
isStandalone
in interfacejavax.xml.stream.XMLStreamReader
-
standaloneSet
public final boolean standaloneSet()
- Specified by:
standaloneSet
in interfacejavax.xml.stream.XMLStreamReader
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
- Specified by:
getProperty
in interfacejavax.xml.stream.XMLStreamReader
-
getConfig
public ReaderConfig getConfig()
-
getAttributeCount
public final int getAttributeCount()
- Specified by:
getAttributeCount
in interfaceorg.codehaus.stax2.AttributeInfo
- Specified by:
getAttributeCount
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeLocalName
public final java.lang.String getAttributeLocalName(int index)
- Specified by:
getAttributeLocalName
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeName
public final javax.xml.namespace.QName getAttributeName(int index)
- Specified by:
getAttributeName
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeNamespace
public final java.lang.String getAttributeNamespace(int index)
- Specified by:
getAttributeNamespace
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributePrefix
public final java.lang.String getAttributePrefix(int index)
- Specified by:
getAttributePrefix
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeType
public final java.lang.String getAttributeType(int index)
- Specified by:
getAttributeType
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeValue
public final java.lang.String getAttributeValue(int index)
- Specified by:
getAttributeValue
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeValue
public final java.lang.String getAttributeValue(java.lang.String nsURI, java.lang.String localName)
- Specified by:
getAttributeValue
in interfacejavax.xml.stream.XMLStreamReader
-
getElementText
public final java.lang.String getElementText() throws javax.xml.stream.XMLStreamException
From StAX specs:Reads the content of a text-only element, an exception is thrown if this is not a text-only element. Regardless of value of javax.xml.stream.isCoalescing this method always returns coalesced content.
Precondition: the current event is START_ELEMENT.
Postcondition: the current event is the corresponding END_ELEMENT.- Specified by:
getElementText
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getEventType
public final int getEventType()
Returns type of the last event returned; or START_DOCUMENT before any events has been explicitly returned.- Specified by:
getEventType
in interfacejavax.xml.stream.XMLStreamReader
-
getLocalName
public final java.lang.String getLocalName()
- Specified by:
getLocalName
in interfacejavax.xml.stream.XMLStreamReader
-
getName
public final javax.xml.namespace.QName getName()
- Specified by:
getName
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceContext
public final javax.xml.namespace.NamespaceContext getNamespaceContext()
- Specified by:
getNamespaceContext
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceCount
public final int getNamespaceCount()
- Specified by:
getNamespaceCount
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespacePrefix
public final java.lang.String getNamespacePrefix(int index)
- Specified by:
getNamespacePrefix
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceURI
public final java.lang.String getNamespaceURI()
- Specified by:
getNamespaceURI
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceURI
public final java.lang.String getNamespaceURI(int index)
- Specified by:
getNamespaceURI
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceURI
public final java.lang.String getNamespaceURI(java.lang.String prefix)
- Specified by:
getNamespaceURI
in interfacejavax.xml.stream.XMLStreamReader
-
getPIData
public final java.lang.String getPIData()
- Specified by:
getPIData
in interfacejavax.xml.stream.XMLStreamReader
-
getPITarget
public final java.lang.String getPITarget()
- Specified by:
getPITarget
in interfacejavax.xml.stream.XMLStreamReader
-
getPrefix
public final java.lang.String getPrefix()
- Specified by:
getPrefix
in interfacejavax.xml.stream.XMLStreamReader
-
getText
public final java.lang.String getText()
- Specified by:
getText
in interfacejavax.xml.stream.XMLStreamReader
-
getTextCharacters
public final char[] getTextCharacters()
- Specified by:
getTextCharacters
in interfacejavax.xml.stream.XMLStreamReader
-
getTextCharacters
public final int getTextCharacters(int srcStart, char[] target, int targetStart, int len)
- Specified by:
getTextCharacters
in interfacejavax.xml.stream.XMLStreamReader
-
getTextLength
public final int getTextLength()
- Specified by:
getTextLength
in interfacejavax.xml.stream.XMLStreamReader
-
getTextStart
public final int getTextStart()
- Specified by:
getTextStart
in interfacejavax.xml.stream.XMLStreamReader
-
hasName
public final boolean hasName()
- Specified by:
hasName
in interfacejavax.xml.stream.XMLStreamReader
-
hasNext
public final boolean hasNext()
- Specified by:
hasNext
in interfacejavax.xml.stream.XMLStreamReader
-
hasText
public final boolean hasText()
- Specified by:
hasText
in interfacejavax.xml.stream.XMLStreamReader
-
isAttributeSpecified
public final boolean isAttributeSpecified(int index)
- Specified by:
isAttributeSpecified
in interfacejavax.xml.stream.XMLStreamReader
-
isCharacters
public final boolean isCharacters()
- Specified by:
isCharacters
in interfacejavax.xml.stream.XMLStreamReader
-
isEndElement
public final boolean isEndElement()
- Specified by:
isEndElement
in interfacejavax.xml.stream.XMLStreamReader
-
isStartElement
public final boolean isStartElement()
- Specified by:
isStartElement
in interfacejavax.xml.stream.XMLStreamReader
-
isWhiteSpace
public final boolean isWhiteSpace()
- Specified by:
isWhiteSpace
in interfacejavax.xml.stream.XMLStreamReader
-
require
public final void require(int type, java.lang.String nsUri, java.lang.String localName) throws javax.xml.stream.XMLStreamException
- Specified by:
require
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
next
public final int next() throws javax.xml.stream.XMLStreamException
- Specified by:
next
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
nextTag
public final int nextTag() throws javax.xml.stream.XMLStreamException
- Specified by:
nextTag
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
close
public final void close() throws javax.xml.stream.XMLStreamException
Note: as per StAX 1.0 specs, this method does NOT close the underlying input reader. (that is, unless the new StAX2 property
org.codehaus.stax2.XMLInputFactory2#P_AUTO_CLOSE_INPUT
is set to true).- Specified by:
close
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getLocation
public final javax.xml.stream.Location getLocation()
- Specified by:
getLocation
in interfaceorg.codehaus.stax2.LocationInfo
- Specified by:
getLocation
in interfacejavax.xml.stream.XMLStreamReader
-
getElementAsBoolean
public final boolean getElementAsBoolean() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsBoolean
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsInt
public final int getElementAsInt() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsInt
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsLong
public final long getElementAsLong() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsLong
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsFloat
public final float getElementAsFloat() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsFloat
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsDouble
public final double getElementAsDouble() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsDouble
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsInteger
public final java.math.BigInteger getElementAsInteger() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsInteger
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsDecimal
public final java.math.BigDecimal getElementAsDecimal() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsDecimal
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsQName
public final javax.xml.namespace.QName getElementAsQName() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsQName
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsBinary
public final byte[] getElementAsBinary() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsBinary
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAs
public final void getElementAs(org.codehaus.stax2.typed.TypedValueDecoder tvd) throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAs
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getElementAsBinary
public final byte[] getElementAsBinary(org.codehaus.stax2.typed.Base64Variant v) throws javax.xml.stream.XMLStreamException
- Specified by:
getElementAsBinary
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
readElementAsIntArray
public final int readElementAsIntArray(int[] value, int from, int length) throws javax.xml.stream.XMLStreamException
- Specified by:
readElementAsIntArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
readElementAsLongArray
public final int readElementAsLongArray(long[] value, int from, int length) throws javax.xml.stream.XMLStreamException
- Specified by:
readElementAsLongArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
readElementAsFloatArray
public final int readElementAsFloatArray(float[] value, int from, int length) throws javax.xml.stream.XMLStreamException
- Specified by:
readElementAsFloatArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
readElementAsDoubleArray
public final int readElementAsDoubleArray(double[] value, int from, int length) throws javax.xml.stream.XMLStreamException
- Specified by:
readElementAsDoubleArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
readElementAsArray
public final int readElementAsArray(org.codehaus.stax2.typed.TypedArrayDecoder dec) throws javax.xml.stream.XMLStreamException
- Specified by:
readElementAsArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
readElementAsBinary
public final int readElementAsBinary(byte[] resultBuffer, int offset, int maxLength) throws javax.xml.stream.XMLStreamException
- Specified by:
readElementAsBinary
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
readElementAsBinary
public final int readElementAsBinary(byte[] resultBuffer, int offset, int maxLength, org.codehaus.stax2.typed.Base64Variant v) throws javax.xml.stream.XMLStreamException
- Specified by:
readElementAsBinary
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeIndex
public final int getAttributeIndex(java.lang.String namespaceURI, java.lang.String localName)
- Specified by:
getAttributeIndex
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
-
getAttributeAsBoolean
public final boolean getAttributeAsBoolean(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsBoolean
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsInt
public final int getAttributeAsInt(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsInt
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsLong
public final long getAttributeAsLong(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsLong
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsFloat
public final float getAttributeAsFloat(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsFloat
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsDouble
public final double getAttributeAsDouble(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsDouble
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsInteger
public final java.math.BigInteger getAttributeAsInteger(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsInteger
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsDecimal
public final java.math.BigDecimal getAttributeAsDecimal(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsDecimal
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsQName
public final javax.xml.namespace.QName getAttributeAsQName(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsQName
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAs
public final void getAttributeAs(int index, org.codehaus.stax2.typed.TypedValueDecoder tvd) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAs
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsIntArray
public final int[] getAttributeAsIntArray(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsIntArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsLongArray
public final long[] getAttributeAsLongArray(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsLongArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsFloatArray
public final float[] getAttributeAsFloatArray(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsFloatArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsDoubleArray
public final double[] getAttributeAsDoubleArray(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsDoubleArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsArray
public final int getAttributeAsArray(int index, org.codehaus.stax2.typed.TypedArrayDecoder tad) throws javax.xml.stream.XMLStreamException
Method that allows reading contents of an attribute as an array of whitespace-separate tokens, decoded using specified decoder.- Specified by:
getAttributeAsArray
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Returns:
- Number of tokens decoded, 0 if none found
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsBinary
public final byte[] getAttributeAsBinary(int index) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsBinary
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeAsBinary
public final byte[] getAttributeAsBinary(int index, org.codehaus.stax2.typed.Base64Variant v) throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeAsBinary
in interfaceorg.codehaus.stax2.typed.TypedXMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
verifyQName
protected javax.xml.namespace.QName verifyQName(javax.xml.namespace.QName n) throws org.codehaus.stax2.typed.TypedXMLStreamException
- Throws:
org.codehaus.stax2.typed.TypedXMLStreamException
-
getFeature
@Deprecated public final java.lang.Object getFeature(java.lang.String name)
Deprecated.- Specified by:
getFeature
in interfaceorg.codehaus.stax2.XMLStreamReader2
-
setFeature
@Deprecated public final void setFeature(java.lang.String name, java.lang.Object value)
Deprecated.- Specified by:
setFeature
in interfaceorg.codehaus.stax2.XMLStreamReader2
-
isPropertySupported
public final boolean isPropertySupported(java.lang.String name)
- Specified by:
isPropertySupported
in interfaceorg.codehaus.stax2.XMLStreamReader2
-
setProperty
public final boolean setProperty(java.lang.String name, java.lang.Object value)
- Specified by:
setProperty
in interfaceorg.codehaus.stax2.XMLStreamReader2
- Parameters:
name
- Name of the property to setvalue
- Value to set property to.- Returns:
- True, if the specified property was succesfully set to specified value; false if its value was not changed
-
skipElement
public final void skipElement() throws javax.xml.stream.XMLStreamException
- Specified by:
skipElement
in interfaceorg.codehaus.stax2.XMLStreamReader2
- Throws:
javax.xml.stream.XMLStreamException
-
getAttributeInfo
public final org.codehaus.stax2.AttributeInfo getAttributeInfo() throws javax.xml.stream.XMLStreamException
- Specified by:
getAttributeInfo
in interfaceorg.codehaus.stax2.XMLStreamReader2
- Throws:
javax.xml.stream.XMLStreamException
-
getDTDInfo
public final org.codehaus.stax2.DTDInfo getDTDInfo() throws javax.xml.stream.XMLStreamException
Since this class implementsDTDInfo
, method can just returnthis
.- Specified by:
getDTDInfo
in interfaceorg.codehaus.stax2.XMLStreamReader2
- Throws:
javax.xml.stream.XMLStreamException
-
getLocationInfo
public final org.codehaus.stax2.LocationInfo getLocationInfo()
Location information is always accessible, for this reader.- Specified by:
getLocationInfo
in interfaceorg.codehaus.stax2.XMLStreamReader2
-
getText
public final int getText(java.io.Writer w, boolean preserveContents) throws javax.xml.stream.XMLStreamException
Method similar togetText()
, except that it just uses provided Writer to write all textual content. For further optimization, it may also be allowed to do true pass-through, thus possibly avoiding one temporary copy of the data.TODO: try to optimize to allow completely streaming pass-through: currently will still read all data in memory buffers before outputting
- Specified by:
getText
in interfaceorg.codehaus.stax2.XMLStreamReader2
- Parameters:
w
- Writer to use for writing textual contentspreserveContents
- If true, reader has to preserve contents so that further calls togetText
will return proper conntets. If false, reader is allowed to skip creation of such copies: this can improve performance, but it also means that further calls togetText
is not guaranteed to return meaningful data.- Returns:
- Number of characters written to the reader
- Throws:
javax.xml.stream.XMLStreamException
-
getDepth
public final int getDepth()
- Specified by:
getDepth
in interfaceorg.codehaus.stax2.XMLStreamReader2
- Returns:
- Number of open elements in the stack; 0 when parser is in prolog/epilog, 1 inside root element and so on.
-
isEmptyElement
public final boolean isEmptyElement() throws javax.xml.stream.XMLStreamException
- Specified by:
isEmptyElement
in interfaceorg.codehaus.stax2.XMLStreamReader2
- Returns:
- True, if cursor points to a start or end element that is constructed from 'empty' element (ends with '/>'); false otherwise.
- Throws:
javax.xml.stream.XMLStreamException
-
getNonTransientNamespaceContext
public final javax.xml.namespace.NamespaceContext getNonTransientNamespaceContext()
- Specified by:
getNonTransientNamespaceContext
in interfaceorg.codehaus.stax2.XMLStreamReader2
-
getPrefixedName
public final java.lang.String getPrefixedName()
- Specified by:
getPrefixedName
in interfaceorg.codehaus.stax2.XMLStreamReader2
-
closeCompletely
public final void closeCompletely() throws javax.xml.stream.XMLStreamException
- Specified by:
closeCompletely
in interfaceorg.codehaus.stax2.XMLStreamReader2
- Throws:
javax.xml.stream.XMLStreamException
-
getProcessedDTD
public final java.lang.Object getProcessedDTD()
Note: DTD-handling sub-classes need to override this method.
- Specified by:
getProcessedDTD
in interfaceorg.codehaus.stax2.DTDInfo
-
getDTDRootName
public final java.lang.String getDTDRootName()
- Specified by:
getDTDRootName
in interfaceorg.codehaus.stax2.DTDInfo
-
getDTDPublicId
public final java.lang.String getDTDPublicId()
- Specified by:
getDTDPublicId
in interfaceorg.codehaus.stax2.DTDInfo
-
getDTDSystemId
public final java.lang.String getDTDSystemId()
- Specified by:
getDTDSystemId
in interfaceorg.codehaus.stax2.DTDInfo
-
getDTDInternalSubset
public final java.lang.String getDTDInternalSubset()
- Specified by:
getDTDInternalSubset
in interfaceorg.codehaus.stax2.DTDInfo
- Returns:
- Internal subset portion of the DOCTYPE declaration, if any; empty String if none
-
getProcessedDTDSchema
public final org.codehaus.stax2.validation.DTDValidationSchema getProcessedDTDSchema()
Sub-class will override this method- Specified by:
getProcessedDTDSchema
in interfaceorg.codehaus.stax2.DTDInfo
-
getStartingByteOffset
public final long getStartingByteOffset()
- Specified by:
getStartingByteOffset
in interfaceorg.codehaus.stax2.LocationInfo
-
getStartingCharOffset
public final long getStartingCharOffset()
- Specified by:
getStartingCharOffset
in interfaceorg.codehaus.stax2.LocationInfo
-
getEndingByteOffset
public final long getEndingByteOffset() throws javax.xml.stream.XMLStreamException
- Specified by:
getEndingByteOffset
in interfaceorg.codehaus.stax2.LocationInfo
- Throws:
javax.xml.stream.XMLStreamException
-
getEndingCharOffset
public final long getEndingCharOffset() throws javax.xml.stream.XMLStreamException
- Specified by:
getEndingCharOffset
in interfaceorg.codehaus.stax2.LocationInfo
- Throws:
javax.xml.stream.XMLStreamException
-
getStartLocation
public final org.codehaus.stax2.XMLStreamLocation2 getStartLocation()
- Specified by:
getStartLocation
in interfaceorg.codehaus.stax2.LocationInfo
-
getEndLocation
public final org.codehaus.stax2.XMLStreamLocation2 getEndLocation() throws javax.xml.stream.XMLStreamException
- Specified by:
getEndLocation
in interfaceorg.codehaus.stax2.LocationInfo
- Throws:
javax.xml.stream.XMLStreamException
-
getCurrentLocation
public final org.codehaus.stax2.XMLStreamLocation2 getCurrentLocation()
- Specified by:
getCurrentLocation
in interfaceorg.codehaus.stax2.LocationInfo
-
findAttributeIndex
public final int findAttributeIndex(java.lang.String nsURI, java.lang.String localName)
- Specified by:
findAttributeIndex
in interfaceorg.codehaus.stax2.AttributeInfo
-
getIdAttributeIndex
public final int getIdAttributeIndex()
- Specified by:
getIdAttributeIndex
in interfaceorg.codehaus.stax2.AttributeInfo
-
getNotationAttributeIndex
public final int getNotationAttributeIndex()
- Specified by:
getNotationAttributeIndex
in interfaceorg.codehaus.stax2.AttributeInfo
-
validateAgainst
public final org.codehaus.stax2.validation.XMLValidator validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema) throws javax.xml.stream.XMLStreamException
- Specified by:
validateAgainst
in interfaceorg.codehaus.stax2.validation.Validatable
- Throws:
javax.xml.stream.XMLStreamException
-
stopValidatingAgainst
public final org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema) throws javax.xml.stream.XMLStreamException
- Specified by:
stopValidatingAgainst
in interfaceorg.codehaus.stax2.validation.Validatable
- Throws:
javax.xml.stream.XMLStreamException
-
stopValidatingAgainst
public final org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidator validator) throws javax.xml.stream.XMLStreamException
- Specified by:
stopValidatingAgainst
in interfaceorg.codehaus.stax2.validation.Validatable
- Throws:
javax.xml.stream.XMLStreamException
-
setValidationProblemHandler
public final org.codehaus.stax2.validation.ValidationProblemHandler setValidationProblemHandler(org.codehaus.stax2.validation.ValidationProblemHandler h)
- Specified by:
setValidationProblemHandler
in interfaceorg.codehaus.stax2.validation.Validatable
-
_reportNonTextEvent
protected void _reportNonTextEvent(int type) throws javax.xml.stream.XMLStreamException
Helper method called whengetElementText()
(et al) method encounters a token type it should not, during text coalescing- Throws:
javax.xml.stream.XMLStreamException
-
getLastCharLocation
protected javax.xml.stream.Location getLastCharLocation()
-
handlePrologEoi
protected int handlePrologEoi(boolean isProlog) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
handleTreeEoi
protected void handleTreeEoi() throws javax.xml.stream.XMLStreamException
Method called when hitting an end-of-input within tree, after a valid token- Throws:
javax.xml.stream.XMLStreamException
-
throwWfe
protected void throwWfe(java.lang.String msg) throws javax.xml.stream.XMLStreamException
Throws generic parse error with specified message and current parsing location.- Throws:
javax.xml.stream.XMLStreamException
-
throwNotTextual
private void throwNotTextual(int type)
-
throwNotTextXxx
private void throwNotTextXxx(int type)
-
throwFromIOE
protected void throwFromIOE(java.io.IOException ioe) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
throwUnexpectedEOI
protected void throwUnexpectedEOI(java.lang.String msg) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
_constructUnexpectedInTyped
protected javax.xml.stream.XMLStreamException _constructUnexpectedInTyped(int nextToken)
-
_constructTypeException
private org.codehaus.stax2.typed.TypedXMLStreamException _constructTypeException(java.lang.IllegalArgumentException iae, java.lang.String lexicalValue)
Method called to wrap or convert given conversion-fail exception into a fullTypedXMLStreamException
.- Parameters:
iae
- Problem as reported by converterlexicalValue
- Lexical value (element content, attribute value) that could not be converted succesfully.
-
_constructTypeException
private org.codehaus.stax2.typed.TypedXMLStreamException _constructTypeException(java.lang.String msg, java.lang.String lexicalValue)
-
reportInvalidAttrIndex
protected void reportInvalidAttrIndex(int index)
-
_closeScanner
protected void _closeScanner(boolean forceStreamClose) throws javax.xml.stream.XMLStreamException
Method called to close scanner, by asking it to release resource it has, and potentially also close the underlying stream.- Throws:
javax.xml.stream.XMLStreamException
-
_decoderFactory
protected final org.codehaus.stax2.ri.typed.ValueDecoderFactory _decoderFactory()
-
_base64Decoder
protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder _base64Decoder()
-
_handleEmptyValue
private void _handleEmptyValue(org.codehaus.stax2.typed.TypedValueDecoder dec) throws javax.xml.stream.XMLStreamException
Method called to handle value that has empty String as representation. This will usually either lead to an exception, or parsing to the default value for the type in question (null for nullable types and so on).- Throws:
javax.xml.stream.XMLStreamException
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-