- tags :: Monad m => (a -> Name -> Maybe (AttrParser b, b -> Iteratee Event m (Maybe (a, Maybe c)))) -> (a -> Iteratee Event m (Maybe (a, Maybe c))) -> a -> Iteratee Event m (a, [c])
- tagsPermute :: (Monad m, Ord k) => (Name -> k) -> Map k (AttrParser a, a -> Iteratee Event m (Maybe b)) -> Iteratee Event m (Maybe (Maybe b)) -> Iteratee Event m (Maybe [b])
- data Repetition = Repeat {}
- repeatNever :: Repetition
- repeatOnce :: Repetition
- repeatOptional :: Repetition
- repeatMany :: Repetition
- repeatSome :: Repetition
- tagsPermuteRepetition :: (Monad m, Ord k) => (Name -> k) -> Map k (Repetition, AttrParser b, b -> Iteratee Event m (Maybe t)) -> Iteratee Event m (Maybe (Maybe (k, t))) -> Iteratee Event m (Maybe [(k, t)])
Documentation
tags :: Monad m => (a -> Name -> Maybe (AttrParser b, b -> Iteratee Event m (Maybe (a, Maybe c)))) -> (a -> Iteratee Event m (Maybe (a, Maybe c))) -> a -> Iteratee Event m (a, [c])Source
Statefully and efficiently parse a list of tags.
The first parameter is a function that, given state and an element name, returns
either Nothing
, to indicate that the element is invalid, or a pair of attribute
and element content parsers in Just
.
The second parameter is a function that, given the current state, returns a fallback parser to be executed when no valid element has been found.
The third parameter is the initial state.
This function updates the state as it goes along, but it also accumulates a list of elements as they occur.
tagsPermute :: (Monad m, Ord k) => (Name -> k) -> Map k (AttrParser a, a -> Iteratee Event m (Maybe b)) -> Iteratee Event m (Maybe (Maybe b)) -> Iteratee Event m (Maybe [b])Source
Parse a permutation of tags.
The first parameter is a function to preprocess Names for equality testing, because sometimes XML documents contain inconsistent naming. This allows the user to deal with it.
The second parameter is a map of tags to attribute and element content parsers.
The third parameter is a fallback parser. The outer Maybe indicates whether it succeeds, and the inner Maybe whether an element should be added to the output list.
This function accumulates a list of elements for each step that produces one.
data Repetition Source
Specifies how often an element may repeat.
repeatNever :: RepetitionSource
Element may never occur.
repeatOnce :: RepetitionSource
Element may occur exactly once.
repeatOptional :: RepetitionSource
Element may occur up to once.
repeatMany :: RepetitionSource
Element may occur any number of times.
repeatSome :: RepetitionSource
Element may occur at least once.
tagsPermuteRepetition :: (Monad m, Ord k) => (Name -> k) -> Map k (Repetition, AttrParser b, b -> Iteratee Event m (Maybe t)) -> Iteratee Event m (Maybe (Maybe (k, t))) -> Iteratee Event m (Maybe [(k, t)])Source
Parse a permutation of tags, with some repeating elements.
The first parameter is a function to preprocess Names for equality testing, because sometimes XML documents contain inconsistent naming. This allows the user to deal with it.
The second parameter is a map of tags to attribute and element content parsers. It also specifies how often elements may repeat.
The third parameter is a fallback parser. The outer Maybe indicates whether it succeeds, and the inner Maybe whether an element should be added to the output list.
This function accumulates a list of elements for each step that produces one.