← all modules

Std.Xml.Decode

Std.Xml.Decode
  Std.Xml.Decode — turn XML into your own types, in the style of

Types
  type Decoder a

Values
  andThen : (a -> Decoder b) -> Decoder a -> Decoder b
      Decode, then choose the next decoder from the value.
  at : List String -> Decoder a -> Decoder a
      Follow a path of local names, taking the first match at each step, then
  attribute : String -> Decoder String
      The value of an attribute of the current element, by local name. `Err`
  bool : Decoder Bool
      The current element's text, trimmed, as a `Bool`: `true` / `1` and
  children : Decoder a -> Decoder (List a)
      Decode every child element, whatever its name, in document order. The
  decodeNode : Decoder a -> Node -> Result Error a
      Decode a node you already hold (from `Std.Xml.parse` or `node`).
  decodeString : Decoder a -> String -> Result Error a
      Parse a document (`Std.Xml.parse`) and decode its root element.
  element : String -> Decoder a -> Decoder a
      Decode the first child element with this local name. `Err` when there is
  fail : String -> Decoder a
      A decoder that always fails with this message (the path is added).
  float : Decoder Float
      The current element's text, trimmed, as a `Float`.
  inNamespace : String -> Decoder a -> Decoder a
      Check that the current element is in this namespace, then decode. Use it
  int : Decoder Int
      The current element's text, trimmed, as an `Int`.
  list : String -> Decoder a -> Decoder (List a)
      Decode every child element with this local name, in document order. No
  localName : Decoder String
      The local name of the current element.
  map : (a -> b) -> Decoder a -> Decoder b
      Transform a decoded value.
  map2 : (a -> b -> c) -> Decoder a -> Decoder b -> Decoder c
      Combine two decoders of the same element.
  map3 : (a -> b -> c -> d) -> Decoder a -> Decoder b -> Decoder c -> Decoder d
      Combine three decoders of the same element.
  map4 : (a -> b -> c -> d -> e) -> Decoder a -> Decoder b -> Decoder c -> Decoder d -> Decoder e
      Combine four decoders of the same element.
  map5 : (a -> b -> c -> d -> e -> f) -> Decoder a -> Decoder b -> Decoder c -> Decoder d -> Decoder e -> Decoder f
      Combine five decoders of the same element.
  namespaceUri : Decoder String
      The namespace URI of the current element (`""` when none).
  node : Decoder Node
      The current element itself, to read with `Std.Xml`.
  oneOf : List (Decoder a) -> Decoder a
      Try each decoder in order and keep the first that succeeds. When all
  optionalAttribute : String -> Decoder (Maybe String)
      The value of an attribute, or `Nothing` when it is absent.
  optionalElement : String -> Decoder a -> Decoder (Maybe a)
      Decode the first child element with this local name, or `Nothing` when
  string : Decoder String
      The text of the current element: all its descendant text, exactly as
  succeed : a -> Decoder a
      A decoder that always gives this value.