Yex.XmlFragmentPrelim (y_ex v0.8.0)

View Source

A preliminary xml fragment. It can be used to early initialize the contents of a XmlFragment.

Examples

iex> doc = Yex.Doc.new()
iex> array = Yex.Doc.get_array(doc, "array")
iex> Yex.Array.insert(array, 0,  Yex.XmlFragmentPrelim.new([Yex.XmlElementPrelim.empty("div")]))
iex> {:ok, %Yex.XmlFragment{} = fragment} = Yex.Array.fetch(array, 0)
iex> Yex.XmlFragment.to_string(fragment)
"<div></div>"

Summary

Functions

Creates a new preliminary XML fragment with the given children. The children can be a mix of XmlElementPrelim and XmlTextPrelim nodes.

Types

t()

@type t() :: %Yex.XmlFragmentPrelim{
  children: [Yex.XmlElementPrelim.t() | Yex.XmlTextPrelim.t()]
}

Functions

new(children)

Creates a new preliminary XML fragment with the given children. The children can be a mix of XmlElementPrelim and XmlTextPrelim nodes.

Parameters

  • children - A list or enumerable of preliminary XML nodes (elements or text)

Returns

  • A new XmlFragmentPrelim struct containing the provided children