Package-level declarations

Core package for a wrapper that provides XML pull parsing access. Note that the implementations may do some adjustments beyond what is provided by the underlying implementation to improve compatibility across platforms. The access point to the package/module is (XmlStreaming)nl.adaptivity.xml.XmlStreaming.

Core package for a wrapper that provides XML pull parsing access. Note that the implementations may do some adjustments beyond what is provided by the underlying implementation to improve compatibility across platforms. The access point to the package/module is (XmlStreaming)nl.adaptivity.xml.XmlStreaming.

Core package for a wrapper that provides XML pull parsing access. Note that the implementations may do some adjustments beyond what is provided by the underlying implementation to improve compatibility across platforms. The access point to the package/module is (XmlStreaming)nl.adaptivity.xml.XmlStreaming.

Core package for a wrapper that provides XML pull parsing access. Note that the implementations may do some adjustments beyond what is provided by the underlying implementation to improve compatibility across platforms. The access point to the package/module is (XmlStreaming)nl.adaptivity.xml.XmlStreaming.

Core package for a wrapper that provides XML pull parsing access. Note that the implementations may do some adjustments beyond what is provided by the underlying implementation to improve compatibility across platforms. The access point to the package/module is (XmlStreaming)nl.adaptivity.xml.XmlStreaming.

Core package for a wrapper that provides XML pull parsing access. Note that the implementations may do some adjustments beyond what is provided by the underlying implementation to improve compatibility across platforms. The access point to the package/module is (XmlStreaming)nl.adaptivity.xml.XmlStreaming.

Types

Link copied to clipboard

Android version of the streaming factory.

Link copied to clipboard
class AndroidXmlReader(val parser: XmlPullParser)

And XMLReader implementation that works on Android

Link copied to clipboard
class DomReader(val delegate: Node) : XmlReader

Created by pdvrieze on 22/03/17.

Link copied to clipboard
class DomWriter(current: Node?, val isAppend: Boolean = false, val xmlDeclMode: XmlDeclMode = XmlDeclMode.None) : PlatformXmlWriterBase, XmlWriter

Writer that uses the DOM for the underlying storage (rather than writing to some string).

Link copied to clipboard

Enum representing the type of an xml node/event.

Link copied to clipboard

Namespace context that allows iterating over the namespaces.

Link copied to clipboard
interface IXmlStreaming
Link copied to clipboard
interface Namespace

Interface that represents a namespace with prefix and uri.

Link copied to clipboard
expect interface NamespaceContext

Interface that provides access to namespace queries

actual interface NamespaceContext
Link copied to clipboard

Type alias that allows cross-platform reference to the platform reader.

actual typealias PlatformXmlReader = KtXmlReader

This class provides access to the XmlReader implementation for the platform. using an independent name.

This class provides access to the XmlReader implementation for the platform. using an independent name.

actual typealias PlatformXmlReader = DomReader
actual typealias PlatformXmlReader = StAXReader
Link copied to clipboard
actual typealias PlatformXmlWriter = <Error class: unknown class>
actual typealias PlatformXmlWriter = KtXmlWriter

This class provides access to the XmlWriter implementation for the platform. using an independent name.

This class provides access to the XmlWriter implementation for the platform. using an independent name.

actual typealias PlatformXmlWriter = DomWriter
actual typealias PlatformXmlWriter = StAXWriter
Link copied to clipboard
expect class QName(namespaceURI: String, localPart: String, prefix: String)
actual typealias QName = javax.xml.namespace.QName
actual class QName(namespaceURI: String, localPart: String, prefix: String)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A simple namespace context that stores namespaces in a single array Created by pdvrieze on 24/08/15.

Link copied to clipboard
class StAXReader(delegate: XMLStreamReader)

An implementation of XmlReader based upon the JDK StAX implementation.

Link copied to clipboard
Link copied to clipboard
class StAXWriter(val delegate: XMLStreamWriter, val xmlDeclMode: <Error class: unknown class> = XmlDeclMode.None, val autoCloseEmpty: Boolean = true)

An implementation of XmlWriter that uses an underlying stax writer. Created by pdvrieze on 16/11/15.

Link copied to clipboard

An xml reader that has a buffer that allows peeking events as well as injecting events into the stream. Note that this class does not do any validation of the xml. If injecting/removing elements into/from the buffer you can create invalid XML.

Link copied to clipboard
abstract class XmlBufferedReaderBase(delegate: XmlReader) : XmlReader
Link copied to clipboard
class XmlBufferedWriter constructor(buffer: MutableList<XmlEvent> = mutableListOf(), delegateNamespaceContext: FreezableNamespaceContext?) : XmlWriter
Link copied to clipboard

A reader that presents a list of events as an xml reader. This is designed to work together with XmlBufferedWriter

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard
abstract class XmlDelegatingWriter(delegate: XmlWriter) : XmlWriter

Simple delegating writer that passes all calls on to the delegate. This class is abstract for the only reason that any direct instances of this class make little sense.

Link copied to clipboard
sealed class XmlEvent

A class to represent the events that can occur in XML Documents

Link copied to clipboard
open class XmlException : IOException

Simple exception for xml related things. Created by pdvrieze on 15/11/15.

Link copied to clipboard
interface XmlReader : Closeable, Iterator<EventType>

Interface that is the entry point to the xml parsing. All implementations implement this interface, generally by delegating to a platform specific parser.

Link copied to clipboard
interface XmlSerializable
Link copied to clipboard
expect interface XmlStreamingFactory
actual interface XmlStreamingFactory
actual interface XmlStreamingFactory
Link copied to clipboard

