minixml.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* $Id: minixml.h,v 1.6 2006/11/30 11:47:21 nanard Exp $ */
  2. /* minimal xml parser
  3. *
  4. * Project : miniupnp
  5. * Website : http://miniupnp.free.fr/
  6. * Author : Thomas Bernard
  7. * Copyright (c) 2005 Thomas Bernard
  8. * This software is subject to the conditions detailed in the
  9. * LICENCE file provided in this distribution.
  10. * */
  11. #ifndef __MINIXML_H__
  12. #define __MINIXML_H__
  13. #define IS_WHITE_SPACE(c) ((c==' ') || (c=='\t') || (c=='\r') || (c=='\n'))
  14. /* if a callback function pointer is set to NULL,
  15. * the function is not called */
  16. struct xmlparser {
  17. const char *xmlstart;
  18. const char *xmlend;
  19. const char *xml; /* pointer to current character */
  20. int xmlsize;
  21. void * data;
  22. void (*starteltfunc) (void *, const char *, int);
  23. void (*endeltfunc) (void *, const char *, int);
  24. void (*datafunc) (void *, const char *, int);
  25. void (*attfunc) (void *, const char *, int, const char *, int);
  26. };
  27. /* parsexml()
  28. * the xmlparser structure must be initialized before the call
  29. * the following structure members have to be initialized :
  30. * xmlstart, xmlsize, data, *func
  31. * xml is for internal usage, xmlend is computed automatically */
  32. void parsexml(struct xmlparser *);
  33. #endif