soap-0.2.3.6: SOAP client tools

Safe Haskell | None
Language | Haskell98

Network.SOAP.Parsing.Cursor

Contents

- Extract single element
- Extract from multiple elements

Description

Some helpers to parse documents with Text.XML.Cursor.

Synopsis

- readT :: Text -> Cursor -> Text
- readC :: Read a => Text -> Cursor -> a
- type Dict = HashMap Text Text
- readDict :: Axis -> Cursor -> Dict
- dictBy :: Text -> ResponseParser Dict

# Extract single element

readT :: Text -> Cursor -> Text Source #

Grab node content by element name.

    pair cur = (readT "fst" cur, readT "snd" cur)

readC :: Read a => Text -> Cursor -> a Source #

Extract a read-able type from a content of a node with given name.

    age = readC "age" :: Cursor -> Integer

# Extract from multiple elements

type Dict = HashMap Text Text Source #

Very generic type to catch server reply when you don't care about types.

readDict :: Axis -> Cursor -> Dict Source #

Apply an axis and extract a key-value from child elements.

    invokeWS … (CursorParser . readDict $ laxElement "WebScaleResponse" &/ laxElement "BigDataResult")

dictBy :: Text -> ResponseParser Dict Source #

Simple parser to grab a flat response by an element name.

    result <- invokeWS … (dictBy "BigDataResult")
    case HM.lookup "SuccessError" result of …