xml.h - webdump - HTML to plain-text converter for webpages (HTM) git clone git://git.codemadness.org/webdump (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- xml.h (1653B) --- 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 (*xmlcdatastart)(struct xmlparser *); 17 void (*xmlcdata)(struct xmlparser *, const char *, size_t); 18 void (*xmlcdataend)(struct xmlparser *); 19 void (*xmlcommentstart)(struct xmlparser *); 20 void (*xmlcomment)(struct xmlparser *, const char *, size_t); 21 void (*xmlcommentend)(struct xmlparser *); 22 void (*xmldata)(struct xmlparser *, const char *, size_t); 23 void (*xmldataend)(struct xmlparser *); 24 void (*xmldataentity)(struct xmlparser *, const char *, size_t); 25 void (*xmldatastart)(struct xmlparser *); 26 void (*xmltagend)(struct xmlparser *, const char *, size_t, int); 27 void (*xmltagstart)(struct xmlparser *, const char *, size_t); 28 void (*xmltagstartparsed)(struct xmlparser *, const char *, 29 size_t, int); 30 31 #ifndef GETNEXT 32 #define GETNEXT (x)->getnext 33 int (*getnext)(void); 34 #endif 35 36 /* current tag */ 37 char tag[1024]; 38 size_t taglen; 39 /* current tag is in short tag ? <tag /> */ 40 int isshorttag; 41 /* current attribute name */ 42 char name[1024]; 43 /* data buffer used for tag data, CDATA and attribute data */ 44 char data[BUFSIZ]; 45 } XMLParser; 46 47 int xml_entitytostr(const char *, char *, size_t); 48 void xml_parse(XMLParser *); 49 #endif