XmlContentBuilder

A dedicated builder for creating XML content. Wraps TextContentBuilder and provides XML-specific functionality.

Constructors

Link copied to clipboard
constructor(indented: Boolean)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun br()
Link copied to clipboard
fun build(): String
Link copied to clipboard
fun cdata(content: String)

Adds a CDATA section to the content.

Link copied to clipboard
fun comment(comment: String)

Adds an XML comment to the content.

Link copied to clipboard
fun doctype(rootElement: String, publicId: String? = null, systemId: String? = null)

Adds a DOCTYPE declaration to the content.

Link copied to clipboard
fun newline()
Link copied to clipboard
operator fun String.not()
Link copied to clipboard
fun padding(padding: String, body: TextContentBuilder.() -> Unit)
Link copied to clipboard
fun processingInstruction(target: String, data: String)

Adds a processing instruction to the content.

Link copied to clipboard
fun selfClosingTag(name: String, attributes: LinkedHashMap<String, String> = linkedMapOf())

Creates a self-closing XML tag with the given name and attributes.

Link copied to clipboard
fun tag(name: String, attributes: LinkedHashMap<String, String> = linkedMapOf(), block: XmlContentBuilder.() -> Unit = {})

Creates an XML tag with the given name, attributes, and content.

Link copied to clipboard
fun text(text: String)
Link copied to clipboard
Link copied to clipboard
open operator override fun String.unaryPlus()
Link copied to clipboard
inline fun TextContentBuilder.xml(indented: Boolean = true, init: XmlContentBuilder.() -> Unit)

Extension function to add XML content to a TextContentBuilder.

Link copied to clipboard
fun xmlDeclaration(version: String = "1.0", encoding: String = "UTF-8", standalone: Boolean? = null)

Adds an XML declaration to the document.