ElementBuilder

zio.blocks.schema.xml.XmlBuilder.ElementBuilder
final case class ElementBuilder(name: XmlName, attributes: Chunk[(XmlName, String)], children: Chunk[Xml])

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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def attr(name: String, value: String): ElementBuilder

Adds an attribute with a string name.

Adds an attribute with a string name.

Value parameters

name

The attribute name

value

The attribute value

Attributes

Returns

A new ElementBuilder with the attribute added

Source
XmlBuilder.scala
def attr(name: XmlName, value: String): ElementBuilder

Adds an attribute with an XmlName (possibly namespaced).

Adds an attribute with an XmlName (possibly namespaced).

Value parameters

name

The attribute name (possibly with namespace)

value

The attribute value

Attributes

Returns

A new ElementBuilder with the attribute added

Source
XmlBuilder.scala
def build: Element

Builds and returns the final Element.

Builds and returns the final Element.

Attributes

Returns

The constructed Xml.Element

Source
XmlBuilder.scala
def child(xml: Xml): ElementBuilder

Adds a single child node.

Adds a single child node.

Value parameters

xml

The child node to add

Attributes

Returns

A new ElementBuilder with the child added

Source
XmlBuilder.scala
def children(xmls: Xml*): ElementBuilder

Adds multiple child nodes.

Adds multiple child nodes.

Value parameters

xmls

The child nodes to add

Attributes

Returns

A new ElementBuilder with all children added

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

Adds a text node as a child.

Adds a text node as a child.

Value parameters

value

The text content

Attributes

Returns

A new ElementBuilder with the text node added

Source
XmlBuilder.scala

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala