ExSaml.Core.Xml.C14n (ex_saml v1.0.2)

Copy Markdown View Source

XML Canonicalization (C14N) for xmerl data structures.

Implements the W3C Exclusive XML Canonicalization specification: http://www.w3.org/TR/xml-c14n

Operates on xmerl records (xmlElement, xmlAttribute, etc.).

Summary

Functions

Puts an XML document or element into canonical form, as a string.

Puts an XML document or element into canonical form, as a string.

Puts an XML document or element into canonical form, as a string.

Returns the canonical namespace-URI-prefix-resolved version of an XML name.

Make XML content safe (non-quoted context).

Make XML content safe. If quotes is true, also escapes double quotes.

Types

xml_thing()

@type xml_thing() ::
  {:xmlDocument, content :: term()}
  | {:xmlElement, name :: term(), expanded_name :: term(), nsinfo :: term(),
     namespace :: term(), parents :: term(), pos :: term(),
     attributes :: term(), content :: term(), language :: term(),
     xmlbase :: term(), elementdef :: term()}
  | {:xmlAttribute, name :: term(), expanded_name :: term(), nsinfo :: term(),
     namespace :: term(), parents :: term(), pos :: term(), language :: term(),
     value :: term(), normalized :: term()}
  | {:xmlPI, name :: term(), parents :: term(), pos :: term(), value :: term()}
  | {:xmlText, parents :: term(), pos :: term(), language :: term(),
     value :: term(), type :: term()}
  | {:xmlComment, parents :: term(), pos :: term(), language :: term(),
     value :: term()}

Functions

c14n(elem)

@spec c14n(xml_thing()) :: String.t()

Puts an XML document or element into canonical form, as a string.

c14n(elem, comments)

@spec c14n(xml_thing(), boolean()) :: String.t()

Puts an XML document or element into canonical form, as a string.

If comments is true, preserves comments in the output.

c14n(elem, comments, inclusive_ns)

@spec c14n(xml_thing(), boolean(), [String.t()]) :: String.t()

Puts an XML document or element into canonical form, as a string.

If comments is true, preserves comments in the output. Any namespace prefixes listed in inclusive_ns will be left as they are and not modified during canonicalization.

canon_name(rec)

@spec canon_name(
  {:xmlElement, name :: term(), expanded_name :: term(), nsinfo :: term(),
   namespace :: term(), parents :: term(), pos :: term(), attributes :: term(),
   content :: term(), language :: term(), xmlbase :: term(),
   elementdef :: term()}
  | {:xmlAttribute, name :: term(), expanded_name :: term(), nsinfo :: term(),
     namespace :: term(), parents :: term(), pos :: term(), language :: term(),
     value :: term(), normalized :: term()}
) :: String.t()

Returns the canonical namespace-URI-prefix-resolved version of an XML name.

xml_safe_string(term)

@spec xml_safe_string(term()) :: charlist()

Make XML content safe (non-quoted context).

xml_safe_string(atom, quotes)

@spec xml_safe_string(term(), boolean()) :: charlist()

Make XML content safe. If quotes is true, also escapes double quotes.

xmlAttribute(args \\ [])

(macro)

xmlAttribute(record, args)

(macro)

xmlComment(args \\ [])

(macro)

xmlComment(record, args)

(macro)

xmlDocument(args \\ [])

(macro)

xmlDocument(record, args)

(macro)

xmlElement(args \\ [])

(macro)

xmlElement(record, args)

(macro)

xmlNamespace(args \\ [])

(macro)

xmlNamespace(record, args)

(macro)

xmlPI(args \\ [])

(macro)

xmlPI(record, args)

(macro)

xmlText(args \\ [])

(macro)

xmlText(record, args)

(macro)