Data Structures | |
| struct | _GGZXMLElement |
| Object representing a single XML element. More... | |
Typedefs | |
| typedef _GGZXMLElement | GGZXMLElement |
| Object representing a single XML element. | |
Functions | |
| GGZXMLElement * | ggz_xmlelement_new (const char *tag, const char *const *attrs, void(*process)(void *, GGZXMLElement *), void(*free)(GGZXMLElement *)) |
| Create a new GGZXMLElement element. | |
| void | ggz_xmlelement_init (GGZXMLElement *element, const char *tag, const char *const *attrs, void(*process)(void *, GGZXMLElement *), void(*free)(GGZXMLElement *)) |
| Initialize a GGZXMLElement. | |
| void | ggz_xmlelement_set_data (GGZXMLElement *element, void *data) |
| Set ancillary data on a GGZXMLElement object. | |
| const char * | ggz_xmlelement_get_tag (GGZXMLElement *element) |
| Get an XML element's name. | |
| const char * | ggz_xmlelement_get_attr (GGZXMLElement *element, const char *attr) |
| Get the value of an attribute on XML element. | |
| void * | ggz_xmlelement_get_data (GGZXMLElement *element) |
| Get the user-supplied data associated with an XML element. | |
| char * | ggz_xmlelement_get_text (GGZXMLElement *element) |
| Get an XML element's content text. | |
| void | ggz_xmlelement_add_text (GGZXMLElement *element, const char *text, int len) |
| Append a string to the element's content text. | |
| void | ggz_xmlelement_free (GGZXMLElement *element) |
| Free the memory associated with an XML element. | |
These can be used with streaming XML parsers, and don't have the overhead of a full DOM tree. GGZXMLElement represents a single element, along with its attributes and text data.
| GGZXMLElement* ggz_xmlelement_new | ( | const char * | tag, | |
| const char *const * | attrs, | |||
| void(*)(void *, GGZXMLElement *) | process, | |||
| void(*)(GGZXMLElement *) | free | |||
| ) |
Create a new GGZXMLElement element.
| tag | The name of the XML element (tag) | |
| attrs | NULL terminated array of attributes/values. These must alternate: attribute1, value1, attribute2, value2, etc. | |
| process | User-defined function for processing XML elements | |
| free | User-defined function for deallocating GGZXMLElement objects. If provided, this will be invoked by ggz_xmlelement_free(), and in addition to any user-defined processing should call ggz_free() the element itself. |
| void ggz_xmlelement_init | ( | GGZXMLElement * | element, | |
| const char * | tag, | |||
| const char *const * | attrs, | |||
| void(*)(void *, GGZXMLElement *) | process, | |||
| void(*)(GGZXMLElement *) | free | |||
| ) |
Initialize a GGZXMLElement.
| element | Pointer to a GGZXMLElement to initialize | |
| tag | The name of the XML element (tag) | |
| attrs | NULL terminated array of attributes/values. These must alternate: attribute1, value1, attribute2, value2, etc. | |
| process | User-defined function for processing XML elements | |
| free | User-defined function for deallocating GGZXMLElement objects. If provided, this will be invoked by ggz_xmlelement_free(), and in addition to any user-defined processing should call ggz_free() the element itself. |
| void ggz_xmlelement_set_data | ( | GGZXMLElement * | element, | |
| void * | data | |||
| ) |
Set ancillary data on a GGZXMLElement object.
Associate some extra data with an XML element.
| element | Pointer to an XML element | |
| data | Pointer to user-supplied data |
| const char* ggz_xmlelement_get_tag | ( | GGZXMLElement * | element | ) |
Get an XML element's name.
| element | Pointer to an XML element |
| const char* ggz_xmlelement_get_attr | ( | GGZXMLElement * | element, | |
| const char * | attr | |||
| ) |
Get the value of an attribute on XML element.
| element | Pointer to an XML element | |
| attr | An attribute name |
| void* ggz_xmlelement_get_data | ( | GGZXMLElement * | element | ) |
Get the user-supplied data associated with an XML element.
| element | Pointer to an XML element |
| char* ggz_xmlelement_get_text | ( | GGZXMLElement * | element | ) |
Get an XML element's content text.
| element | Pointer to an XML element |
| void ggz_xmlelement_add_text | ( | GGZXMLElement * | element, | |
| const char * | text, | |||
| int | len | |||
| ) |
Append a string to the element's content text.
| element | Pointer to an XML element | |
| text | String to append | |
| len | The string's length, in bytes |
| void ggz_xmlelement_free | ( | GGZXMLElement * | element | ) |
Free the memory associated with an XML element.
| element | Pointer to an XML element |
1.5.1