happstack-data-6.0.1: Happstack data manipulation libraries

Safe HaskellNone

Happstack.Data.Pairs

Synopsis

Documentation

pairsToXml :: Pairs -> [Element]Source

Converts lists of string pairs into a list of Elements. The basic structure is pairsToXml [(foo,bar)] = [Elem foo [CData bar]] pairsToXml [(foo/bar,baz)] = [Elem foo [Elem bar [CData baz]]]

xmlToPairs :: [Element] -> PairsSource

Converts a list of Elements to a list of String pairs. xmlToPairs [CData _] = error xmlToPairs [Elem foo [CData bar]] = [(foo,bar)] xmlToPairs [Elem foo [Elem bar [CData baz]]] = [(foo/bar,baz)] xmlToPairs . pairsToXml = id

pairsToHTMLForm :: String -> String -> String -> Pairs -> [Element]Source

Creates the Xml structure corresponding to the specification of an HTML form. The provided pairs should be the spec of the inputs to the form.

xmlToHTMLForm :: (Xml a, Show a, Data a, Eq a) => String -> String -> String -> a -> [Element]Source

Equivalent to pairsToHTMLForm but first converts the Xml instance to list of pairs.

toPairsX :: (Xml a, Show a, Data a, Eq a) => a -> PairsSource

toHTMLForm :: (Xml a, Show a, Data a, Eq a) => String -> String -> String -> a -> [Element]Source

Equivalent to pairsToHTMLForm but first converts the Xml instance to list of pairs. An alias for xmlToHTMLForm currently.

class (Xml x, Show x, Data x) => AsPairs x whereSource

Instances

(Xml a, Show a, Data a, Eq a) => AsPairs a