LexingXmlStreamReader

An XmlStreamReader that provides XmlToken elements from an XmlLexer. This class internally maintains a peek state, lastToken, etc., but delegates all parsing operations to the scanner.

Parameters

source

The XmlLexer to use for XML parsing.

Constructors

Link copied to clipboard
constructor(source: XmlLexer)

Properties

Link copied to clipboard
open override var lastToken: XmlToken?

Return the last token that was consumed by the reader.

Functions

Link copied to clipboard
open override fun nextToken(): XmlToken?

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

Link copied to clipboard
open override fun peek(index: Int): 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
open override fun skipNext()

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

Link copied to clipboard
open override fun subTreeReader(subtreeStartDepth: XmlStreamReader.SubtreeStartDepth): 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.