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

Encapsulates an XML element node.

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

Create a new node with no namespace.

Create a new node with no namespace.

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.

Run an XPath expression, with namespaces, using the node as the root.

Link to this section Types

Specs

t() :: %Exogiri.Xml.Node{ref: reference()}

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

Link to this function

new_no_ns(doc, node_name)

View Source

Specs

new_no_ns(Exogiri.Xml.Document.t(), String.t()) :: t()

Create a new node with no namespace.

Link to this function

new_with_ns(doc, node_name, ns_abbrev, ns_href)

View Source

Specs

new_with_ns(Exogiri.Xml.Document.t(), String.t(), nil | String.t(), String.t()) ::
  t()

Create a new node with no namespace.

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.

Link to this function

xpath(a, xpath_expression, nses)

View Source

Specs

xpath(t(), String.t(), map()) ::
  unknown_xpath_error() | {:error, [term()]} | {:ok, [t()]}

Run an XPath expression, with namespaces, using the node as the root.