eeue56/elm-xml/1.1.0

NOTE: this package is not compatible with Elm 0.19.1

Xml.Decode

decode : String -> Result String Value

Try to decode a string and turn it into an XML value >>> import Xml.Encode exposing (Value(Tag, Object), null) >>> import Dict >>> decode "" Ok (Object [Tag "name" Dict.empty null])

decodeInt : String -> Result String Value

Decode a int >>> import Xml.Encode exposing (Value(IntNode)) >>> decodeInt "hello" Err "could not convert string 'hello' to an Int"

>>> decodeInt "5"
Ok (IntNode 5)
decodeFloat : String -> Result String Value

Decode a float >>> import Xml.Encode exposing (Value(FloatNode)) >>> decodeFloat "hello" Err "could not convert string 'hello' to a Float"

>>> decodeFloat "5"
Ok (FloatNode 5.0)


>>> decodeFloat "5.5"
Ok (FloatNode 5.5)
decodeString : String -> Result String Value

Decode a string

>>> import Xml.Encode exposing (Value(StrNode))
>>> decodeString "hello"
Ok (StrNode "hello")
decodeString : String -> Result String Value

Decode a string

>>> import Xml.Encode exposing (Value(StrNode))
>>> decodeString "hello"
Ok (StrNode "hello")
decodeBool : String -> Result String Value

Decode a bool

decodeChildren : String -> Result String Value

Decode children from a string

>>> import Xml.Encode exposing (Value(Object, Tag, StrNode))
>>> decodeChildren "<name>hello</name>"
Ok (Object [Tag "name" Dict.empty (StrNode "hello")] )