Sassone.XML (Sassone v1.0.0)

View Source

Helper functions for building XML elements.

Summary

Functions

Builds attribute in simple form.

Builds a struct deriving Sassone.Builder for encoding with Sassone.encode!/2

Builds CDATA in simple form.

Builds characters in simple form.

Builds comment in simple form.

Builds empty element in simple form.

Builds processing instruction in simple form.

Builds reference in simple form.

Types

attribute()

@type attribute() :: {namespace(), name(), value()}

cdata()

@type cdata() :: {:cdata, String.t()}

character_type()

@type character_type() :: :entity | :hexadecimal | :decimal

characters()

@type characters() :: {:characters, String.t()}

comment()

@type comment() :: {:comment, String.t()}

content()

@type content() :: element() | characters() | cdata() | ref() | comment() | String.t()

dec_ref()

@type dec_ref() :: {:reference, {:decimal, integer()}}

element()

@type element() :: {namespace(), name(), [attribute()], [content()]}

entity_ref()

@type entity_ref() :: {:reference, {:entity, String.t()}}

hex_ref()

@type hex_ref() :: {:reference, {:hexadecimal, integer()}}

name()

@type name() :: String.t()

namespace()

@type namespace() :: String.t() | nil

processing_instruction()

@type processing_instruction() ::
  {:processing_instruction, name(), instruction :: String.t()}

ref()

@type ref() :: entity_ref() | hex_ref() | dec_ref()

value()

@type value() :: term()

Functions

attribute(namespace \\ nil, name, value)

@spec attribute(namespace(), name(), value()) :: attribute()

Builds attribute in simple form.

build(struct)

@spec build(Sassone.Builder.t()) :: element()

Builds a struct deriving Sassone.Builder for encoding with Sassone.encode!/2

cdata(text)

@spec cdata(text :: term()) :: cdata()

Builds CDATA in simple form.

characters(text)

@spec characters(text :: term()) :: characters()

Builds characters in simple form.

comment(text)

@spec comment(text :: term()) :: comment()

Builds comment in simple form.

element(namespace \\ nil, name, attributes, children)

@spec element(namespace(), name(), [attribute()], [content()]) :: element()

Builds element in simple form.

empty_element(namespace \\ nil, name, attributes)

@spec empty_element(namespace(), name(), [attribute()]) :: element()

Builds empty element in simple form.

processing_instruction(name, instruction)

@spec processing_instruction(String.t(), String.t()) :: processing_instruction()

Builds processing instruction in simple form.

reference(character_type, name)

@spec reference(character_type(), value :: term()) :: ref()

Builds reference in simple form.