- type Node s m tag text = NodeG (ListT (XMLT s m)) tag text
- data NodeG c tag text
- type UNode s m text = Node s m text text
- module Text.XML.Expat.Internal.NodeClass
- module Data.List.Class
- type QNode s m a text = Node s a (QName text) text
- module Text.XML.Expat.Internal.Qualified
- type NNode s m text a = Node s a (NName text) text
- module Text.XML.Expat.Internal.Namespaced
- data ParseOptions tag text = ParseOptions {
- overrideEncoding :: Maybe Encoding
- entityDecoder :: Maybe (tag -> Maybe text)
- defaultParseOptions :: ParseOptions tag text
- data Encoding
- parse :: forall m a tag text. (MonadIO m, GenericXMLString tag, GenericXMLString text) => ParseOptions tag text -> (forall s. ListT (XMLT s m) (Node s m tag text) -> XMLT s m a) -> m (IterateeG WrappedByteString Word8 m (Either ErrMsg a))
- data XMLT s m a
- data XMLParseError = XMLParseError String XMLParseLocation
- data XMLParseLocation = XMLParseLocation {}
Tree structure
type Node s m tag text = NodeG (ListT (XMLT s m)) tag textSource
A tree representation that uses a monadic list as its child list type.
Note that you can use the type function ListOf
to give a list of
any node type, using that node's associated list type, e.g.
ListOf (UNode Text)
The s parameter is a dummy type used to prevent nodes escaping from the
handler. See s
for more explanation.
data NodeG c tag text
The tree representation of the XML document.
c
is the container type for the element's children, which is [] in the
hexpat
package, and a monadic list type for hexpat-iteratee
.
tag
is the tag type, which can either be one of several string types,
or a special type from the Text.XML.Expat.Namespaced
or
Text.XML.Expat.Qualified
modules.
text
is the string type for text content.
type UNode s m text = Node s m text textSource
Type alias for a single node with unqualified tag names where tag and text are the same string type.
The s parameter is a dummy type used to prevent nodes escaping from the
handler. See s
for more explanation.
Generic node manipulation
Generic manipulation of the child list
module Data.List.Class
Qualified nodes
type QNode s m a text = Node s a (QName text) textSource
Type alias for a single annotated node where qualified names are used for tags
The s parameter is a dummy type used to prevent nodes escaping from the
handler. See s
for more explanation.
Namespaced nodes
type NNode s m text a = Node s a (NName text) textSource
Type alias for a single annotated node where namespaced names are used for tags
The s parameter is a dummy type used to prevent nodes escaping from the
handler. See s
for more explanation.
Parse to tree
data ParseOptions tag text
ParseOptions | |
|
defaultParseOptions :: ParseOptions tag text
:: forall m a tag text . (MonadIO m, GenericXMLString tag, GenericXMLString text) | |
=> ParseOptions tag text | |
-> (forall s. ListT (XMLT s m) (Node s m tag text) -> XMLT s m a) | Handler for parsed tree |
-> m (IterateeG WrappedByteString Word8 m (Either ErrMsg a)) |
An iteratee that parses the input document, passing a representation of it to the specified handler monad. The monad runs lazily using co-routines, so if it requests a part of the tree that hasn't been parsed yet, it will be suspended, and continued when it's available.
This implementation does not use Haskell's lazy I/O.
The s type argument is a dummy type, which you should just leave polymorphic
by typing s when using the type. The "forall s ." in the type signature
prevents any parsed nodes escaping from the handler, because they may refer
to parts of the tree that haven't been parsed yet, and this parsing can't
take happen outside the handler. If you need to extract nodes from your
handler, use a function like fromNodeContainer
to convert the container type.
The monad transformer used for writing your handler for chunked XML trees, which executes as a co-routine.
data XMLParseError
Parse error, consisting of message text and error location
data XMLParseLocation
Specifies a location of an event within the input text
XMLParseLocation | |
|