5 * ttxml - tiny XML library for parsing (trusted!) XML documents.
7 * This parses an XML file into a convenient data structure.
10 * #include <ccan/ttxml/ttxml.h>
13 * int main(int argc, char *argv[])
17 * xml = xml_load("./test/test.xml2");
20 * tmp = xml_find(xml, "childnode");
22 * printf("%s: %s\n", xml->name, xml_attr(tmp, "attribute"));
29 * Licensed under GPL - see LICENSE file for details.
30 * Author: Daniel Burke <dan.p.burke@gmail.com>
33 /* Every node is one of these */
34 typedef struct XmlNode {
38 struct XmlNode * child;
39 struct XmlNode * next;
42 /* It's all pretty straight forward except for the attrib.
44 * Attrib is an array of char*, that is 2x the size of nattrib.
45 * Each pair of char* points to the attribute name & the attribute value,
48 * If it's a text node, then name = "text", and attrib[1] = the body of text.
49 * This is the only case where there will be an attribute with a null name.
52 XmlNode* xml_load(const char * filename);
53 void xml_free(XmlNode *target);
54 char* xml_attr(XmlNode *x, const char *name);
55 XmlNode * xml_find(XmlNode *xml, const char *name);
57 #endif /* CCAN_TTXML_H */