MoSync 3.3
MTXSaxContext_t Struct Reference

The context of an MTSax parser. More...

#include <MTXml/MTSax.h>

List of all members.

Public Attributes

void(* encoding )(MTXSaxContext_t *context, const char *value)
void(* startElement )(MTXSaxContext_t *context, const void *name, const void **attributes)
void(* endElement )(MTXSaxContext_t *context, const void *name)
void(* characters )(MTXSaxContext_t *context, const void *data, int length)
unsigned char(* unicodeCharacter )(MTXSaxContext_t *context, int character)
void(* dataRemains )(MTXSaxContext_t *context, const char *data, int length)
void(* parseError )(MTXSaxContext_t *context, int offset)
void * userData

Detailed Description

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().

Member Data Documentation

void(* MTXSaxContext_t::encoding)(MTXSaxContext_t *context, const char *value)

If the "encoding" attribute is present in the "?xml" tag, this function is called.

The default encoding is UTF-8.

contextThe current context.
valueThe encoding name specified in the document.
See also:
void(* MTXSaxContext_t::startElement)(MTXSaxContext_t *context, const void *name, const void **attributes)

Called when a start-tag or an empty element is parsed.

contextThe current context.
nameThe name of the element.
attributesThe attributes in this element, specified as a NULL-terminated name/value pointer pair array.
void(* MTXSaxContext_t::endElement)(MTXSaxContext_t *context, const void *name)

Called when an end-element or the end of an empty element is parsed.

contextThe current context.
nameThe name of the element.
void(* MTXSaxContext_t::characters)(MTXSaxContext_t *context, const void *data, int length)

Called when character data is parsed.

May be called more than once per data section, so don't expect your data to be delivered in one piece.

contextThe current context.
dataThe character data.
lengthThe length, in characters, of the provided data.
unsigned char(* MTXSaxContext_t::unicodeCharacter)(MTXSaxContext_t *context, int character)

Called during UTF-8 processing when a character is encountered whose encoding is longer than 8 bits.

This function returns an 8-bit representation of that Unicode character. This function may return zero. If so, the mtxBasicUnicodeConvert function is called. If that too returns zero, a parse error is generated.

contextThe current context.
characterThe Unicode code point to convert.
void(* MTXSaxContext_t::dataRemains)(MTXSaxContext_t *context, const char *data, int length)

Called when some data at the end of the supplied buffer couldn't be completely parsed. Prepend it to your next feed.

contextThe current context.
dataThe XML data. May point to the beginning of the buffer that was supplied to feed(). In that case, the data needn't be moved.
lengthThe length, in characters, of the data.
See also:
void(* MTXSaxContext_t::parseError)(MTXSaxContext_t *context, int offset)

Called when the parser detects an error.

contextThe current context.

A value you can set to anything you like. If you're parsing more than one document at a time, this can be a useful way to distinguish them.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines