HUtilityXMLParser

Detailed Description

class HUtilityXMLParser

The HUtilityXMLParser class decodes arbitrary XML data.

HUtilityXMLParser class implements a simple non-validating XML Parser. It uses a callback architecture to register functions that handle specific tags and these functions in turn query the parsing toolkit for their parameters.

Public Functions

HUtilityXMLParser()

Constructs an HUtilityXMLParser object

virtual ~HUtilityXMLParser()
bool ProcessXMLData()

Takes complete chunk of XML data and processes it.

Returns:false = data is invalid
bool SetTagCallback(char const *tagname, void *(*callbackfunction)(HUtilityXMLTag*, bool open, void *extradata), void *extradata)

Associate user defined callback to tagname

Parameters:
  • tagname – Name of tag to associate with callback
  • callbackfunction – Pointer to callback function.
  • extradata – Arbitrary pointer that will be passed to callback
Returns:

true = callback has not been set, false = callback already set

void SetupParseBuffer(char const *buffer)

Prepares memory buffer for parsing

Parameters:buffer – memory buffer to parse
void *GetStackData()
Returns:Stack data which can be retrieved during parsing
bool FindDocType(char *doctype, char const *parsebuffer = 0)

Returns document type information

Parameters:
  • doctype – Document Type (returned)
  • parsebuffer – Memory buffer to parse for buffer (or if 0 use already prepared buffer)
Returns:

true = doctype found, false = no doctype found

Public Static Functions

static void GetFloatPoint(HUtilityTextParser *tp, HPoint &point)

Extracts point from string

Parameters:
  • tp – Pointer to text parser object
  • point – Returns extracted point
static void GetFloatPoint(char const *text, HPoint &point)

Extracts point from string

Parameters:
  • text – Text to extract point info from
  • point – Returns extracted point
static void GetRBGA(char const *text, float &r, float &g, float &b, float &a)