View Source Exogiri.Xml.Node (exogiri v0.1.0)

Link to this section Summary

Types

t()

The Node type.

You've either managed to bork the XPath parser (rare), OR my C code is bad (put your money here).

Functions

Add a child node.

Add next sibling to a node.

Add previous sibling to a node.

Retrieve the value of an attribute on the node by name.

Return the children of a node.

Get the node content as a string.

Return the first element child of a node.

Return the last element child of a node.

Get the local name of a Node.

Get the namespace of a node, as {abbreviation, href}.

Get the list of namespaces in this node's context.

Return the next sibling of a node.

Return the parent of a node.

Return the previous sibling of a node.

Set the value of an attribute on the node by name.

Set the node content as a string.

Unlink a node from its parent.

Link to this section Types

Specs

t()

The Node type.

Specs

unknown_xpath_error() :: {:error, :unknown_error}

You've either managed to bork the XPath parser (rare), OR my C code is bad (put your money here).

Link to this section Functions

Link to this function

add_child(parent, child)

View Source

Specs

add_child(t(), t()) :: :ok

Add a child node.

It will be moved from the previous parent if already had one.

Link to this function

add_next_sibling(a, sibling)

View Source

Specs

add_next_sibling(t(), t()) :: :ok | :error

Add next sibling to a node.

Link to this function

add_previous_sibling(a, sibling)

View Source

Specs

add_previous_sibling(t(), t()) :: :ok | :error

Add previous sibling to a node.

Link to this function

attribute_value(a, attr_name)

View Source

Specs

attribute_value(t(), String.t()) :: String.t() | nil

Retrieve the value of an attribute on the node by name.

Specs

children(t()) :: [t()]

Return the children of a node.

Specs

content(t()) :: String.t() | nil

Get the node content as a string.

Specs

first_element_child(t()) :: nil | t()

Return the first element child of a node.

Specs

last_element_child(t()) :: nil | t()

Return the last element child of a node.

Specs

local_name(t()) :: binary()

Get the local name of a Node.

Get the namespace of a node, as {abbreviation, href}.

Get the list of namespaces in this node's context.

Specs

next_element_sibling(t()) :: nil | t()

Return the next sibling of a node.

Specs

parent(t()) :: nil | t()

Return the parent of a node.

Link to this function

previous_element_sibling(a)

View Source

Specs

previous_element_sibling(t()) :: nil | t()

Return the previous sibling of a node.

Link to this function

set_attribute_value(a, attr_name, attr_value)

View Source

Specs

set_attribute_value(t(), String.t(), String.t()) :: :ok

Set the value of an attribute on the node by name.

Specs

set_content(t(), String.t()) :: :ok

Set the node content as a string.

Specs

unlink(t()) :: :ok

Unlink a node from its parent.

Specs

xpath(t(), any(), any()) ::
  unknown_xpath_error() | {:error, [term()]} | {:ok, [t()]}