View Source Yex.XmlElement (y_ex v0.7.1)

A shared type that represents an XML node

Summary

Types

t()

@type t() :: %Yex.XmlElement{doc: Yex.Doc.t(), reference: reference()}

Functions

children(xml_element)

@spec children(t()) :: Enumerable.t(t() | Yex.XmlText.t())

delete(xml_element, index, length)

@spec delete(t(), integer(), integer()) :: :ok | :error

fetch(xml_element, index)

@spec fetch(t(), integer()) :: {:ok, t() | Yex.XmlText.t()} | :error
@spec fetch(t(), integer()) :: t() | Yex.XmlText.t()

fetch!(map, index)

first_child(xml_element)

@spec first_child(t()) :: t() | Yex.XmlText.t() | nil

get(xml_element, index)

This function is deprecated. Rename to `fetch/2`.
@spec get(t(), integer()) :: {:ok, t() | Yex.XmlText.t()} | :error

get_attribute(xml_element, key)

@spec get_attribute(t(), binary()) :: binary() | nil

get_attributes(xml_element)

@spec get_attributes(t()) :: map()

get_tag(xml_element)

@spec get_tag(t()) :: binary() | nil

Get the tag of the xml element.

insert(xml_element, index, content)

@spec insert(t(), integer(), Yex.XmlElementPrelim.t() | Yex.XmlTextPrelim.t()) ::
  :ok | :error

insert_after(xml_element, ref, content)

@spec insert_after(
  t(),
  t() | Yex.XmlText.t(),
  Yex.XmlElementPrelim.t() | Yex.XmlTextPrelim.t()
) :: :ok | :error

insert_attribute(xml_element, key, value)

@spec insert_attribute(t(), binary(), binary()) :: :ok | :error

length(xml_element)

@spec length(t()) :: integer()

next_sibling(xml_element)

@spec next_sibling(t()) :: t() | Yex.XmlText.t() | nil

The next sibling of this type. Is null if this is the last child of its parent.

parent(xml_element)

@spec parent(t()) :: t() | Yex.XmlFragment.t() | nil

The parent that holds this type. Is null if this xml is a top-level XML type.

prev_sibling(xml_element)

@spec prev_sibling(t()) :: t() | Yex.XmlText.t() | nil

The previous sibling of this type. Is null if this is the first child of its parent.

push(xml_element, content)

@spec push(t(), Yex.XmlElementPrelim.t() | Yex.XmlTextPrelim.t()) :: :ok | :error

remove_attribute(xml_element, key)

@spec remove_attribute(t(), binary()) :: :ok | :error

to_string(xml_element)

@spec to_string(t()) :: binary()

unshift(xml_element, content)

@spec unshift(t(), Yex.XmlElementPrelim.t() | Yex.XmlTextPrelim.t()) :: :ok | :error