MTXContext Struct Reference

#include <MTXml/MTXml.h>

List of all members.


Detailed Description

The context of an MTXml parser. Contains function pointers for callbacks from the parser. Also contains internal variables.

You must set all the callbacks before calling mtxFeed().


Public Attributes

void(* encoding )(MTXContext *context, const char *value)
void(* tagStart )(MTXContext *context, const char *name, int len)
void(* tagAttr )(MTXContext *context, const char *attrName, const char *attrValue)
void(* tagStartEnd )(MTXContext *context)
void(* tagData )(MTXContext *context, const char *data, int len)
void(* tagEnd )(MTXContext *context, const char *name, int len)
void(* emptyTagEnd )(MTXContext *context)
void(* dataRemains )(MTXContext *context, const char *data, int len)
void(* parseError )(MTXContext *context)
unsigned char(* unicodeCharacter )(MTXContext *context, int unicode)
void * userData


Member Data Documentation

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

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

The default encoding is UTF-8.

See also:
http://www.w3.org/TR/xml11/#charencoding

void(* MTXContext::tagStart)(MTXContext *context, const char *name, int len)
 

Called when a start-tag is parsed.

Parameters:
name The tag's name.
len The length of the name.

void(* MTXContext::tagAttr)(MTXContext *context, const char *attrName, const char *attrValue)
 

Called when a tag attribute is parsed.

void(* MTXContext::tagStartEnd)(MTXContext *context)
 

Called when the end bracket of the most recent start-tag is parsed.

void(* MTXContext::tagData)(MTXContext *context, const char *data, int len)
 

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:
data The character data.
len The length of the data.

void(* MTXContext::tagEnd)(MTXContext *context, const char *name, int len)
 

Called when an end-tag is parsed.

Parameters:
name The tag's name.
len The length of the name.
Warning:
Unlike regular SAX parsers, this function is NOT called when the end of an empty-element tag is parsed. This is because MTXml, in the interests of performance, does not keep any copies of document data. emptyTagEnd() is called instead.

void(* MTXContext::emptyTagEnd)(MTXContext *context)
 

Called at the end of an empty-element tag. This marks the end of the tag most recently reported by tagStart().

void(* MTXContext::dataRemains)(MTXContext *context, const char *data, int len)
 

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

Parameters:
data The XML data. May point to the beginning of the buffer that was supplied to feed(). In that case, the data needn't be moved.
len The length of the data.
See also:
mtxFeed()

void(* MTXContext::parseError)(MTXContext *context)
 

Called when the parser detects an error.

unsigned char(* MTXContext::unicodeCharacter)(MTXContext *context, int unicode)
 

Called during UTF-8 processing, when a character, whose encoding is longer than 8 bits, is encountered. This function returns an 8-bit representation of that Unicode character. This function may return zero. If so, a parse error is generated.

void* MTXContext::userData
 

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


Generated on Sat Feb 13 00:15:38 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO