gfxEngine_documentation
|
Go to the source code of this file.
Macros | |
#define | SIMPLE_XML_USER_ERROR 1000 |
Typedefs | |
typedef void * | SimpleXmlParser |
typedef enum simple_xml_event | SimpleXmlEvent |
typedef void *(* | SimpleXmlTagHandler) (SimpleXmlParser parser, SimpleXmlEvent event, const char *szName, const char *szAttribute, const char *szValue) |
Enumerations | |
enum | simple_xml_event { FINISH_TAG, ADD_ATTRIBUTE, FINISH_ATTRIBUTES, ADD_CONTENT, ADD_SUBTAG } |
Functions | |
SimpleXmlParser | simpleXmlCreateParser (const char *sData, long nDataSize) |
void | simpleXmlDestroyParser (SimpleXmlParser parser) |
int | simpleXmlInitializeParser (SimpleXmlParser parser, const char *sData, long nDataSize) |
int | simpleXmlParse (SimpleXmlParser parser, SimpleXmlTagHandler handler) |
char * | simpleXmlGetErrorDescription (SimpleXmlParser parser) |
long | simpleXmlGetLineNumber (SimpleXmlParser parser) |
void | simpleXmlParseAbort (SimpleXmlParser parser, int nErrorCode) |
int | simpleXmlPushUserData (SimpleXmlParser parser, void *pData) |
void * | simpleXmlPopUserData (SimpleXmlParser parser) |
void * | simpleXmlGetUserData (SimpleXmlParser parser) |
void * | simpleXmlGetUserDataAt (SimpleXmlParser parser, int nLevel) |
#define SIMPLE_XML_USER_ERROR 1000 |
Minimum value for a user abort.
typedef enum simple_xml_event SimpleXmlEvent |
Enumeration describing the event types that are sent to an SimpleXmlHandler by an SimpleXmlParser.
typedef void* SimpleXmlParser |
The simple xml parser structure.
SimpleXmlParsers should be created and destroyed using the functions simpleXmlCreateParser, simpleXmlDestoryParser.
typedef void*(* SimpleXmlTagHandler) (SimpleXmlParser parser, SimpleXmlEvent event, const char *szName, const char *szAttribute, const char *szValue) |
Callback function to handle simple xml events.
The SimpleXmlTagHandler is invoked by a SimpleXmlParser whenever one of the following event types occur:
FINISH_TAG indicates that parsing of this tag has finished, szName contains the tag name, szAttribute and szValue are NULL, the result of the handler is ignored. ADD_ATTRIBUTE indicates that an attribute for this tag has been parsed, szName contains the tag name, szAttribute the attribute name and szValue contains the attribute contents, the result of the handler is ignored. FINISH_ATTRIBUTES, indicates that parsing of attributes for this tag is finished, szName contains the tag name, szAttribute and szValue are NULL, the result of the handler is ignored. ADD_CONTENT indicates that content of this tag has been parsed and should be added, szName contains the tag name and szValue contains the data to add, szAttribute is NULL and the result of the handler is ignored. ADD_SUBTAG indicates that a subtag has been parsed, szName contains the name of the subtag read, szAttribute and szValue are NULL, the result of the handler should either be NULL to indicate that this subtag is not of interest and should be skipped a SimpleXmlTagHandler that is used for handling the subtag.
enum simple_xml_event |
Enumeration describing the event types that are sent to an SimpleXmlHandler by an SimpleXmlParser.
Enumerator | |
---|---|
FINISH_TAG | |
ADD_ATTRIBUTE | |
FINISH_ATTRIBUTES | |
ADD_CONTENT | |
ADD_SUBTAG |
SimpleXmlParser simpleXmlCreateParser | ( | const char * | sData, |
long | nDataSize | ||
) |
Creates a new simple xml parser for the specified input data.
The input data may be parsed with simpleXmlParse and the parser returned by this function as parameter.
Note: The parser will not copy the input data or in any way modify it. However any modifications of the input data in a callback handler while parsing will have an undefined result!
sData | the input data to parse (must no be NULL). |
nDataSize | the size of the input data buffer (sData) to parse (must be greater than 0). |
void simpleXmlDestroyParser | ( | SimpleXmlParser | parser | ) |
Destroys the specified simple xml parser.
parser | the parser to destroy (must have been created using simpleXmlCreateParser). |
char* simpleXmlGetErrorDescription | ( | SimpleXmlParser | parser | ) |
Returns a description of the error that occured during parsing.
parser | the parser for which to get the error description. |
long simpleXmlGetLineNumber | ( | SimpleXmlParser | parser | ) |
Returns the line number of the current input line that the parser has read.
In case of an error this method will return the line number on which the error was encountered after a call to simpleXmlParse.
If called from a handler during parsing this function will return the current line number.
If called after a successfull simpleXmlParse run this function will return the line number of the last line parsed in the xml data.
void* simpleXmlGetUserData | ( | SimpleXmlParser | parser | ) |
Peeks at the top of the user data stack.
The last pointer pushed on the user data stack is returned.
Note: This function does not modify the stack.
This function is a convenience function for simpleXmlGetUserDataAt(parser, 0);
parser | the parser from which to get the user data pointer. |
void* simpleXmlGetUserDataAt | ( | SimpleXmlParser | parser, |
int | nLevel | ||
) |
Peeks at a specified location from to the top of the user data stack.
The level indicates the level from the top of the stack that is inspected.
Note: This method does not modify the stack.
parser | the parser from which to get the user data pointer. |
nLevel | the level (from the top of the stack) to inspect. |
int simpleXmlInitializeParser | ( | SimpleXmlParser | parser, |
const char * | sData, | ||
long | nDataSize | ||
) |
Reinitializes the specified simple xml parser for parsing the specified input data.
parser | the parser to initialize. |
sData | the input data to parse (must no be NULL). |
nDataSize | the size of the input data buffer (sData) to parse (must be greater than 0). |
int simpleXmlParse | ( | SimpleXmlParser | parser, |
SimpleXmlTagHandler | handler | ||
) |
Starts an initialized (or newly created) xml parser with the specified document tag handler.
Note: This function may only be called once after creation or initialization of a parser. To reuse the parser it has to be freshly initialized (using simpleXmlInitializeParser) prior to calling the function again.
parser | the parser to start. |
handler | the handler to use for the document tag. |
void simpleXmlParseAbort | ( | SimpleXmlParser | parser, |
int | nErrorCode | ||
) |
Causes the simple xml parser to abort parsing of the input data.
This method may only be called from a tag handler.
The active simpleXmlParse run will be aborted and the simpleXmlParse function will return with the specified error code.
nErrorCode | the error code with which to abort (the error code must be >= SIMPLE_XML_USER_ERROR else the abort request is ignored!) |
void* simpleXmlPopUserData | ( | SimpleXmlParser | parser | ) |
Pops the last pointer pushed on the user data stack of the parser.
parser | the parser on which to pop the user data pointer. |
int simpleXmlPushUserData | ( | SimpleXmlParser | parser, |
void * | pData | ||
) |
Pushes the specified pointer on the user data stack of the parser.
parser | the parser on which to push the user data pointer. |
pData | pointer to the user data to set (NULL is not a valid value). |