soap-0.2.2.5: SOAP client tools

Safe HaskellNone
LanguageHaskell98

Network.SOAP.Parsing.Cursor

Contents

Description

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

Synopsis

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 …