Soap.XML.Element (Soap v2.0.0)

View Source

One XML element, with namespaces resolved.

scope holds the prefixes in force at this element, which is needed to read values that are themselves qualified names, such as type="xsd:string".

Summary

Functions

Reads an attribute that has no namespace.

Reads an attribute in namespace ns.

The first child element with this namespace and local name.

Child elements with this namespace and local name.

Expands a prefixed name into {namespace, local}.

Resolves a QName value such as tns:Foo using this element's prefixes.

Types

qname()

@type qname() :: {String.t() | nil, String.t()}

t()

@type t() :: %Soap.XML.Element{
  attrs: %{required(qname()) => String.t()},
  children: [t()],
  name: String.t(),
  ns: String.t() | nil,
  scope: %{required(String.t()) => String.t()},
  text: binary() | iodata()
}

Functions

attr(element, name, default \\ nil)

@spec attr(t(), String.t(), term()) :: String.t() | term()

Reads an attribute that has no namespace.

attr_ns(element, ns, name)

@spec attr_ns(t(), String.t(), String.t()) :: String.t() | nil

Reads an attribute in namespace ns.

child(element, ns, name)

@spec child(t(), String.t() | nil, String.t()) :: t() | nil

The first child element with this namespace and local name.

children(element, ns, name)

@spec children(t(), String.t() | nil, String.t()) :: [t()]

Child elements with this namespace and local name.

expand(name, scope, use_default?)

@spec expand(String.t(), map(), boolean()) :: qname()

Expands a prefixed name into {namespace, local}.

A prefix that was never declared resolves to no namespace. Only elements and QName values take the default namespace.

qname(element, value)

@spec qname(t(), String.t() | nil) :: qname() | nil

Resolves a QName value such as tns:Foo using this element's prefixes.