View Source Yex.XmlElement (y_ex v0.6.3)

A shared type that represents an XML node

Summary

Types

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

Functions

@spec children(t()) :: Enumerable.t(t() | Yex.XmlText.t())
Link to this function

delete(xml_element, index, length)

View Source
@spec delete(t(), integer(), integer()) :: :ok | :error
Link to this function

fetch(xml_element, index)

View Source
@spec fetch(t(), integer()) :: {:ok, t() | Yex.XmlText.t()} | :error
@spec fetch(t(), integer()) :: t() | Yex.XmlText.t()
Link to this function

first_child(xml_element)

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

get_attribute(xml_element, key)

View Source
@spec get_attribute(t(), binary()) :: binary() | nil
Link to this function

get_attributes(xml_element)

View Source
@spec get_attributes(t()) :: map()
Link to this function

insert(xml_element, index, content)

View Source
@spec insert(t(), integer(), Yex.XmlElementPrelim.t() | Yex.XmlTextPrelim.t()) ::
  :ok | :error
Link to this function

insert_after(xml_fragment, ref, content)

View Source
@spec insert_after(
  t(),
  t() | Yex.XmlText.t(),
  Yex.XmlElementPrelim.t() | Yex.XmlTextPrelim.t()
) :: :ok | :error
Link to this function

insert_attribute(xml_element, key, value)

View Source
@spec insert_attribute(t(), binary(), binary()) :: :ok | :error
@spec length(t()) :: integer()
Link to this function

next_sibling(xml_element)

View Source
@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.

@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.

Link to this function

prev_sibling(xml_element)

View Source
@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.

Link to this function

push(xml_element, content)

View Source
@spec push(t(), Yex.XmlElementPrelim.t() | Yex.XmlTextPrelim.t()) :: :ok | :error
Link to this function

remove_attribute(xml_element, key)

View Source
@spec remove_attribute(t(), binary()) :: :ok | :error
@spec to_string(t()) :: binary()
Link to this function

unshift(xml_element, content)

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