eeue56/elm-xml/1.2.0

NOTE: this package is not compatible with Elm 0.19.1

Xml.Encode

Use this module for turning your Elm data into an `Xml` representation that can be either
queried or decoded, or turned into a string.
type Value
= Tag String (Dict String Value) Value
| StrNode String
| IntNode Int
| FloatNode Float
| BoolNode Bool
| Object (List Value)
| DocType String (Dict String Value)

Representation of the XML tree

encode : Int -> Value -> String

Take a value, then generate a string from it

string : String -> Value

Encode a string >>> string "hello" |> encode 0 "hello"

int : Int -> Value

Encode an int >>> int 15 |> encode 0 "15"

float : Float -> Value

Encode a float >>> float 1.576 |> encode 0 "1.576"

bool : Bool -> Value

Encode a bool >>> bool True |> encode 0 "true"

>>> bool True |> encode 0
"true"
object : List ( String, Dict String Value, Value ) -> Value

Encode an "object" (a tag)

null : Value

Empty contents >>> null |> encode 0 ""

list : List Value -> Value

Encode a list of nodes, e.g >>> import Dict >>> list [ object [ ("Root", Dict.empty, null) ], int 5 ] |> encode 0 "\n5"