xml-helpers-1.0.0: Some useful helper functions for the xml library.

Safe Haskell | Safe-Inferred
Language | Haskell98

Text.XML.Light.Helpers

Description

A set of useful helper functions for dealing with XML data.

Synopsis

- mapChildren :: String -> Element -> (Element -> Maybe a) -> Maybe [a]
- foldChildren :: String -> Element -> a -> (a -> Element -> Maybe a) -> Maybe a
- mapElements :: String -> Element -> (Element -> Maybe a) -> Maybe [a]
- foldElements :: String -> Element -> a -> (a -> Element -> Maybe a) -> Maybe a
- mapChildrenWithAttName :: String -> Element -> (Element -> Maybe a) -> Maybe [a]
- mapElementsWithAttName :: String -> Element -> (Element -> Maybe a) -> Maybe [a]
- foldChildrenWithAttName :: String -> Element -> a -> (a -> Element -> Maybe a) -> Maybe a
- foldElementsWithAttName :: String -> Element -> a -> (a -> Element -> Maybe a) -> Maybe a
- getChildData :: String -> Element -> Maybe String
- getElementData :: String -> Element -> Maybe String
- findChildWithAttName :: String -> Element -> Maybe Element
- findChildrenWithAttName :: String -> Element -> [Element]
- findElementWithAttName :: String -> Element -> Maybe Element
- findElementsWithAttName :: String -> Element -> [Element]
- elementHasNameAttr :: String -> Element -> Bool
- parseRows :: (Element -> Maybe a) -> Element -> Maybe [a]

# Documentation

mapChildren :: String -> Element -> (Element -> Maybe a) -> Maybe [a] Source #

Map the given function over the children of the given element with the given name.

foldChildren :: String -> Element -> a -> (a -> Element -> Maybe a) -> Maybe a Source #

Fold the function over the children of the given element with the given name.

mapElements :: String -> Element -> (Element -> Maybe a) -> Maybe [a] Source #

Map the given function over all subelements of the given element with the given name.

foldElements :: String -> Element -> a -> (a -> Element -> Maybe a) -> Maybe a Source #

Fold the given function over the children of the given element with the given name.

mapChildrenWithAttName :: String -> Element -> (Element -> Maybe a) -> Maybe [a] Source #

Map the given function over the children of the given element that have an attribute "name" matching the given string.

mapElementsWithAttName :: String -> Element -> (Element -> Maybe a) -> Maybe [a] Source #

Map the given function over the subelements of the given element that have an attribute "name" matching the given string.

foldChildrenWithAttName :: String -> Element -> a -> (a -> Element -> Maybe a) -> Maybe a Source #

Fold the given function over the children of the given element that have an attribute "name" matching the given string.

foldElementsWithAttName :: String -> Element -> a -> (a -> Element -> Maybe a) -> Maybe a Source #

Fold the given function over the subelements of the given element that have an attribute "name" matching the given string.

getChildData :: String -> Element -> Maybe String Source #

Get the string contents of the child of the given element with the given name.

getElementData :: String -> Element -> Maybe String Source #

Get the string contents of the subelement of the given element with the given name.

findChildWithAttName :: String -> Element -> Maybe Element Source #

Find a child of the given element with that has an attribute "name" equal to the given string.

findChildrenWithAttName :: String -> Element -> [Element] Source #

Find all the children of the given element that have an attribute "name" equal to the given string.

findElementWithAttName :: String -> Element -> Maybe Element Source #

Find a subelement of the given element that has an attribute "name" equal to the given string.

findElementsWithAttName :: String -> Element -> [Element] Source #

Find all the subelements of the given element that have an attribute "name" equal to the given string.

elementHasNameAttr :: String -> Element -> Bool Source #

Returns True iff the given alement has an attribute "name" equal to the given string.

parseRows :: (Element -> Maybe a) -> Element -> Maybe [a] Source #

Convert a list of rows (subelement with the name "row") into a Haskell datatype using the given function.s