← all modules

Std.Xml.Encode

Std.Xml.Encode
  Std.Xml.Encode — write XML, in the style of `Json.Encode`.

Types
  type Xml
  type Attribute

Values
  attribute : String -> String -> Attribute
      An attribute: `attribute "href" "/a?b=1&c=2"`. The value is escaped.
  cdata : String -> Xml
      A CDATA section (`<![CDATA[…]]>`). A `]]>` inside is split across two
  document : Int -> Xml -> String
      `encode` with the XML declaration first:
  element : String -> List Attribute -> List Xml -> Xml
      An element with its attributes (in order) and children (in order). An
  encode : Int -> Xml -> String
      Write XML as text. `indent` is the spaces per level (`0` writes one
  encodeStrict : Int -> Xml -> Result Error String
      `encode`, but an `Err` when a name or a character cannot be written as
  text : String -> Xml
      Character data. `&`, `<` and `>` are escaped.
  xmlns : String -> Attribute
      The default namespace declaration: `xmlns "http://www.w3.org/2005/Atom"`
  xmlnsPrefix : String -> String -> Attribute
      A prefixed namespace declaration: `xmlnsPrefix "media" uri` is