xml.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _XML_H_
  2. #define _XML_H_
  3. #include <stdio.h>
  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 (*xmlcdata)(struct xmlparser *, const char *, size_t);
  15. void (*xmldata)(struct xmlparser *, const char *, size_t);
  16. void (*xmldataentity)(struct xmlparser *, const char *, size_t);
  17. void (*xmltagend)(struct xmlparser *, const char *, size_t, int);
  18. void (*xmltagstart)(struct xmlparser *, const char *, size_t);
  19. void (*xmltagstartparsed)(struct xmlparser *, const char *,
  20. size_t, int);
  21. #ifndef GETNEXT
  22. /* GETNEXT overridden to reduce function call overhead and further
  23. context optimizations. */
  24. #define GETNEXT getchar_unlocked
  25. #endif
  26. /* current tag */
  27. char tag[1024];
  28. size_t taglen;
  29. /* current tag is in shortform ? <tag /> */
  30. int isshorttag;
  31. /* current attribute name */
  32. char name[1024];
  33. /* data buffer used for tag data, CDATA and attribute data */
  34. char data[BUFSIZ];
  35. } XMLParser;
  36. int xml_entitytostr(const char *, char *, size_t);
  37. void xml_parse(XMLParser *);
  38. #endif