XmlStreamReader

interface XmlStreamReader

Provides stream-style access to an XML payload. This abstraction supports the ability to look ahead an arbitrary number of elements. It can also create "views" to subtrees of the document, guaranteeing that clients do not exceed bounds.

Inheritors

Types

Link copied to clipboard

Specify the depth for which a subtree is created.

Properties

Link copied to clipboard
abstract val lastToken: XmlToken?

Return the last token that was consumed by the reader.

Functions

Link copied to clipboard
abstract fun nextToken(): XmlToken?

Return the next actionable token or null if stream is exhausted.

Link copied to clipboard
abstract fun peek(index: Int = 1): XmlToken?

Peek at the next token type. Successive calls will return the same value, meaning there is only one look-ahead at any given time during the parsing of input data.

Link copied to clipboard
abstract fun skipNext()

Recursively skip the next token. Meant for discarding unwanted/unrecognized nodes in an XML document

Link copied to clipboard
abstract fun subTreeReader(subtreeStartDepth: XmlStreamReader.SubtreeStartDepth = SubtreeStartDepth.CHILD): XmlStreamReader

Return another reader that starts and terminates at the current level (CURRENT) or the current level + 1 (CHILD), starting at the next node to be read from the stream.

Inherited functions

Link copied to clipboard
inline fun <T : XmlToken> XmlStreamReader.peekSeek(selectionPredicate: (T) -> Boolean = { true }): T?

Peek and seek forward until a token of type T is found. If it matches the selectionPredicate, consume the token and return it. Otherwise, return null without consuming the token.

Link copied to clipboard
inline fun <T : XmlToken> XmlStreamReader.seek(selectionPredicate: (T) -> Boolean = { true }): T?

Seek from the current token onward to find a token of specified type and predication.