sfeed

simple feed reader - forked from https://git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeedsfeed.zip
Log | Files | Refs | Atom | README | LICENSE

xml.h (raw) (1413B)


   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 (*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 in shortform ? <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 
  41 int xml_entitytostr(const char *, char *, size_t);
  42 void xml_parse(XMLParser *);
  43 #endif