XmlDelegatingReader

open class XmlDelegatingReader(val delegate: XmlReader) : XmlReader

Simple baseclass for a delating XmlReader. It merely functions as a delegate. With Kotlin it's not really needed, but nice.

Inheritors

Constructors

Link copied to clipboard
protected constructor(delegate: XmlReader)

Properties

Link copied to clipboard
open override val attributeCount: Int

Get the amount of attributes on the current element

Link copied to clipboard

Get a range for the attributes in the reader

Link copied to clipboard

Get an array of all attributes in the current (startTag) event.

Link copied to clipboard
protected open val delegate: XmlReader
Link copied to clipboard
open override val depth: Int

Determine the current tag depth of the reader

Link copied to clipboard
open override val encoding: String?

The declared encoding for the document. Unlike general parsing, this value is accessible after reading the document element. The document element must be the first non-whitespace element. The value for this property before document element presence is known is implementation defined (and may change).

Link copied to clipboard
open override val eventType: EventType

Get the type of the current event.

Link copied to clipboard

Enhanced location info that allows a reader to provide more detail than just a string

Link copied to clipboard
open override val isKnownEntity: Boolean

For an unresolved entity determine whether it is known

Link copied to clipboard
open override val isStarted: Boolean

Determine whether parsing has started yet. When this is false it is invalid to check the state.

Link copied to clipboard
open override val localName: String

Retrieve the local name of the current tag

Link copied to clipboard
open override val name: QName

Retrieve the qualified name of the current tag

Link copied to clipboard

The current namespace context

Link copied to clipboard
open override val namespaceDecls: List<Namespace>

Retrieve the namespaces declared at the current level.

Link copied to clipboard
open override val namespaceURI: String

Retrieve the namespace URI of the current tag

Link copied to clipboard
open override val piData: String

Data for processing instructions.

Link copied to clipboard
open override val piTarget: String

Target for processing instructions.

Link copied to clipboard
open override val prefix: String

Retrieve the prefix of the current tag

Link copied to clipboard

Read a QName text from the reader. This will read prefix:localName values and resolve the namespace.

Link copied to clipboard
open override val standalone: Boolean?

The declared standalone status for the document. Unlike general parsing, this value is accessible after reading the document element. The document element must be the first non-whitespace element. The value for this property before document element presence is known is implementation defined (and may change).

Link copied to clipboard
open override val text: String

Get the text content for textual events.

Link copied to clipboard
open override val version: String?

The declared xml version for the document. Unlike general parsing, this value is accessible after reading the document element. The document element must be the first non-whitespace element. The value for this property before document element presence is known is implementation defined (and may change).

Functions

Link copied to clipboard

Get the next text sequence in the reader. This will skip over comments and ignorable whitespace (starting the content), but not tags. Any tags encountered with cause an exception to be thrown. It can either be invoked when in a start tag to return all text content, or on a content element to include it (if text or cdata) and all subsequent siblings.

Link copied to clipboard

Create a new reader that only returns the current element and its descendents. Such sub-reader ensures that the user of the return value does not exceed this stream.

Link copied to clipboard
open override fun close()

Close the reader

Link copied to clipboard

Differs from .siblingsToFragment in that it skips the current event.

Link copied to clipboard

Read the current element (and content) only into a fragment.

Link copied to clipboard
open override fun getAttributeLocalName(index: Int): String

Get the local name for the attribute at the given index.

Link copied to clipboard
open override fun getAttributeName(index: Int): QName

Get the qualified name for the attribute at the given index.

Link copied to clipboard
open override fun getAttributeNamespace(index: Int): String

Get the namespace URI for the attribute at the given index.

Link copied to clipboard
open override fun getAttributePrefix(index: Int): String

Get the prefix for the attribute at the given index.

Link copied to clipboard
open override fun getAttributeValue(index: Int): String

Get the value of the attribute at the given index.

open override fun getAttributeValue(name: QName): String?
open override fun getAttributeValue(nsUri: String?, localName: String): String?

Get the value of the attribute with the given name if it exists.

Link copied to clipboard
open override fun getNamespacePrefix(namespaceUri: String): String?

Get a prefix for the given namespace URI, or null if there is none.

Link copied to clipboard
open override fun getNamespaceURI(prefix: String): String?

Get the namespace for the given prefix, if any

Link copied to clipboard
open operator override fun hasNext(): Boolean
Link copied to clipboard
open override fun isCharacters(): Boolean

Is the currrent element character content

Link copied to clipboard
fun XmlReader.isElement(elementname: QName): Boolean

Determine whether the current event of the XMLReader is an element with the given name. Note that this ignores the prefix of the name.

fun XmlReader.isElement(type: EventType, elementname: QName): Boolean
fun XmlReader.isElement(elementNamespace: String?, elementName: String, elementPrefix: String? = null): Boolean
fun XmlReader.isElement(type: EventType, elementNamespace: String?, elementName: String, elementPrefix: String? = null): Boolean

Check that the current state is a start element for the given name. The mPrefix is ignored.

Link copied to clipboard
open override fun isEndElement(): Boolean

Determine whether the current event is an end tag

Link copied to clipboard

Determine whether the current event in the reader is ignorable. This ignores: comments, start/end document, processing instructions, document declarations, ignorable whitespace, and text that is effectively xml whitespace.

Link copied to clipboard

Determine whether the given prefix is known in the reader (up to this point). This can be used for reading text that could reference a namespace prefix (e.g. when parsing XPath expressions).

Link copied to clipboard
open override fun isStartElement(): Boolean

Is the current element a start tag

Link copied to clipboard
open override fun isWhitespace(): Boolean

Determine whether the current state is effective whitespace, for text it will check the text.

Link copied to clipboard
open operator override fun next(): EventType
Link copied to clipboard
open override fun nextTag(): EventType

Overridden such that it will be valid, even when overriding next.

Link copied to clipboard

From a start tag read the text only content of the element. Comments are allowed and handled, but subtags are not allowed. This tag finishes at the end of the element.

Link copied to clipboard
open override fun require(type: EventType, name: QName?)
open override fun require(type: EventType, namespace: String?, name: String?)

Check the current state for non-null values.

Link copied to clipboard
open override fun requireNext(type: EventType, name: QName?)
open override fun requireNext(type: EventType, namespace: String?, name: String?)

Check that the next element is as required. null values are not checked.

Link copied to clipboard
open override fun requireNextTag(type: EventType, name: QName?)
open override fun requireNextTag(type: EventType, namespace: String?, name: String?)

Check that the next tag element is as required. null values are not checked.

Link copied to clipboard

Read the current event and all subsequent siblings into a compact fragment.

Link copied to clipboard

From a start element, skip all element content until the corresponding end element has been read. After invocation the end element has just been read (and would be returned on relevant state calls).

Link copied to clipboard

Skil the preamble events in the stream reader

Link copied to clipboard

Write all the remaining content of the reader to a CharArrayWriter. Note that this likely fails if the reader is not at the start (as the writer would fail due to an invalid XML document).

Link copied to clipboard

Create an XmlEvent for the current event in an XmlReader.

Link copied to clipboard

Write the current event to the writer. This will not move the reader.