KiteXmlToken

sealed class KiteXmlToken(source)

A tiny, forgiving XML reader: enough for EPUB's container.xml and OPF, for (X)HTML content, and for SVG.

Comments, the XML/DOCTYPE prologue, CDATA delimiters and processing instructions are skipped, but for the comments of a caller that asks for them, and malformed markup is salvaged rather than rejected, because real files are messy. Names lose their namespace prefix and are lowercased, so <epub:switch epub:type="x"> reads as tag switch with attribute type.

val root = KiteXml.parse(svgBytes.decodeToString())
val width = root.attrs["width"]

Inheritors

Types

Link copied to clipboard
data class Close(val name: String) : KiteXmlToken
Link copied to clipboard
data class Comment(val text: String) : KiteXmlToken

A comment's data, the text between <!--` and `-->, which only a tokenizer asked to keep them gives.

Link copied to clipboard
data class Open(val name: String, val attrs: Map<String, String>, val selfClose: Boolean) : KiteXmlToken
Link copied to clipboard
data class Text(val text: String) : KiteXmlToken