xmltree.c 838 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*====================================================================*
  2. *
  3. * void xmltree (NODE const * node);
  4. *
  5. * node.h
  6. *
  7. * print node structure on stdout;
  8. *
  9. * Motley Tools by Charles Maier;
  10. * Copyright (c) 2001-2006 by Charles Maier Associates;
  11. * Licensed under the Internet Software Consortium License;
  12. *
  13. *--------------------------------------------------------------------*/
  14. #ifndef XMLTREE_SOURCE
  15. #define XMLTREE_SOURCE
  16. #include <stdio.h>
  17. #include "../nodes/node.h"
  18. #include "../tools/format.h"
  19. void xmltree (NODE const * node)
  20. {
  21. if (node)
  22. {
  23. node = node->below;
  24. }
  25. while (node)
  26. {
  27. static unsigned level = 0;
  28. printf ("%03u ", node->line);
  29. printf ("(%c) ", node->type);
  30. output (level, "[%s]", node->text);
  31. level++;
  32. xmltree (node);
  33. level--;
  34. node = node->after;
  35. }
  36. return;
  37. }
  38. #endif