You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
755 B

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "utils.h"
  2. int Writer_Tab = 0;
  3. int Writer_Ret = 0;
  4. void Writer_StartElement(const char* element_name, int attr_count, char **keys, char **values, void* userData)
  5. {
  6. int i, j;
  7. if (Writer_Ret) printf("\n");
  8. for (j=0;j<Writer_Tab;j++) printf("\t");
  9. printf("<%s", element_name);
  10. for (i=0;i<attr_count;i++)
  11. {
  12. printf(" %s = \"%s\"", keys[i], values[i]);
  13. }
  14. printf(">");
  15. Writer_Tab++;
  16. Writer_Ret = 1;
  17. }
  18. void Writer_Characters(const char* element_name, const char* chars, void* userData)
  19. {
  20. printf("%s", chars);
  21. }
  22. void Writer_EndElement(const char* element_name, void* userData)
  23. {
  24. int j;
  25. Writer_Tab--;
  26. if (!Writer_Ret)
  27. for (j=0;j<Writer_Tab;j++) printf("\t");
  28. printf("</%s>\n", element_name);
  29. Writer_Ret = 0;
  30. }