Annotation to signify that the annotated code is internal to the XmlUtil module, and no API stability is guaranteed.

Link copied to clipboard
interface XmlWriter : Closeable

Interface representing the (wrapper) type that allows generating xml documents.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
const val DEFAULT_FLAGS: Int

The default used flags

Link copied to clipboard
const val FLAG_OMIT_XMLDECL: Int = 1

Flag to indicate that the xml declaration should be omitted, when possible.

Link copied to clipboard
const val FLAG_REPAIR_NS: Int = 2

Flag to indicate that the namespace usable should be automatically repaired.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Consume all text and non-content (comment/processing instruction) to get an uninterrupted text sequence. This will skip over comments but not ignorable whitespace that starts the string, but not tags. Any tags encountered will lead to a return of this function. 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

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

Convert a prefixed element name (CNAME) to a qname. If there is no prefix, the default prefix is used.

Link copied to clipboard
Link copied to clipboard

Consume all text and non-content (comment/processing instruction) to get an uninterrupted text sequence. This will skip over comments and ignorable whitespace that starts the string, but not tags. Any tags encountered will lead to a return of this function. 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
inline fun <T : Any> deserialize(input: InputStream): T
inline fun <T : Any> deserialize(input: Reader): T
inline fun <T : Any> deserialize(input: String): T
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
fun XmlWriter.endTag(predelemname: QName)
Link copied to clipboard
Link copied to clipboard
fun XmlReader.isElement(elementname: QName): Boolean

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
infix fun QName.isEquivalent(other: QName): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Determine whether the character is xml whitespace.

Link copied to clipboard
fun IXmlStreaming.newGenericWriter(output: Appendable, isRepairNamespaces: Boolean = false, xmlDeclMode: XmlDeclMode = XmlDeclMode.None): KtXmlWriter
Link copied to clipboard
Link copied to clipboard
fun <Error class: unknown class>.newWriter(writer: Writer, repairNamespaces: Boolean = false, xmlDeclMode: <Error class: unknown class> = XmlDeclMode.None): <Error class: unknown class>
expect fun IXmlStreaming.newWriter(output: Appendable, repairNamespaces: Boolean = false, xmlDeclMode: XmlDeclMode = XmlDeclMode.None): XmlWriter
expect fun IXmlStreaming.newWriter(writer: Writer, repairNamespaces: Boolean = false, xmlDeclMode: XmlDeclMode = XmlDeclMode.None): XmlWriter
actual fun IXmlStreaming.newWriter(output: Appendable, repairNamespaces: Boolean, xmlDeclMode: XmlDeclMode): XmlWriter
actual fun IXmlStreaming.newWriter(writer: Writer, repairNamespaces: Boolean, xmlDeclMode: XmlDeclMode): XmlWriter
fun <Error class: unknown class>.newWriter(writer: Writer, repairNamespaces: Boolean = false, xmlDeclMode: <Error class: unknown class> = XmlDeclMode.None): <Error class: unknown class>
Link copied to clipboard
fun qname(namespaceUri: String?, localname: String, prefix: String? = DEFAULT_NS_PREFIX): QName
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
fun <Error class: unknown class>.serialize(node: Node)
fun <Error class: unknown class>.serialize(node: Node)
Link copied to clipboard
inline fun <T : XmlSerializable> XmlWriter.serializeAll(iterable: Iterable<T>)
inline fun <T : XmlSerializable> XmlWriter.serializeAll(sequence: Sequence<T>)
Link copied to clipboard

Read the current element (and content) and all its siblings into a fragment.

Read the current element (and content) and all its siblings into a 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
inline fun XmlWriter.smartStartTag(qName: QName, body: XmlWriter.() -> Unit)
fun XmlWriter.smartStartTag(nsUri: String?, localName: String, prefix: String? = null)

Enhanced function for writing start tags, that will attempt to reuse prefixes.

inline fun XmlWriter.smartStartTag(nsUri: String?, localName: String, prefix: String? = null, body: XmlWriter.() -> Unit)
Link copied to clipboard
inline fun XmlWriter.startTag(nsUri: String?, localName: String, prefix: String? = null, body: XmlWriter.() -> Unit)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Convert the string as fqn literal to an actual qname

Convert the string as fqn literal to actual name, but use the namespace parameter to fill in namespace (but not prefix)

Link copied to clipboard
fun XmlWriter.writeAttribute(name: String, value: Any?)
fun XmlWriter.writeAttribute(name: String, value: Long)
fun XmlWriter.writeAttribute(name: String, value: QName?)
fun XmlWriter.writeAttribute(name: QName, value: String?)
Link copied to clipboard
fun <Error class: unknown class>.writeChild(node: Node)
fun <Error class: unknown class>.writeChild(node: Node)
Link copied to clipboard

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

Link copied to clipboard
Link copied to clipboard
fun XmlWriter.writeElement(missingNamespaces: MutableMap<String, String>?, reader: XmlReader)

Write

Link copied to clipboard
fun XmlWriter.writeElementContent(missingNamespaces: MutableMap<String, String>?, reader: XmlReader)

Write the child content of the current element in the reader to the output This does not write the container itself

Link copied to clipboard
inline fun <T> XmlWriter.writeListIfNotEmpty(iterable: Iterable<T>, nsUri: String?, localName: String, prefix: String? = null, body: XmlWriter.(T) -> Unit)

Helper function for writing a list only if it contains any element.

Link copied to clipboard
fun XmlWriter.writeSimpleElement(nsUri: String?, localName: String, prefix: String?, value: String?)
Link copied to clipboard
Link copied to clipboard