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.

Parameters:
contextThe current context.
valueThe encoding name specified in the document.
See also:
http://www.w3.org/TR/xml11/#charencoding
void(* MTXSaxContext_t::startElement)(MTXSaxContext_t *context, const void *name, const void **attributes)

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

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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:
mtxSaxFeed()
void(* MTXSaxContext_t::parseError)(MTXSaxContext_t *context, int offset)

Called when the parser detects an error.

Parameters:
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