MTSax is a simple SAX parser built as a thin layer on top of MTXml.
For detailed information about the parsing capabilities and restrictions of MTSax, see the documentation for MTXml.
MTSax differs mainly from MTXml in that it caches certain pieces of data, in order to provide more user-friendly callbacks. This means that, unlike MTXml, MTSax has to allocate memory from the heap during parsing.
Namespaces | |
namespace | Mtx |
Classes | |
struct | MTXSaxContext_t |
class | Mtx::SaxListener |
class | Mtx::SaxContext |
Typedefs | |
typedef MTXSaxContext_t | MTXSaxContext |
Functions | |
void | mtxSaxStart (MTXSaxContext *context) |
bool | mtxSaxFeed (MTXSaxContext *context, char *data) |
bool | mtxSaxFeedProcess (MTXSaxContext *context, char *data) |
void | mtxSaxStop (MTXSaxContext *context) |
|
The context of an MTSax parser. Contains function pointers for callbacks from the parser. Also contains internal variables. You must set all the callbacks before calling mtxSaxStart(). |
|
Initializes a context's internal state. Must be called before the first call to mtxSaxFeed() with this context.
|
|
Parses data in the specified context. The data is null-terminated. It needn't be the entire XML document; MTXSaxContext::dataRemains() will be called with any data that couldn't be completely parsed. You can then call this function again when you have more data. You must not call this function from within an MTSax callback. Doing so would corrupt the parser's internal state.
|
|
Parses data in the specified context. Data sent to callbacks will have its UTF-8 characters and standard entities converted to Latin-1.
|
|
Stops parsing and frees any allocated memory. Must be called either to stop parsing prematurely, or after having parsed the document, in order to avoid memory leaks. If called from within an MTSax callback, this function ensures that no more callbacks will be called during this feed and that it is safe to call mtxSaxStart() on the context. However, it is still not allowed to call mtxSaxFeed() from within a an MTSax callback. |