XmlBuilder

zio.blocks.schema.xml.XmlBuilder
object XmlBuilder

A fluent builder for constructing XML nodes programmatically.

Provides factory methods for creating XML nodes and an ElementBuilder class for building elements with a fluent API.

Example:

val elem = XmlBuilder.element("root")
 .attr("id", "1")
 .attr("class", "main")
 .child(XmlBuilder.element("child").text("content").build)
 .build

Attributes

Source
XmlBuilder.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
XmlBuilder.type

Members list

Type members

Classlikes

final case class ElementBuilder(name: XmlName, attributes: Chunk[(XmlName, String)], children: Chunk[Xml])

A fluent builder for constructing XML elements.

A fluent builder for constructing XML elements.

Accumulates attributes and children, allowing them to be added in any order via method chaining.

Value parameters

attributes

Accumulated attributes

children

Accumulated children

name

The element name

Attributes

Source
XmlBuilder.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def cdata(value: String): CData

Creates a CData node with the given content.

Creates a CData node with the given content.

Value parameters

value

The CDATA content

Attributes

Returns

A CData node

Source
XmlBuilder.scala
def comment(value: String): Comment

Creates a Comment node with the given content.

Creates a Comment node with the given content.

Value parameters

value

The comment content

Attributes

Returns

A Comment node

Source
XmlBuilder.scala
def element(name: String): ElementBuilder

Creates an ElementBuilder for constructing an element with the given local name.

Creates an ElementBuilder for constructing an element with the given local name.

Value parameters

name

The local name of the element

Attributes

Returns

An ElementBuilder for fluent construction

Source
XmlBuilder.scala

Creates an ElementBuilder for constructing an element with the given XmlName.

Creates an ElementBuilder for constructing an element with the given XmlName.

Value parameters

name

The XmlName (possibly with namespace) of the element

Attributes

Returns

An ElementBuilder for fluent construction

Source
XmlBuilder.scala
def processingInstruction(target: String, data: String): ProcessingInstruction

Creates a ProcessingInstruction node with the given target and data.

Creates a ProcessingInstruction node with the given target and data.

Value parameters

data

The processing instruction data

target

The processing instruction target

Attributes

Returns

A ProcessingInstruction node

Source
XmlBuilder.scala
def text(value: String): Text

Creates a Text node with the given content.

Creates a Text node with the given content.

Value parameters

value

The text content

Attributes

Returns

A Text node

Source
XmlBuilder.scala