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 (1609B)
---
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 #define GETNEXT getchar_unlocked
32
33 /* current tag */
34 char tag[1024];
35 size_t taglen;
36 /* current tag is a short tag ? <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