xml.h (1307B)
1 #ifndef _XML_H_ 2 #define _XML_H_ 3 4 #include <stdio.h> 5 6 typedef struct xmlparser { 7 /* handlers */ 8 void (*xmlattr)(struct xmlparser *, const char *, size_t, 9 const char *, size_t, const char *, size_t); 10 void (*xmlattrend)(struct xmlparser *, const char *, size_t, 11 const char *, size_t); 12 void (*xmlattrstart)(struct xmlparser *, const char *, size_t, 13 const char *, size_t); 14 void (*xmlattrentity)(struct xmlparser *, const char *, size_t, 15 const char *, size_t, const char *, size_t); 16 void (*xmldata)(struct xmlparser *, const char *, size_t); 17 void (*xmldataend)(struct xmlparser *); 18 void (*xmldataentity)(struct xmlparser *, const char *, size_t); 19 void (*xmldatastart)(struct xmlparser *); 20 void (*xmltagend)(struct xmlparser *, const char *, size_t, int); 21 void (*xmltagstart)(struct xmlparser *, const char *, size_t); 22 void (*xmltagstartparsed)(struct xmlparser *, const char *, 23 size_t, int); 24 25 #ifndef GETNEXT 26 #define GETNEXT (x)->getnext 27 int (*getnext)(void); 28 #endif 29 30 /* current tag */ 31 char tag[1024]; 32 size_t taglen; 33 /* current tag is in short form ? <tag /> */ 34 int isshorttag; 35 /* current attribute name */ 36 char name[1024]; 37 /* data buffer used for tag data, cdata and attribute data */ 38 char data[BUFSIZ]; 39 } XMLParser; 40 41 void xml_parse(XMLParser *); 42 #endif