|
|
|
|
|
Description |
Low-level interface to Expat. Unless speed is paramount, this should
normally be avoided in favour of the interfaces provided by
Text.XML.Expat.SAX and 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.
|
|
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 | |
|
|
|
|
|
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.
|
|
|
The type of the "external entity reference" callback. See the expat
documentation.
|
|
|
Set a skipped entity handler. This is called in two situations:
1. An entity reference is encountered for which no declaration has been read
and this is not an error.
2. An internal entity reference is read, but not expanded, because
XML_SetDefaultHandler has been called.
|
|
|
Attach a StartElementHandler to a Parser.
|
|
|
Attach an EndElementHandler to a Parser.
|
|
|
Attach an CharacterDataHandler to a Parser.
|
|
|
|
|
|
|
|
Lower-level interface
|
|
parseExternalEntityReference | Source |
|
|
|
|
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.6.1 |