HaXml-1.25.14: Utilities for manipulating XML documents

Safe Haskell | Safe-Inferred
Language | Haskell98

Text.XML.HaXml.Xtract.Combinators

Description

This is a new set of XML combinators for Xtract, not standard, but based on the standard set in Text.Xml.Haxml.Combinators. The main difference is that the Content Filter type becomes a Double Filter. A Double Filter always takes the whole document as an extra argument, so you can start to traverse it again from the root, when at any inner location within the document tree.

The new combinator definitions are derived from the old ones. The same names have the equivalent meaning - use module qualification on imports to distinguish between CFilter and DFilter variations.

Synopsis

- type DFilter i = Content i -> Content i -> [Content i]
- local :: CFilter i -> DFilter i
- global :: CFilter i -> DFilter i
- dfilter :: DFilter i -> CFilter i
- cfilter :: DFilter i -> CFilter i
- liftLocal :: (CFilter i -> CFilter i) -> DFilter i -> DFilter i
- liftGlobal :: (CFilter i -> CFilter i) -> DFilter i -> DFilter i
- o :: DFilter i -> DFilter i -> DFilter i
- (|>|) :: (a -> b -> [c]) -> (a -> b -> [c]) -> a -> b -> [c]
- union :: (a -> b -> [c]) -> (a -> b -> [c]) -> a -> b -> [c]
- with :: DFilter i -> DFilter i -> DFilter i
- without :: DFilter i -> DFilter i -> DFilter i
- keep :: DFilter i
- none :: DFilter i
- children :: DFilter i
- elm :: DFilter i
- txt :: DFilter i
- applypred :: CFilter i -> DFilter i -> CFilter i
- iffind :: String -> (String -> DFilter i) -> DFilter i -> DFilter i
- ifTxt :: (String -> DFilter i) -> DFilter i -> DFilter i
- cat :: [a -> b -> [c]] -> a -> b -> [c]
- (/>) :: DFilter i -> DFilter i -> DFilter i
- (</) :: DFilter i -> DFilter i -> DFilter i
- deep :: DFilter i -> DFilter i
- deepest :: DFilter i -> DFilter i
- multi :: DFilter i -> DFilter i

# Documentation

type DFilter i = Content i -> Content i -> [Content i] Source #

double content filter - takes document root + local subtree.

local :: CFilter i -> DFilter i Source #

lift an ordinary content filter to a double filter.

global :: CFilter i -> DFilter i Source #

lift an ordinary content filter to a double filter.

dfilter :: DFilter i -> CFilter i Source #

drop a double filter to an ordinary content filter. (permitting interior access to document root)

cfilter :: DFilter i -> CFilter i Source #

drop a double filter to an ordinary content filter. (Where interior access to the document root is not needed, the retaining pointer to the outer element can be pruned away. `cfilter` is more space-efficient than `dfilter` in this situation.)

liftLocal :: (CFilter i -> CFilter i) -> DFilter i -> DFilter i Source #

lift a CFilter combinator to a DFilter combinator

liftGlobal :: (CFilter i -> CFilter i) -> DFilter i -> DFilter i Source #

lift a CFilter combinator to a DFilter combinator

o :: DFilter i -> DFilter i -> DFilter i Source #

lifted composition over double filters.

(|>|) :: (a -> b -> [c]) -> (a -> b -> [c]) -> a -> b -> [c] Source #

lifted choice.

union :: (a -> b -> [c]) -> (a -> b -> [c]) -> a -> b -> [c] Source #

lifted union.

with :: DFilter i -> DFilter i -> DFilter i Source #

lifted predicates.

without :: DFilter i -> DFilter i -> DFilter i Source #

lifted predicates.

keep :: DFilter i Source #

lifted unit and zero.

none :: DFilter i Source #

lifted unit and zero.

children :: DFilter i Source #

elm :: DFilter i Source #

txt :: DFilter i Source #

applypred :: CFilter i -> DFilter i -> CFilter i Source #

iffind :: String -> (String -> DFilter i) -> DFilter i -> DFilter i Source #

ifTxt :: (String -> DFilter i) -> DFilter i -> DFilter i Source #

cat :: [a -> b -> [c]] -> a -> b -> [c] Source #

(/>) :: DFilter i -> DFilter i -> DFilter i Source #

(</) :: DFilter i -> DFilter i -> DFilter i Source #

deep :: DFilter i -> DFilter i Source #

deepest :: DFilter i -> DFilter i Source #

multi :: DFilter i -> DFilter i Source #