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:
| Modifier and Type | Field and Description |
|---|---|
| protected List | _attrList
Lazily instantiated List of all actual attributes for the current (start) element, NOT including namespace declarations. |
| protected StringBase64Decoder | _base64Decoder
Lazily-constructed decoder object for decoding base64 encoded binary content. |
| protected boolean | _cfgInternNames
By default we do not force interning of names: can be reset by sub-classes. |
| protected boolean | _cfgInternNsURIs
By default we do not force interning of namespace URIs: can be reset by sub-classes. |
| protected final boolean | _cfgNsAware
Whether stream reader is to be namespace aware (as per property
|
| protected String | _coalescedText
In coalescing mode, we may need to combine textual content from multiple adjacent nodes. |
| protected final boolean | _coalescing
Whether stream reader is to coalesce adjacent textual
(CHARACTERS, SPACE, CDATA) events (as per property
|
| protected int | |
| protected Node | _currNode
Current node is the DOM node that contains information regarding the current event. |
| protected ValueDecoderFactory | _decoderFactory
Factory used for constructing decoders we need for typed access |
| protected int | |
| protected List | _nsDeclList
Lazily instantiated String pairs of all namespace declarations for the current (start/end) element. |
| protected final Node | |
| protected final String | |
| protected Stax2Util. | _textBuffer
Helper object used for combining segments of text as needed |
| protected static final int | |
| protected static final int | ERR_STATE_NOT_ELEM
Current state not START_ELEMENT or END_ELEMENT, should be |
| protected static final int | ERR_STATE_NOT_PI
Current state not PROCESSING_INSTRUCTION |
| protected static final int | ERR_STATE_NOT_START_ELEM
Current state not START_ELEMENT, should be |
| protected static final int | ERR_STATE_NOT_TEXTUAL
Current state not one where getText() can be used |
| protected static final int | |
| protected static final int | ERR_STATE_NOT_TEXTUAL_XXX
Current state not one where getTextXxx() can be used |
| protected static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| protected static final int |
| Access | Constructor and Description |
|---|---|
| protected | DOMWrappingReader(DOMSource
Node that is the tree of the DOM document, or fragment. src, boolean 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. nsAware, boolean Whether resulting reader should coalesce adjacent
text events or not coalescing)
|
| Modifier and Type | Method and Description |
|---|---|
| protected StringBase64Decoder | |
| private void | _calcNsAndAttrLists(boolean
Whether to include actual attributes too, or
just namespace declarations attrsToo)
|
| private QName | |
| protected TypedXMLStreamException | _constructTypeException(IllegalArgumentException
Problem as reported by converter iae, String Lexical value (element content, attribute value)
that could not be converted succesfully. lexicalValue)Method called to wrap or convert given conversion-fail exception
into a full |
| protected TypedXMLStreamException | |
| protected ValueDecoderFactory | |
| protected int | |
| protected String | |
| protected String | |
| private String | _safeGetLocalName(Node n)
Due to differences in how namespace-aware and non-namespace modes work in DOM, different methods are needed. |
| private final boolean | checkExpand(TypedArrayDecoder tad)
Internal method used to see if we can expand the buffer that the array decoder has. |
| public void | close()
Implements javax. Note as per StAX 1.0 specs, this method does NOT close the underlying input reader. |
| public void | closeCompletely()
Implements org. javax.,
except that this method also does close the underlying input
source if it has not yet been closed.
|
| protected void | |
| private String | |
| public int | findAttributeIndex(String nsURI, String localName)
Implements org. |
| protected String | |
| public final void | getAttributeAs(int index, TypedValueDecoder tvd)
Implements org. |
| public int | getAttributeAsArray(int index, TypedArrayDecoder tad)
Implements org. |
| public byte[] | getAttributeAsBinary(int
The attribute's index as returned by index)getAttributeIndex(String, String).Implements org. |
| public byte[] | getAttributeAsBinary(int index, Base64Variant v)
Implements org. |
| public boolean | getAttributeAsBoolean(int
The attribute's index as returned by index)getAttributeIndex(String, String)Implements org. Read an attribute value as a boolean. |
| public BigDecimal | getAttributeAsDecimal(int index)
Implements org. |
| public double | getAttributeAsDouble(int index)
Implements org. |
| public double[] | |
| public float | getAttributeAsFloat(int index)
Implements org. |
| public float[] | |
| public int | getAttributeAsInt(int
The attribute's index as returned by index)getAttributeIndex(String, String)Implements org. Read an attribute value as a boolean. |
| public int[] | getAttributeAsIntArray(int
The attribute's index as returned by index)getAttributeIndex(String, String).Implements org. Read an attribute content as an int array. |
| public BigInteger | getAttributeAsInteger(int index)
Implements org. |
| public long | getAttributeAsLong(int
The attribute's index as returned by index)getAttributeIndex(String, String)Implements org. Read an attribute value as a boolean. |
| public long[] | getAttributeAsLongArray(int index)
Implements org. |
| public QName | getAttributeAsQName(int index)
Implements org. |
| public int | getAttributeCount()
Implements javax. |
| public int | getAttributeIndex(String
The attribute's namespace URI. Values of
null and "" are considered the same, i.e. "no namespace"
(or "empty" namespace) namespaceURI, String The attribute's local name. localName)Implements org. localName and URI is namespaceURI
or -1 if no such attribute exists.
|
| public AttributeInfo | getAttributeInfo()
Implements org. |
| public String | getAttributeLocalName(int
the position of the attribute index)Implements javax. |
| public QName | getAttributeName(int
the position of the attribute index)Implements javax. |
| public String | getAttributeNamespace(int
the position of the attribute index)Implements javax. |
| public String | getAttributePrefix(int
the position of the attribute index)Implements javax. |
| public String | getAttributeType(int
the position of the attribute index)Implements javax. |
| public String | getAttributeValue(int
the position of the attribute index)Implements javax. |
| public String | getAttributeValue(String
the namespace of the attribute nsURI, String the local name of the attribute, cannot be null localName)Implements javax. |
| public String | getCharacterEncodingScheme()
Implements javax. |
| public XMLStreamLocation2 | getCurrentLocation()
Implements org. |
| public int | Returns: Number of open elements in the stack; 0 when parser is in prolog/epilog, 1 inside root element and so on.Implements org. |
| public DTDInfo | getDTDInfo()
Implements org. DTDInfo, method can just
return this.
|
| public String | Returns: Internal subset portion of the DOCTYPE declaration, if any; empty String if noneImplements org. |
| public String | |
| public String | |
| public String | |
| public void | getElementAs(TypedValueDecoder tvd)
Implements org. |
| public byte[] | getElementAsBinary()
Implements org. readElementAsBinary, in cases where neither performance nor
memory usage is a big concern.
|
| public byte[] | getElementAsBinary(Base64Variant
Base64 variant content is in; needed to decode
alternative variants ("modified base64") v)Implements org. readElementAsBinary, in cases where neither performance nor
memory usage is a big concern.
|
| public boolean | getElementAsBoolean()
Implements org. Read an element content as a boolean. |
| public BigDecimal | |
| public double | getElementAsDouble()
Implements org. Read an element content as a 64-bit floating point value. |
| public float | getElementAsFloat()
Implements org. Read an element content as a 32-bit floating point value. |
| public int | getElementAsInt()
Implements org. Read an element content as a 32-bit integer. |
| public BigInteger | |
| public long | getElementAsLong()
Implements org. Read an element content as a 64-bit integer. |
| public QName | |
| public String | getElementText()
Implements javax. 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. |
| public String | getEncoding()
Implements javax. |
| public long | getEndingByteOffset()
Implements org. |
| public long | getEndingCharOffset()
Implements org. |
| public final XMLStreamLocation2 | getEndLocation()
Implements org. |
| protected Location | |
| public int | getEventType()
Implements javax. |
| public Object | getFeature(String
Name of the feature of which value to get name)Implements org.
Deprecated
Method 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.
|
| public int | getIdAttributeIndex()
Implements org. |
| public String | getLocalName()
Implements javax. |
| public final Location | getLocation()
Implements javax. |
| public final LocationInfo | getLocationInfo()
Implements org. |
| public QName | getName()
Implements javax. |
| public NamespaceContext | getNamespaceContext()
Implements javax. |
| public int | getNamespaceCount()
Implements javax. |
| public String | getNamespacePrefix(int
the position of the namespace declaration index)Implements javax. |
| public String | getNamespaceURI()
Implements javax. |
| public String | getNamespaceURI(int
the position of the namespace declaration index)Implements javax. |
| public String | getNamespaceURI(String
prefix to look up prefix)Implements javax. |
| public NamespaceContext | getNonTransientNamespaceContext()
Implements org. javax.,
but one that is
not transient.
|
| public int | getNotationAttributeIndex()
Implements org. |
| public String | getPIData()
Implements javax. |
| public String | getPITarget()
Implements javax. |
| public String | getPrefix()
Implements javax. |
| public String | getPrefix(String
URI of Namespace to lookup namespaceURI)Implements javax. |
| public String | getPrefixedName()
Implements org. |
| public Iterator | getPrefixes(String
URI of Namespace to lookup namespaceURI)Implements javax. |
| public Object | |
| public DTDValidationSchema | getProcessedDTDSchema()
Implements org. getProcessedDTD, but type-safe.
|
| public abstract Object | getProperty(String
The name of the property, may not be null name)Redeclares javax. |
| public long | getStartingByteOffset()
Implements org. |
| public long | getStartingCharOffset()
Implements org. |
| public XMLStreamLocation2 | getStartLocation()
Implements org. |
| public String | getText()
Implements javax. |
| public int | Returns: Number of characters written to the readerWriter to use for writing textual contents w, boolean If true, reader has to preserve contents
so that further calls to preserveContents)getText 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 to getText is not guaranteed to
return meaningful data.Implements org. getText(), except
that it just uses provided Writer to write all textual content.
|
| public char[] | getTextCharacters()
Implements javax. |
| public int | getTextCharacters(int
the index of the first character in the source array to copy sourceStart, char[] the destination array target, int the start offset in the target array targetStart, int the number of characters to copy len)Implements javax. |
| public int | getTextLength()
Implements javax. |
| public int | getTextStart()
Implements javax. |
| public String | getVersion()
Implements javax. |
| private void | |
| private void | |
| public boolean | hasName()
Implements javax. |
| public boolean | hasNext()
Implements javax. |
| public boolean | hasText()
Implements javax. |
| public boolean | isAttributeSpecified(int
the position of the attribute index)Implements javax. |
| public boolean | isCharacters()
Implements javax. |
| public boolean | Returns: True, if cursor points to a start or end element that is constructed from 'empty' element (ends with'/>');
false otherwise.Implements org. |
| public boolean | isEndElement()
Implements javax. |
| public abstract boolean | isPropertySupported(String name)
Redeclares org. javax., used
to determine whether a property is supported by the Reader
instance.
|
| public boolean | isStandalone()
Implements javax. |
| public boolean | isStartElement()
Implements javax. |
| public boolean | isWhiteSpace()
Implements javax. |
| public int | next()
Implements javax. |
| public int | nextTag()
Implements javax. |
| public int | readElementAsArray(TypedArrayDecoder tad)
Implements org. |
| public int | readElementAsBinary(byte[] resultBuffer, int offset, int maxLength)
Implements org. |
| public int | readElementAsBinary(byte[]
Array in which to copy decoded bytes. resultBuffer, int Starting offset of the first decoded byte
within result buffer offset, int Maximum number of bytes to decode with this call maxLength, Base64Variant v)Implements org. |
| public int | readElementAsDoubleArray(double[] value, int from, int length)
Implements org. |
| public int | readElementAsFloatArray(float[] value, int from, int length)
Implements org. |
| public int | readElementAsIntArray(int[]
The array in which to copy the ints. value, int The index in the array from which copying starts. from, int The maximun number of ints to copy. Minimum value
is 1; others an length)IllegalArgumentException is thrownImplements org. |
| public int | readElementAsLongArray(long[] value, int from, int length)
Implements org. |
| protected void | |
| protected void | |
| public void | require(int
the event type type, String the uri of the event, may be null nsUri, String the localName of the event, may be null localName)Implements javax. |
| public void | setFeature(String
Name of the feature to set name, Object Value to set feature to. value)Implements org.
Deprecated
Method 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.
|
| protected void | |
| protected void | |
| public abstract boolean | Returns: True, if the specified property was succesfully set to specified value; false if its value was not changedName of the property to set name, Object Value to set property to. value)Redeclares org. org.
instance.
|
| public ValidationProblemHandler | setValidationProblemHandler(ValidationProblemHandler
Handler to install, if non null; if null, indicates that
the default (implementation-specific) handling should be used h)Implements org. |
| public void | skipElement()
Implements org. |
| public boolean | standaloneSet()
Implements javax. |
| public XMLValidator | stopValidatingAgainst(XMLValidationSchema schema)
Implements org. validateAgainst
was called earlier.
|
| public XMLValidator | stopValidatingAgainst(XMLValidator validator)
Implements org. |
| protected abstract void | |
| protected void | |
| public XMLValidator | validateAgainst(XMLValidationSchema schema)
Implements org. XMLValidator instance 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 to
stopValidatingAgainst.
|