Class DOMWrappingReader
- All Implemented Interfaces:
NamespaceContext, XMLStreamConstants, XMLStreamReader, AttributeInfo, DTDInfo, LocationInfo, TypedXMLStreamReader, Validatable, XMLStreamReader2
XMLStreamReader. This is mostly useful for
inter-operability purposes, and should only be used when the
input has to come as a DOM object and the original xml content
is not available as a stream.
Note that the implementation is only to be used for use with
javax.xml.transform.dom.DOMSource. It can however be
used for both full documents, and single element root fragments,
depending on what node is passed as the argument.
Some notes regarding missing/incomplete functionality:
- DOM does not seem to have access to information from the XML declaration (although Document node can be viewed as representing it). Consequently, all accessors return no information (version, encoding, standalone).
- No location info is provided, since (you guessed it!) DOM does not provide that info.
-
Field Summary
FieldsModifier and TypeFieldDescriptionLazily instantiated List of all actual attributes for the current (start) element, NOT including namespace declarations.protected StringBase64DecoderLazily-constructed decoder object for decoding base64 encoded binary content.protected booleanBy default we do not force interning of names: can be reset by sub-classes.protected booleanBy default we do not force interning of namespace URIs: can be reset by sub-classes.protected final booleanWhether stream reader is to be namespace aware (as per propertyXMLInputFactory.IS_NAMESPACE_AWARE) or notprotected StringIn coalescing mode, we may need to combine textual content from multiple adjacent nodes.protected final booleanWhether stream reader is to coalesce adjacent textual (CHARACTERS, SPACE, CDATA) events (as per propertyXMLInputFactory.IS_COALESCING) or notprotected intprotected NodeCurrent node is the DOM node that contains information regarding the current event.protected ValueDecoderFactoryFactory used for constructing decoders we need for typed accessprotected intLazily instantiated String pairs of all namespace declarations for the current (start/end) element.protected final Nodeprotected final Stringprotected Stax2Util.TextBufferHelper object used for combining segments of text as neededprotected static final intprotected static final intCurrent state not START_ELEMENT or END_ELEMENT, should beprotected static final intCurrent state not PROCESSING_INSTRUCTIONprotected static final intCurrent state not START_ELEMENT, should beprotected static final intCurrent state not one where getText() can be usedprotected static final intprotected static final intCurrent state not one where getTextXxx() can be usedprotected static final intprotected static final intFields inherited from interface XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENTFields inherited from interface XMLStreamReader2
FEATURE_DTD_OVERRIDE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDOMWrappingReader(DOMSource src, boolean nsAware, boolean coalescing) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringBase64Decoderprotected TypedXMLStreamException_constructTypeException(IllegalArgumentException iae, String lexicalValue) Method called to wrap or convert given conversion-fail exception into a fullTypedXMLStreamException,protected TypedXMLStreamException_constructTypeException(String msg, String lexicalValue) protected ValueDecoderFactoryprotected int_getAttributeAsArray(TypedArrayDecoder tad, String attrValue) protected String_internName(String name) Method called to do additional intern()ing for a name, if and as necessaryprotected String_internNsURI(String uri) voidclose()Note: as per StAX 1.0 specs, this method does NOT close the underlying input reader.voidMethod similar toXMLStreamReader.close(), except that this method also does close the underlying input source if it has not yet been closed.protected voidcoalesceText(int initialType) intfindAttributeIndex(String nsURI, String localName) protected StringfindErrorDesc(int errorType, int currEvent) Method used to locate error message description to use.final voidgetAttributeAs(int index, TypedValueDecoder tvd) Generic access method that can be used for efficient decoding of additional types not support natively by the typed stream reader.intgetAttributeAsArray(int index, 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) Read an attribute value as a byte array.byte[]getAttributeAsBinary(int index, Base64Variant v) booleangetAttributeAsBoolean(int index) Read an attribute value as a boolean.getAttributeAsDecimal(int index) doublegetAttributeAsDouble(int index) double[]getAttributeAsDoubleArray(int index) floatgetAttributeAsFloat(int index) float[]getAttributeAsFloatArray(int index) intgetAttributeAsInt(int index) Read an attribute value as a boolean.int[]getAttributeAsIntArray(int index) Read an attribute content as an int array.getAttributeAsInteger(int index) longgetAttributeAsLong(int index) Read an attribute value as a boolean.long[]getAttributeAsLongArray(int index) getAttributeAsQName(int index) intintgetAttributeIndex(String namespaceURI, String localName) Returns the index of the attribute whose local name islocalNameand URI isnamespaceURIor-1if no such attribute exists.Method that can be called to get additional information about attributes related to the current start element, as well as related DTD-based information if available.getAttributeLocalName(int index) getAttributeName(int index) getAttributeNamespace(int index) getAttributePrefix(int index) getAttributeType(int index) getAttributeValue(int index) getAttributeValue(String nsURI, String localName) As per Stax (1.0) specs, needs to return whatever xml declaration claimed encoding is, if any; or null if no xml declaration found.A method that returns the current location of the stream reader at the input source.intgetDepth()Method that returns the number of open elements in the stack; 0 when the reader is in prolog/epilog, 1 inside root element (including when pointing at the root element itself) and so on.Since this class implementsDTDInfo, method can just returnthis.voidGeneric decoding method that can be used for efficient decoding of additional types not support natively by the typed stream reader.byte[]Convenience method that can be used similar to read binary content instead ofTypedXMLStreamReader.readElementAsBinary(byte[], int, int, Base64Variant), in cases where neither performance nor memory usage is a big concern.byte[]Convenience method that can be used similar to read binary content instead ofTypedXMLStreamReader.readElementAsBinary(byte[], int, int, Base64Variant), in cases where neither performance nor memory usage is a big concern.booleanRead an element content as a boolean.doubleRead an element content as a 64-bit floating point value.floatRead an element content as a 32-bit floating point value.intRead an element content as a 32-bit integer.longRead an element content as a 64-bit integer.From StAX specs: Reads the content of a text-only element, an exception is thrown if this is not a text-only element.As per Stax (1.0) specs, needs to return whatever parser determined the encoding was, if it was able to figure it out.longMethod that can be used to get exact byte offset (number of bytes read from the stream right before getting to this location) in the stream that is pointed to by this reader, right after the end of the current event.longMethod that can be used to get exact character offset (number of chars read from the stream right before getting to this location) in the stream that is pointed to by this reader, right after the end of the current event.final XMLStreamLocation2An optional method that either returns the location object that points the ending position of the current event, or null if implementation does not keep track of it (some may return only start location; and some no location at all).protected LocationintReturns type of the last event returned; or START_DOCUMENT before any events has been explicitly returned.getFeature(String name) Deprecated.intReturns the index of the id attribute (attribute with any name, type ID from DTD) of current (start) element, if any.final Locationfinal LocationInfoLocation information is always accessible, for this reader.getName()intgetNamespacePrefix(int index) Alas, DOM does not expose any of information necessary for determining actual declarations.getNamespaceURI(int index) getNamespaceURI(String prefix) This method returns a namespace context object that contains information identical to that returned byXMLStreamReader.getNamespaceContext(), but one that is not transient.intReturns the index of the notation attribute (attribute with any name, type NOTATION from DTD) of current (start) element, if any.This method returns "prefix-qualified" name of the current element.getPrefixes(String namespaceURI) Method similar toDTDInfo.getProcessedDTD(), but type-safe.abstract ObjectgetProperty(String name) longMethod that can be used to get exact byte offset (number of bytes read from the stream right before getting to this location) in the stream that is pointed to by this reader, right before the start of the current event.longMethod that can be used to get exact character offset (number of chars read from the stream right before getting to this location) in the stream that is pointed to by this reader, right before the start of the current event.An optional method that either returns the location object that points the starting position of the current event, or null if implementation does not keep track of it (some may return only end location; and some no location at all).getText()intMethod similar togetText(), except that it just uses provided Writer to write all textual content.char[]intgetTextCharacters(int sourceStart, char[] target, int targetStart, int len) intintbooleanhasName()booleanhasNext()booleanhasText()booleanisAttributeSpecified(int index) booleanbooleanMethod that can be used to check whether current START_ELEMENT event was created for an empty element (xml short-hand notation where one tag implies start and end, ending with "/>"), or not.booleanabstract booleanisPropertySupported(String name) Method similar toXMLInputFactory.isPropertySupported(String), used to determine whether a property is supported by the Reader instance.booleanbooleanbooleanintnext()intnextTag()intRead an element content as an array of tokens.intreadElementAsBinary(byte[] resultBuffer, int offset, int maxLength) intreadElementAsBinary(byte[] resultBuffer, int offset, int maxLength, Base64Variant v) Read element content as decoded byte sequence; possibly only reading a fragment of all element content.intreadElementAsDoubleArray(double[] value, int from, int length) intreadElementAsFloatArray(float[] value, int from, int length) intreadElementAsIntArray(int[] value, int from, int length) Read an element content as an int array.intreadElementAsLongArray(long[] value, int from, int length) protected voidreportParseProblem(int errorType) protected voidreportWrongState(int errorType) voidvoidsetFeature(String name, Object value) Deprecated.protected voidsetInternNames(boolean state) protected voidsetInternNsURIs(boolean state) abstract booleansetProperty(String name, Object value) Method that can be used to set per-reader properties; a subset of properties one can set via matchingXMLInputFactory2instance.Method that application can call to define a custom handler for validation problems encountered during validation process.voidMethod that will skip all the contents of the element that the stream currently points to.booleanMethod that can be called by application to stop validating output against a schema, for whichValidatable.validateAgainst(XMLValidationSchema)was called earlier.stopValidatingAgainst(XMLValidator validator) Method that can be called by application to stop validating output using specified validator.protected voidprotected abstract voidthrowStreamException(String msg, Location loc) validateAgainst(XMLValidationSchema schema) Method that will construct aXMLValidatorinstance from the given schema (unless a validator for that schema has already been added), initialize it if necessary, and make validatable object (reader, writer) call appropriate validation methods from this point on until the end of the document (that is, it's not scoped with sub-trees), or until validator is removed by an explicit call toValidatable.stopValidatingAgainst(XMLValidationSchema).
-
Field Details
-
INT_SPACE
protected static final int INT_SPACE- See Also:
-
MASK_TYPED_ACCESS_BINARY
protected static final int MASK_TYPED_ACCESS_BINARY- See Also:
-
ERR_STATE_NOT_START_ELEM
protected static final int ERR_STATE_NOT_START_ELEMCurrent state not START_ELEMENT, should be- See Also:
-
ERR_STATE_NOT_ELEM
protected static final int ERR_STATE_NOT_ELEMCurrent state not START_ELEMENT or END_ELEMENT, should be- See Also:
-
ERR_STATE_NOT_PI
protected static final int ERR_STATE_NOT_PICurrent state not PROCESSING_INSTRUCTION- See Also:
-
ERR_STATE_NOT_TEXTUAL
protected static final int ERR_STATE_NOT_TEXTUALCurrent state not one where getText() can be used- See Also:
-
ERR_STATE_NOT_TEXTUAL_XXX
protected static final int ERR_STATE_NOT_TEXTUAL_XXXCurrent state not one where getTextXxx() can be used- See Also:
-
ERR_STATE_NOT_TEXTUAL_OR_ELEM
protected static final int ERR_STATE_NOT_TEXTUAL_OR_ELEM- See Also:
-
ERR_STATE_NO_LOCALNAME
protected static final int ERR_STATE_NO_LOCALNAME- See Also:
-
_systemId
-
_rootNode
-
_cfgNsAware
protected final boolean _cfgNsAwareWhether stream reader is to be namespace aware (as per propertyXMLInputFactory.IS_NAMESPACE_AWARE) or not -
_coalescing
protected final boolean _coalescingWhether stream reader is to coalesce adjacent textual (CHARACTERS, SPACE, CDATA) events (as per propertyXMLInputFactory.IS_COALESCING) or not -
_cfgInternNames
protected boolean _cfgInternNamesBy default we do not force interning of names: can be reset by sub-classes. -
_cfgInternNsURIs
protected boolean _cfgInternNsURIsBy default we do not force interning of namespace URIs: can be reset by sub-classes. -
_currEvent
protected int _currEvent -
_currNode
Current node is the DOM node that contains information regarding the current event. -
_depth
protected int _depth -
_coalescedText
In coalescing mode, we may need to combine textual content from multiple adjacent nodes. Since we shouldn't be modifying the underlying DOM tree, need to accumulate it into a temporary variable -
_textBuffer
Helper object used for combining segments of text as needed -
_attrList
-
_nsDeclList
Lazily instantiated String pairs of all namespace declarations for the current (start/end) element. String pair means that for each declarations there are two Strings in the list: first one is prefix (empty String for the default namespace declaration), and second URI it is bound to. -
_decoderFactory
Factory used for constructing decoders we need for typed access -
_base64Decoder
Lazily-constructed decoder object for decoding base64 encoded binary content.
-
-
Constructor Details
-
DOMWrappingReader
protected DOMWrappingReader(DOMSource src, boolean nsAware, boolean coalescing) throws XMLStreamException - Parameters:
src- Node that is the tree of the DOM document, or fragment.nsAware- Whether resulting reader should operate in namespace aware mode or not. Note that this should be compatible with settings for the DOM builder that produced DOM tree or fragment being operated on, otherwise results are not defined.coalescing- Whether resulting reader should coalesce adjacent text events or not- Throws:
XMLStreamException
-
-
Method Details
-
setInternNames
protected void setInternNames(boolean state) -
setInternNsURIs
protected void setInternNsURIs(boolean state) -
throwStreamException
- Throws:
XMLStreamException
-
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.- Specified by:
getCharacterEncodingSchemein interfaceXMLStreamReader
-
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:
getEncodingin interfaceXMLStreamReader
-
getVersion
- Specified by:
getVersionin interfaceXMLStreamReader
-
isStandalone
public boolean isStandalone()- Specified by:
isStandalonein interfaceXMLStreamReader
-
standaloneSet
public boolean standaloneSet()- Specified by:
standaloneSetin interfaceXMLStreamReader
-
getProperty
- Specified by:
getPropertyin interfaceXMLStreamReader
-
isPropertySupported
Description copied from interface:XMLStreamReader2Method similar toXMLInputFactory.isPropertySupported(String), used to determine whether a property is supported by the Reader instance. This means that this method may return false for some properties that the input factory does support: specifically, it should only return true if the value is mutable on per-instance basis. False means that either the property is not recognized, or is not mutable via reader instance.- Specified by:
isPropertySupportedin interfaceXMLStreamReader2
-
setProperty
Description copied from interface:XMLStreamReader2Method that can be used to set per-reader properties; a subset of properties one can set via matchingXMLInputFactory2instance. Exactly which methods are mutable is implementation specific.- Specified by:
setPropertyin interfaceXMLStreamReader2- 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
-
getAttributeCount
public int getAttributeCount()- Specified by:
getAttributeCountin interfaceAttributeInfo- Specified by:
getAttributeCountin interfaceXMLStreamReader- Returns:
- Number of all attributes accessible (including ones created from the default values, if any) using this Object.
-
getAttributeLocalName
- Specified by:
getAttributeLocalNamein interfaceXMLStreamReader
-
getAttributeName
- Specified by:
getAttributeNamein interfaceXMLStreamReader
-
getAttributeNamespace
- Specified by:
getAttributeNamespacein interfaceXMLStreamReader
-
getAttributePrefix
- Specified by:
getAttributePrefixin interfaceXMLStreamReader
-
getAttributeType
- Specified by:
getAttributeTypein interfaceXMLStreamReader
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceXMLStreamReader
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceXMLStreamReader
-
getElementText
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:
getElementTextin interfaceXMLStreamReader- Throws:
XMLStreamException
-
getEventType
public int getEventType()Returns type of the last event returned; or START_DOCUMENT before any events has been explicitly returned.- Specified by:
getEventTypein interfaceXMLStreamReader
-
getLocalName
- Specified by:
getLocalNamein interfaceXMLStreamReader
-
getLocation
- Specified by:
getLocationin interfaceLocationInfo- Specified by:
getLocationin interfaceXMLStreamReader
-
getName
- Specified by:
getNamein interfaceXMLStreamReader
-
getNamespaceContext
- Specified by:
getNamespaceContextin interfaceXMLStreamReader
-
getNamespaceCount
public int getNamespaceCount()- Specified by:
getNamespaceCountin interfaceXMLStreamReader
-
getNamespacePrefix
Alas, DOM does not expose any of information necessary for determining actual declarations. Thus, have to indicate that there are no declarations.- Specified by:
getNamespacePrefixin interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-
getPIData
- Specified by:
getPIDatain interfaceXMLStreamReader
-
getPITarget
- Specified by:
getPITargetin interfaceXMLStreamReader
-
getPrefix
- Specified by:
getPrefixin interfaceXMLStreamReader
-
getText
- Specified by:
getTextin interfaceXMLStreamReader
-
getTextCharacters
public char[] getTextCharacters()- Specified by:
getTextCharactersin interfaceXMLStreamReader
-
getTextCharacters
public int getTextCharacters(int sourceStart, char[] target, int targetStart, int len) - Specified by:
getTextCharactersin interfaceXMLStreamReader
-
getTextLength
public int getTextLength()- Specified by:
getTextLengthin interfaceXMLStreamReader
-
getTextStart
public int getTextStart()- Specified by:
getTextStartin interfaceXMLStreamReader
-
hasName
public boolean hasName()- Specified by:
hasNamein interfaceXMLStreamReader
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceXMLStreamReader
-
hasText
public boolean hasText()- Specified by:
hasTextin interfaceXMLStreamReader
-
isAttributeSpecified
public boolean isAttributeSpecified(int index) - Specified by:
isAttributeSpecifiedin interfaceXMLStreamReader
-
isCharacters
public boolean isCharacters()- Specified by:
isCharactersin interfaceXMLStreamReader
-
isEndElement
public boolean isEndElement()- Specified by:
isEndElementin interfaceXMLStreamReader
-
isStartElement
public boolean isStartElement()- Specified by:
isStartElementin interfaceXMLStreamReader
-
isWhiteSpace
public boolean isWhiteSpace()- Specified by:
isWhiteSpacein interfaceXMLStreamReader
-
require
- Specified by:
requirein interfaceXMLStreamReader- Throws:
XMLStreamException
-
next
- Specified by:
nextin interfaceXMLStreamReader- Throws:
XMLStreamException
-
nextTag
- Specified by:
nextTagin interfaceXMLStreamReader- Throws:
XMLStreamException
-
close
Note: as per StAX 1.0 specs, this method does NOT close the underlying input reader. That is, unless the new StAX2 property
XMLInputFactory2.P_AUTO_CLOSE_INPUTis set to true.- Specified by:
closein interfaceXMLStreamReader- Throws:
XMLStreamException
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceNamespaceContext- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-
getPrefix
- Specified by:
getPrefixin interfaceNamespaceContext
-
getPrefixes
- Specified by:
getPrefixesin interfaceNamespaceContext
-
getElementAsBoolean
Description copied from interface:TypedXMLStreamReaderRead an element content as a boolean. The lexical representation of a boolean is defined by the XML Schema boolean data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema boolean data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema boolean data type. (note: allowed lexical values are canonicals "true" and "false", as well as non-canonical "0" and "1")
These are the pre- and post-conditions of calling this method:
- Precondition: the current event is START_ELEMENT.
- Postcondition: the current event is the corresponding END_ELEMENT.
- Specified by:
getElementAsBooleanin interfaceTypedXMLStreamReader- Throws:
XMLStreamException- If unable to access content
-
getElementAsInt
Description copied from interface:TypedXMLStreamReaderRead an element content as a 32-bit integer. The lexical representation of a integer is defined by the XML Schema integer data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema integer data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema integer data type.
These are the pre and post conditions of calling this method:
- Precondition: the current event is START_ELEMENT.
- Postcondition: the current event is the corresponding END_ELEMENT.
- Specified by:
getElementAsIntin interfaceTypedXMLStreamReader- Throws:
XMLStreamException- If unable to access content
-
getElementAsLong
Description copied from interface:TypedXMLStreamReaderRead an element content as a 64-bit integer. The lexical representation of a integer is defined by the XML Schema integer data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema integer data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema integer data type.
These are the pre and post conditions of calling this method:
- Precondition: the current event is START_ELEMENT.
- Postcondition: the current event is the corresponding END_ELEMENT.
- Specified by:
getElementAsLongin interfaceTypedXMLStreamReader- Throws:
XMLStreamException- If unable to access content
-
getElementAsFloat
Description copied from interface:TypedXMLStreamReaderRead an element content as a 32-bit floating point value. The lexical representation is defined by the XML Schema float data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema float data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema integer data type.
Note that valid representations include basic Java textual representations, as well as 3 special tokens: "INF", "-INF" and "NaN"These are the pre and post conditions of calling this method:
- Precondition: the current event is START_ELEMENT.
- Postcondition: the current event is the corresponding END_ELEMENT.
- Specified by:
getElementAsFloatin interfaceTypedXMLStreamReader- Throws:
XMLStreamException- If unable to access content
-
getElementAsDouble
Description copied from interface:TypedXMLStreamReaderRead an element content as a 64-bit floating point value. The lexical representation is defined by the XML Schema double data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema double data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema integer data type.
Note that valid representations include basic Java textual representations, as well as 3 special tokens: "INF", "-INF" and "NaN"These are the pre and post conditions of calling this method:
- Precondition: the current event is START_ELEMENT.
- Postcondition: the current event is the corresponding END_ELEMENT.
- Specified by:
getElementAsDoublein interfaceTypedXMLStreamReader- Throws:
XMLStreamException- If unable to access content
-
getElementAsInteger
- Specified by:
getElementAsIntegerin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getElementAsDecimal
- Specified by:
getElementAsDecimalin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getElementAsQName
- Specified by:
getElementAsQNamein interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getElementAsBinary
Description copied from interface:TypedXMLStreamReaderConvenience method that can be used similar to read binary content instead ofTypedXMLStreamReader.readElementAsBinary(byte[], int, int, Base64Variant), in cases where neither performance nor memory usage is a big concern.Note: base64 variant defaults to
Base64Variants.MIME.- Specified by:
getElementAsBinaryin interfaceTypedXMLStreamReader- Throws:
XMLStreamException- See Also:
-
getElementAsBinary
Description copied from interface:TypedXMLStreamReaderConvenience method that can be used similar to read binary content instead ofTypedXMLStreamReader.readElementAsBinary(byte[], int, int, Base64Variant), in cases where neither performance nor memory usage is a big concern.- Specified by:
getElementAsBinaryin interfaceTypedXMLStreamReader- Parameters:
v- Base64 variant content is in; needed to decode alternative variants ("modified base64")- Throws:
XMLStreamException- See Also:
-
getElementAs
Description copied from interface:TypedXMLStreamReaderGeneric decoding method that can be used for efficient decoding of additional types not support natively by the typed stream reader. When method is called, stream reader will collect all textual content of the current element (effectively doing something similar to a call toXMLStreamReader.getElementText(), and then call one of decode methods defined inTypedValueDecoder. The only difference is that passed value will be trimmed: that is, any leading or trailing white space will be removed prior to calling decode method. After the call, passed decoder object will have decoded and stored value (if succesful) or thrown an exception (if not).The main benefit of using this method (over just getting all content by calling
XMLStreamReader.getElementText()is efficiency: the stream reader can efficiently gather all textual content necessary and pass it to the decoder, often avoiding construction of intemediate Strings.These are the pre- and post-conditions of calling this method:
- Precondition: the current event is START_ELEMENT.
- Postcondition: the current event is the corresponding END_ELEMENT.
Note that caller has to know more specific type of decoder, since the base interface does not specify methods for accessing actual decoded value.
- Specified by:
getElementAsin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
readElementAsIntArray
Description copied from interface:TypedXMLStreamReaderRead an element content as an int array. The lexical representation of a int array is defined by the following XML schema type:<xs:simpleType name="intArray"> <xs:list itemType="xs:int"/> </xs:simpleType>whose lexical space is a list of space-separated ints. Whitespace MUST be collapsed according to the whiteSpace facet for theintArraytype shown above. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by theintArraydata type.These are the pre and post conditions of calling this method:
- Precondition: the current event is either START_ELEMENT, or a textual event (CHARACTERS, CDATA), or END_ELEMENT (END_ELEMENT is allowed for convenience; if so, no read operation is tried, and -1 is returned immediately
- Postcondition: the current event is the corresponding END_ELEMENT or CHARACTERS if only a portion of the array has been copied thus far.
- Specified by:
readElementAsIntArrayin interfaceTypedXMLStreamReader- Parameters:
value- The array in which to copy the ints.from- The index in the array from which copying starts.length- The maximun number of ints to copy. Minimum value is 1; others anIllegalArgumentExceptionis thrown- Returns:
- The number of ints actually copied which must
be less or equal than
length, but at least one if any ints found. If not, -1 is returned to signal end of ints to parse. - Throws:
XMLStreamException
-
readElementAsLongArray
- Specified by:
readElementAsLongArrayin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
readElementAsFloatArray
- Specified by:
readElementAsFloatArrayin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
readElementAsDoubleArray
- Specified by:
readElementAsDoubleArrayin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
readElementAsArray
Description copied from interface:TypedXMLStreamReaderRead an element content as an array of tokens. This is done by reader tokenizing textual content by white space, and sending each token to specified decoder for decoding. This is repeated as long as element content has more tokens and decoder can accept more values.These are the pre- and post-conditions of calling this method:
- Precondition: the current event is either START_ELEMENT, or a textual event (CHARACTERS, CDATA), or END_ELEMENT (END_ELEMENT is allowed for convenience; if so, no read operation is tried, and -1 is returned immediately
- Postcondition: the current event is the corresponding END_ELEMENT or CHARACTERS if only a portion of the array has been copied thus far.
Note: passed decoder must accept at least one value, reader will not verify capacity before calling it with the first token.
- Specified by:
readElementAsArrayin interfaceTypedXMLStreamReader- Returns:
- Number of elements decoded, or -1 to indicate that there was no more element content tokens to decode.
- Throws:
XMLStreamException
-
readElementAsBinary
public int readElementAsBinary(byte[] resultBuffer, int offset, int maxLength) throws XMLStreamException - Specified by:
readElementAsBinaryin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
readElementAsBinary
public int readElementAsBinary(byte[] resultBuffer, int offset, int maxLength, Base64Variant v) throws XMLStreamException Description copied from interface:TypedXMLStreamReaderRead element content as decoded byte sequence; possibly only reading a fragment of all element content. The lexical representation of a byte array is defined by the XML Schema base64Binary data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema base64Binary data type. An exception is thrown if content is not in the lexical space defined by the XML Schema base64Binary data type.Each call will read at least one decoded byte (and no more than the specified maximum length), if there is any content remaining. If none is available and END_ELEMENT is encountered, -1 is returned.
These are the pre and post conditions of calling this method:
- Precondition: the current event is either START_ELEMENT, or a textual event (CHARACTERS, CDATA), or END_ELEMENT (END_ELEMENT is allowed for convenience; if so, no read operation is tried, and -1 is returned immediately
- Postcondition: the current event is the corresponding END_ELEMENT, if all remaining binary content was read, or CHARACTERS if only a portion of the array was read
Additionally, caller MUST start decoding at START_ELEMENT; if the first decode calls is at CHARACTERS or CDATA event, results are not defined: result may be an exception, or invalid data being returned. Implementations are encouraged to throw an exception if possible, to make it easier to figure out the problem.
This method can be called multiple times until the cursor is positioned at the corresponding END_ELEMENT event. Stated differently, after the method is called for the first time, the cursor will move and remain in the CHARACTERS position while there are potentially more bytes available for reading.
- Specified by:
readElementAsBinaryin interfaceTypedXMLStreamReader- Parameters:
resultBuffer- Array in which to copy decoded bytes.offset- Starting offset of the first decoded byte within result buffermaxLength- Maximum number of bytes to decode with this call- Returns:
- The number of bytes actually decoded and returned,
if any were available; -1 if there is no more content.
If any content was copied, value must be less or equal than
maxLengthNote that this value is not guaranteed to equalmaxLengtheven if enough content was available; that is, implementations can return shorter sections if they choose to, down to and including returning zero (0) if it was not possible to decode a full base64 triplet (3 output bytes from 4 input characters). - Throws:
XMLStreamException
-
getAttributeIndex
Description copied from interface:TypedXMLStreamReaderReturns the index of the attribute whose local name islocalNameand URI isnamespaceURIor-1if no such attribute exists.- Specified by:
getAttributeIndexin interfaceTypedXMLStreamReader- Parameters:
namespaceURI- The attribute's namespace URI. Values of null and "" are considered the same, i.e. "no namespace" (or "empty" namespace)localName- The attribute's local name.- Returns:
- The attribute's index or
-1if no such attribute exists.
-
getAttributeAsBoolean
Description copied from interface:TypedXMLStreamReaderRead an attribute value as a boolean. The lexical representation of a boolean is defined by the XML Schema boolean data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema boolean data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema boolean data type.
- Specified by:
getAttributeAsBooleanin interfaceTypedXMLStreamReader- Parameters:
index- The attribute's index as returned byTypedXMLStreamReader.getAttributeIndex(String, String)- Throws:
XMLStreamException- If unable to convert the resulting character sequence into an XML Schema boolean value.
-
getAttributeAsInt
Description copied from interface:TypedXMLStreamReaderRead an attribute value as a boolean. The lexical representation of a boolean is defined by the XML Schema integer data type. Whitespace MUST be collapsed according to the whiteSpace facet for the type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema integer data type.
- Specified by:
getAttributeAsIntin interfaceTypedXMLStreamReader- Parameters:
index- The attribute's index as returned byTypedXMLStreamReader.getAttributeIndex(String, String)- Throws:
XMLStreamException- If unable to convert the resulting character sequence into an XML Schema boolean value.
-
getAttributeAsLong
Description copied from interface:TypedXMLStreamReaderRead an attribute value as a boolean. The lexical representation of a boolean is defined by the XML Schema long data type. Whitespace MUST be collapsed according to the whiteSpace facet for the type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema long data type.
- Specified by:
getAttributeAsLongin interfaceTypedXMLStreamReader- Parameters:
index- The attribute's index as returned byTypedXMLStreamReader.getAttributeIndex(String, String)- Throws:
XMLStreamException- If unable to convert the resulting character sequence into an XML Schema boolean value.
-
getAttributeAsFloat
- Specified by:
getAttributeAsFloatin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAsDouble
- Specified by:
getAttributeAsDoublein interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAsInteger
- Specified by:
getAttributeAsIntegerin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAsDecimal
- Specified by:
getAttributeAsDecimalin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAsQName
- Specified by:
getAttributeAsQNamein interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAs
Description copied from interface:TypedXMLStreamReaderGeneric access method that can be used for efficient decoding of additional types not support natively by the typed stream reader. The main benefit of using this method is that the stream reader can efficient gather all textual content necessary and pass it to the decoder, often avoiding construction of intemediate Strings.As with
TypedXMLStreamReader.getElementAs(TypedValueDecoder), value passed to a decode method will be trimmed of any leading or trailing white space.- Specified by:
getAttributeAsin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAsIntArray
Description copied from interface:TypedXMLStreamReaderRead an attribute content as an int array. The lexical representation of a int array is defined by the following XML schema type:
<xs:simpleType name="intArray"> <xs:list itemType="xs:int"/> </xs:simpleType>whose lexical space is a list of space-separated ints. Whitespace MUST be collapsed according to the whiteSpace facet for theintArraytype shown above. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by theintArraydata type.- Specified by:
getAttributeAsIntArrayin interfaceTypedXMLStreamReader- Parameters:
index- The attribute's index as returned byTypedXMLStreamReader.getAttributeIndex(String, String).- Returns:
- An array of ints with the content.
- Throws:
XMLStreamException- If unable to convert the resulting character sequence into an XML Schema boolean value.
-
getAttributeAsLongArray
- Specified by:
getAttributeAsLongArrayin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAsFloatArray
- Specified by:
getAttributeAsFloatArrayin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAsDoubleArray
- Specified by:
getAttributeAsDoubleArrayin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getAttributeAsArray
Description copied from interface:TypedXMLStreamReaderMethod that allows reading contents of an attribute as an array of whitespace-separate tokens, decoded using specified decoder.- Specified by:
getAttributeAsArrayin interfaceTypedXMLStreamReader- Returns:
- Number of tokens decoded, 0 if none found
- Throws:
XMLStreamException
-
_getAttributeAsArray
protected int _getAttributeAsArray(TypedArrayDecoder tad, String attrValue) throws XMLStreamException - Throws:
XMLStreamException
-
getAttributeAsBinary
Description copied from interface:TypedXMLStreamReaderRead an attribute value as a byte array. The lexical representation of a byte array is defined by the XML Schema base64Binary data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema base64Binary data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema base64Binary data type.- Specified by:
getAttributeAsBinaryin interfaceTypedXMLStreamReader- Parameters:
index- The attribute's index as returned byTypedXMLStreamReader.getAttributeIndex(String, String).- Returns:
- An array of bytes with the content.
- Throws:
XMLStreamException- If unable to convert the resulting character sequence into an XML Schema boolean value.
-
getAttributeAsBinary
- Specified by:
getAttributeAsBinaryin interfaceTypedXMLStreamReader- Throws:
XMLStreamException
-
getFeature
Deprecated.Description copied from interface:XMLStreamReader2Method that can be used to get per-reader values; both generic ones (names for which are defined as constants in this class), and implementation dependant ones.Note: although some feature names are shared with
XMLStreamReader2.setFeature(String, Object), not all are: some features are read-only, some write-only- Specified by:
getFeaturein interfaceXMLStreamReader2- Parameters:
name- Name of the feature of which value to get- Returns:
- Value of the feature (possibly null), if supported; null otherwise
-
setFeature
Deprecated.Description copied from interface:XMLStreamReader2Method that can be used to set per-reader features such as configuration settings; both generic ones (names for which are defined as constants in this class), and implementation dependant ones.Note: although some feature names are shared with
XMLStreamReader2.getFeature(String), not all are: some features are read-only, some write-only- Specified by:
setFeaturein interfaceXMLStreamReader2- Parameters:
name- Name of the feature to setvalue- Value to set feature to.
-
skipElement
Description copied from interface:XMLStreamReader2Method that will skip all the contents of the element that the stream currently points to. Current event when calling the method has to be START_ELEMENT (or otherwiseIllegalStateExceptionis thrown); after the call the stream will point to the matching END_ELEMENT event, having skipped zero or more intervening events for the contents.- Specified by:
skipElementin interfaceXMLStreamReader2- Throws:
XMLStreamException
-
getAttributeInfo
Description copied from interface:XMLStreamReader2Method that can be called to get additional information about attributes related to the current start element, as well as related DTD-based information if available. Note that the reader has to currently point to START_ELEMENT; if not, aIllegalStateExceptionwill be thrown.- Specified by:
getAttributeInfoin interfaceXMLStreamReader2- Throws:
XMLStreamException
-
findAttributeIndex
- Specified by:
findAttributeIndexin interfaceAttributeInfo- Returns:
- Index of the specified attribute, if the current element has such an attribute (explicit, or one created via default value expansion); -1 if not.
-
getIdAttributeIndex
public int getIdAttributeIndex()Description copied from interface:AttributeInfoReturns the index of the id attribute (attribute with any name, type ID from DTD) of current (start) element, if any. Note that DTD only allows at most one such attribute per element.- Specified by:
getIdAttributeIndexin interfaceAttributeInfo- Returns:
- Index of the ID attribute of current element, if the current element has such an attribute defined; -1 if not.
-
getNotationAttributeIndex
public int getNotationAttributeIndex()Description copied from interface:AttributeInfoReturns the index of the notation attribute (attribute with any name, type NOTATION from DTD) of current (start) element, if any. Note that DTD only allows at most one such attribute per element.- Specified by:
getNotationAttributeIndexin interfaceAttributeInfo- Returns:
- Index of the NOTATION attribute of current element, if the current element has such an attribute defined; -1 if not.
-
getDTDInfo
Since this class implementsDTDInfo, method can just returnthis.- Specified by:
getDTDInfoin interfaceXMLStreamReader2- Returns:
- Information object for accessing further DOCTYPE information, iff the reader currently points to DTD event, AND is operating in mode that parses such information (DTD-aware at least, and usually also validating)
- Throws:
XMLStreamException
-
getLocationInfo
Location information is always accessible, for this reader.- Specified by:
getLocationInfoin interfaceXMLStreamReader2
-
getText
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:
getTextin interfaceXMLStreamReader2- Parameters:
w- Writer to use for writing textual contentspreserveContents- If true, reader has to preserve contents so that further calls togetTextwill 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 togetTextis not guaranteed to return meaningful data.- Returns:
- Number of characters written to the reader
- Throws:
IOExceptionXMLStreamException
-
getDepth
public int getDepth()Description copied from interface:XMLStreamReader2Method that returns the number of open elements in the stack; 0 when the reader is in prolog/epilog, 1 inside root element (including when pointing at the root element itself) and so on. Depth is same for matching start/end elements, as well as for the all children of an element.- Specified by:
getDepthin interfaceXMLStreamReader2- Returns:
- Number of open elements in the stack; 0 when parser is in prolog/epilog, 1 inside root element and so on.
-
isEmptyElement
Description copied from interface:XMLStreamReader2Method that can be used to check whether current START_ELEMENT event was created for an empty element (xml short-hand notation where one tag implies start and end, ending with "/>"), or not.Note: method may need to read more data to know if the element is an empty one, and as such may throw an i/o or parsing exception (as
XMLStreamException); however, it won't throw exceptions for non-START_ELEMENT event types.- Specified by:
isEmptyElementin interfaceXMLStreamReader2- Returns:
- True, if cursor points to a start or end element that is
constructed from 'empty' element (ends with
'/>'); false otherwise. - Throws:
XMLStreamException
-
getNonTransientNamespaceContext
Description copied from interface:XMLStreamReader2This method returns a namespace context object that contains information identical to that returned byXMLStreamReader.getNamespaceContext(), but one that is not transient. That is, one that will remain valid and unchanged after its creation. This allows the namespace context to be used independent of its source documents life cycle. One possible use case is to use this namespace context for 'initializing' writers (especially ones that use repairing mode) with optimal/preferred name space bindings.- Specified by:
getNonTransientNamespaceContextin interfaceXMLStreamReader2- Returns:
- Non-transient namespace context as explained above.
-
getPrefixedName
Description copied from interface:XMLStreamReader2This method returns "prefix-qualified" name of the current element. In general, this means character-by-character exact name of the element in XML content, and may be useful in informational purposes, as well as when interacting with packages and APIs that use such names (such as what SAX may use as qnames).Note: implementations are encouraged to provide an implementation that would be more efficient than calling
getLocalNameandgetPrefixseparately, but are not required to do so. Nonetheless it is usually at least as efficient (if not more) to call this method as to do it fully in calling code.- Specified by:
getPrefixedNamein interfaceXMLStreamReader2- Returns:
- Prefix-qualified name of the current element; essentially 'prefix:localName' if the element has a prefix, or 'localName' if it does not have one (belongs to the default namespace)
-
closeCompletely
Description copied from interface:XMLStreamReader2Method similar toXMLStreamReader.close(), except that this method also does close the underlying input source if it has not yet been closed. It is generally preferable to call this method if the parsing ends in an exception; and for some input sources (when passing aFileorURLfor factory method) it has to be called as the application does not have access to the actually input source (InputStreamopened from aURLand so on).- Specified by:
closeCompletelyin interfaceXMLStreamReader2- Throws:
XMLStreamException
-
getProcessedDTD
- Specified by:
getProcessedDTDin interfaceDTDInfo- Returns:
- If current event is DTD, DTD support is enabled, and reader supports DTD processing, returns an internal Object implementation uses for storing/processing DTD; otherwise returns null.
-
getDTDRootName
- Specified by:
getDTDRootNamein interfaceDTDInfo- Returns:
- If current event is DTD, returns the full root name (including prefix, if any); otherwise returns null
-
getDTDPublicId
- Specified by:
getDTDPublicIdin interfaceDTDInfo- Returns:
- If current event is DTD, and has a public id, returns the public id; otherwise returns null.
-
getDTDSystemId
- Specified by:
getDTDSystemIdin interfaceDTDInfo- Returns:
- If current event is DTD, and has a system id, returns the system id; otherwise returns null.
-
getDTDInternalSubset
- Specified by:
getDTDInternalSubsetin interfaceDTDInfo- Returns:
- Internal subset portion of the DOCTYPE declaration, if any; empty String if none
-
getProcessedDTDSchema
Description copied from interface:DTDInfoMethod similar toDTDInfo.getProcessedDTD(), but type-safe. Will return the DTD schema instance that was read, if we are in mode where it does get read (at least dtd-aware).- Specified by:
getProcessedDTDSchemain interfaceDTDInfo
-
getStartingByteOffset
public long getStartingByteOffset()Description copied from interface:LocationInfoMethod that can be used to get exact byte offset (number of bytes read from the stream right before getting to this location) in the stream that is pointed to by this reader, right before the start of the current event.Note: this value MAY be the same as the one returned by
LocationInfo.getStartingCharOffset(), but usually only for single-byte character streams (Ascii, ISO-Latin).- Specified by:
getStartingByteOffsetin interfaceLocationInfo- Returns:
- Byte offset (== number of bytes reader so far) within the underlying stream, if the stream and stream reader are able to provide this (separate from the character offset, for variable-byte encodings); -1 if not.
-
getStartingCharOffset
public long getStartingCharOffset()Description copied from interface:LocationInfoMethod that can be used to get exact character offset (number of chars read from the stream right before getting to this location) in the stream that is pointed to by this reader, right before the start of the current event.Note: this value MAY be the same as the one returned by
LocationInfo.getStartingByteOffset(); this is the case for single-byte character streams (Ascii, ISO-Latin), as well as for streams for which byte offset information is not available (Readers, Strings).- Specified by:
getStartingCharOffsetin interfaceLocationInfo- Returns:
- Character offset (== number of bytes reader so far) within the underlying stream, if the stream and stream reader are able to provide this (separate from byte offset, for variable-byte encodings); -1 if not.
-
getEndingByteOffset
Description copied from interface:LocationInfoMethod that can be used to get exact byte offset (number of bytes read from the stream right before getting to this location) in the stream that is pointed to by this reader, right after the end of the current event.Note: this value MAY be the same as the one returned by
LocationInfo.getEndingCharOffset(), but usually only for single-byte character streams (Ascii, ISO-Latin).Note: for lazy-loading implementations, calling this method may require the underlying stream to be advanced and contents parsed; this is why it is possible that an exception be thrown.
- Specified by:
getEndingByteOffsetin interfaceLocationInfo- Returns:
- Byte offset (== number of bytes reader so far) within the underlying stream, if the stream and stream reader are able to provide this (separate from the character offset, for variable-byte encodings); -1 if not.
- Throws:
XMLStreamException
-
getEndingCharOffset
Description copied from interface:LocationInfoMethod that can be used to get exact character offset (number of chars read from the stream right before getting to this location) in the stream that is pointed to by this reader, right after the end of the current event.Note: this value MAY be the same as the one returned by
LocationInfo.getEndingByteOffset(); this is the case for single-byte character streams (Ascii, ISO-Latin), as well as for streams for which byte offset information is not available (Readers, Strings).Note: for lazy-loading implementations, calling this method may require the underlying stream to be advanced and contents parsed; this is why it is possible that an exception be thrown.
- Specified by:
getEndingCharOffsetin interfaceLocationInfo- Returns:
- Character offset (== number of bytes reader so far) within the underlying stream, if the stream and stream reader are able to provide this (separate from byte offset, for variable-byte encodings); -1 if not.
- Throws:
XMLStreamException
-
getStartLocation
Description copied from interface:LocationInfoAn optional method that either returns the location object that points the starting position of the current event, or null if implementation does not keep track of it (some may return only end location; and some no location at all).Note: since it is assumed that the start location must either have been collected by now, or is not accessible (i.e. implementation [always] returns null), no exception is allowed to be throws, as no parsing should ever need to be done (unlike with
LocationInfo.getEndLocation()).- Specified by:
getStartLocationin interfaceLocationInfo- Returns:
- Location of the first character of the current event in the input source (which will also be the starting location of the following event, if any, or EOF if not), or null (if implementation does not track locations).
-
getCurrentLocation
Description copied from interface:LocationInfoA method that returns the current location of the stream reader at the input source. This is somewhere between the start and end locations (inclusive), depending on how parser does it parsing (for non-lazy implementations it's always the end location; for others something else).Since this location information should always be accessible, no further parsing is to be done, and no exceptions can be thrown.
- Specified by:
getCurrentLocationin interfaceLocationInfo- Returns:
- Location of the next character reader will parse in the input source.
-
getEndLocation
Description copied from interface:LocationInfoAn optional method that either returns the location object that points the ending position of the current event, or null if implementation does not keep track of it (some may return only start location; and some no location at all).Note: since some implementations may not yet know the end location (esp. ones that do lazy loading), this call may require further parsing. As a result, this method may throw a parsing or I/O errors.
- Specified by:
getEndLocationin interfaceLocationInfo- Returns:
- Location right after the end of the current event (which will also be the start location of the next event, if any, or of EOF otherwise).
- Throws:
XMLStreamException- If the stream reader had to advance to the end of the event (to find the location), it may encounter a parsing (or I/O) error; if so, that gets thrown
-
validateAgainst
Description copied from interface:ValidatableMethod that will construct aXMLValidatorinstance from the given schema (unless a validator for that schema has already been added), initialize it if necessary, and make validatable object (reader, writer) call appropriate validation methods from this point on until the end of the document (that is, it's not scoped with sub-trees), or until validator is removed by an explicit call toValidatable.stopValidatingAgainst(XMLValidationSchema).Note that while this method can be called at any point in output processing, validator instances are not required to be able to handle addition at other points than right before outputting the root element.
- Specified by:
validateAgainstin interfaceValidatable- Returns:
- Validator instance constructed, if validator was added, or null if a validator for the schema has already been constructed.
- Throws:
XMLStreamException
-
stopValidatingAgainst
Description copied from interface:ValidatableMethod that can be called by application to stop validating output against a schema, for whichValidatable.validateAgainst(XMLValidationSchema)was called earlier.- Specified by:
stopValidatingAgainstin interfaceValidatable- Returns:
- Validator instance created from the schema that was removed, if one was in use; null if no such schema in use.
- Throws:
XMLStreamException
-
stopValidatingAgainst
Description copied from interface:ValidatableMethod that can be called by application to stop validating output using specified validator. The validator passed should be an earlier return value for a call toValidatable.validateAgainst(XMLValidationSchema).Note: the specified validator is compared for identity with validators in use, not for equality.
- Specified by:
stopValidatingAgainstin interfaceValidatable- Returns:
- Validator instance found (ie. argument
validator) if it was being used for validating current document; null if not. - Throws:
XMLStreamException
-
setValidationProblemHandler
Description copied from interface:ValidatableMethod that application can call to define a custom handler for validation problems encountered during validation process.- Specified by:
setValidationProblemHandlerin interfaceValidatable- Parameters:
h- Handler to install, if non null; if null, indicates that the default (implementation-specific) handling should be used- Returns:
- Previously set validation problem handler, if any; null if none was set
-
coalesceText
protected void coalesceText(int initialType) -
reportWrongState
protected void reportWrongState(int errorType) -
reportParseProblem
- Throws:
XMLStreamException
-
throwStreamException
- Throws:
XMLStreamException
-
getErrorLocation
-
_constructTypeException
protected TypedXMLStreamException _constructTypeException(IllegalArgumentException iae, 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
-
_decoderFactory
-
_base64Decoder
-
findErrorDesc
Method used to locate error message description to use. Calls sub-classesfindErrorDesc()first, and only if no message found, uses default messages defined here. -
_internName
-
_internNsURI
-