xml.h - randomcrap - random crap programs of varying quality
(HTM) git clone git://git.codemadness.org/randomcrap
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
xml.h (1683B)
---
1 #ifndef _XML_H
2 #define _XML_H
3
4 typedef struct xmlparser {
5 /* handlers */
6 void (*xmlattr)(struct xmlparser *, const char *, size_t,
7 const char *, size_t, const char *, size_t);
8 void (*xmlattrend)(struct xmlparser *, const char *, size_t,
9 const char *, size_t);
10 void (*xmlattrstart)(struct xmlparser *, const char *, size_t,
11 const char *, size_t);
12 void (*xmlattrentity)(struct xmlparser *, const char *, size_t,
13 const char *, size_t, const char *, size_t);
14 void (*xmlcdatastart)(struct xmlparser *);
15 void (*xmlcdata)(struct xmlparser *, const char *, size_t);
16 void (*xmlcdataend)(struct xmlparser *);
17 void (*xmlcommentstart)(struct xmlparser *);
18 void (*xmlcomment)(struct xmlparser *, const char *, size_t);
19 void (*xmlcommentend)(struct xmlparser *);
20 void (*xmldata)(struct xmlparser *, const char *, size_t);
21 void (*xmldataend)(struct xmlparser *);
22 void (*xmldataentity)(struct xmlparser *, const char *, size_t);
23 void (*xmldatastart)(struct xmlparser *);
24 void (*xmltagend)(struct xmlparser *, const char *, size_t, int);
25 void (*xmltagstart)(struct xmlparser *, const char *, size_t);
26 void (*xmltagstartparsed)(struct xmlparser *, const char *,
27 size_t, int);
28
29 /* GETNEXT overridden to reduce function call overhead and
30 further context optimizations. */
31 #define GETNEXT getchar
32
33 /* current tag */
34 char tag[1024];
35 size_t taglen;
36 /* current tag is in short form ? <tag /> */
37 int isshorttag;
38 /* current attribute name */
39 char name[1024];
40 /* data buffer used for tag data, cdata and attribute data */
41 char data[BUFSIZ];
42 } XMLParser;
43
44 int xml_entitytostr(const char *, char *, size_t);
45 void xml_parse(XMLParser *);
46 #endif