billstclair/elm-xml-eeue56/2.1.0

NOTE: the latest version is 3.1.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.
encode : Int -> Value -> String

Take a value, then generate a string from it

string : String -> Value

Encode a string

string "hello" |> encode 0
--> "hello"


string "<hello>" |> encode 0
--> "&lt;hello&gt;"
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)

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
--> "<Root></Root>\n5"