sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

xml.h (1408B)


      1#ifndef XML_H
      2#define XML_H
      3
      4#include <stdio.h>
      5
      6typedef 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 (*xmlcdata)(struct xmlparser *, const char *, size_t);
     17	void (*xmldata)(struct xmlparser *, const char *, size_t);
     18	void (*xmldataentity)(struct xmlparser *, const char *, size_t);
     19	void (*xmltagend)(struct xmlparser *, const char *, size_t, int);
     20	void (*xmltagstart)(struct xmlparser *, const char *, size_t);
     21	void (*xmltagstartparsed)(struct xmlparser *, const char *,
     22	      size_t, int);
     23
     24#ifndef GETNEXT
     25	/* GETNEXT overridden to reduce function call overhead and further
     26	   context optimizations. */
     27	#define GETNEXT getchar_unlocked
     28#endif
     29
     30	/* current tag */
     31	char tag[1024];
     32	size_t taglen;
     33	/* current tag is a short tag ? <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
     41int xml_entitytostr(const char *, char *, size_t);
     42void xml_parse(XMLParser *);
     43#endif