|
|
|
|
|
Description |
Low-level interface to Expat. Unless speed is paramount, this
should normally be avoided in favour of the interface provided by Text-XML-Expat-Tree.
Basic usage is:
- Make a new parser: newParser.
- Set up callbacks on the parser: setStartElementHandler, etc.
- Feed data into the parser: parse, parse' or parseChunk.
|
|
Synopsis |
|
|
|
|
Parser Setup
|
|
|
Instances | |
|
|
|
Create a Parser. The encoding parameter, if provided, overrides the
document's encoding declaration.
|
|
Parsing
|
|
|
parse data feeds lazy ByteString data into a Parser. It returns Nothing
on success, or Just the parse error.
|
|
|
parse data feeds strict ByteString data into a Parser. It returns Nothing
on success, or Just the parse error.
|
|
|
:: Parser | | -> ByteString | | -> Bool | True if last chunk
| -> IO (Maybe XMLParseError) | | parseChunk data False feeds strict ByteString data into a
Parser. The end of the data is indicated by passing True for the
final parameter. It returns Nothing on success, or Just the parse error.
|
|
|
|
Encoding types available for the document encoding.
| Constructors | |
|
|
|
Parse error, consisting of message text and error location
| Constructors | | Instances | |
|
|
getParseLocation |
|
|
Specifies a location of an event within the input text
| Constructors | XMLParseLocation | | xmlLineNumber :: Int64 | Line number of the event
| xmlColumnNumber :: Int64 | Column number of the event
| xmlByteIndex :: Int64 | Byte index of event from start of document
| xmlByteCount :: Int64 | The number of bytes in the event
|
|
| Instances | |
|
|
Parser Callbacks
|
|
|
The type of the "element started" callback. The first parameter is
the element name; the second are the (attribute, value) pairs. Return True
to continue parsing as normal, or False to terminate the parse.
|
|
|
The type of the "element ended" callback. The parameter is
the element name. Return True to continue parsing as normal, or False to
terminate the parse.
|
|
|
The type of the "character data" callback. The parameter is
the character data processed. This callback may be called more than once
while processing a single conceptual block of text. Return True to continue
parsing as normal, or False to terminate the parse.
|
|
|
Attach a StartElementHandler to a Parser.
|
|
|
Attach an EndElementHandler to a Parser.
|
|
|
Attach an CharacterDataHandler to a Parser.
|
|
Lower-level interface
|
|
|
This variant of parseChunk must either be called inside withHandlers (safest), or
between unsafeSetHandlers and unsafeReleaseHandlers, and this
will give you better performance than parseChunk if you process multiple chunks inside.
|
|
|
|
|
|
|
|
|
|
|
Helpers
|
|
|
|
Produced by Haddock version 2.4.2 |