xml.h - xml2tsv - a simple xml-to-tsv converter, based on xmlparser
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
xml.h (1575B)
---
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 (*xmldata)(struct xmlparser *, const char *, size_t);
20 void (*xmldataend)(struct xmlparser *);
21 void (*xmldataentity)(struct xmlparser *, const char *, size_t);
22 void (*xmldatastart)(struct xmlparser *);
23 void (*xmltagend)(struct xmlparser *, const char *, size_t, int);
24 void (*xmltagstart)(struct xmlparser *, const char *, size_t);
25 void (*xmltagstartparsed)(struct xmlparser *, const char *,
26 size_t, int);
27
28 #ifndef GETNEXT
29 /* GETNEXT overridden to reduce function call overhead and
30 further context optimizations. */
31 #define GETNEXT getchar
32 #endif
33
34 /* current tag */
35 char tag[1024];
36 size_t taglen;
37 /* current tag is in short form ? <tag /> */
38 int isshorttag;
39 /* current attribute name */
40 char name[1024];
41 /* data buffer used for tag data, cdata and attribute data */
42 char data[BUFSIZ];
43 } XMLParser;
44
45 int xml_entitytostr(const char *, char *, size_t);
46 void xml_parse(XMLParser *);
47 #endif