debugXML.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. * Summary: Tree debugging APIs
  3. * Description: Interfaces to a set of routines used for debugging the tree
  4. * produced by the XML parser.
  5. *
  6. * Copy: See Copyright for the status of this software.
  7. *
  8. * Author: Daniel Veillard
  9. */
  10. #ifndef __DEBUG_XML__
  11. #define __DEBUG_XML__
  12. #include <stdio.h>
  13. #include <libxml/xmlversion.h>
  14. #include <libxml/tree.h>
  15. #ifdef LIBXML_DEBUG_ENABLED
  16. #include <libxml/xpath.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /*
  21. * The standard Dump routines.
  22. */
  23. XMLPUBFUN void XMLCALL
  24. xmlDebugDumpString (FILE *output,
  25. const xmlChar *str);
  26. XMLPUBFUN void XMLCALL
  27. xmlDebugDumpAttr (FILE *output,
  28. xmlAttrPtr attr,
  29. int depth);
  30. XMLPUBFUN void XMLCALL
  31. xmlDebugDumpAttrList (FILE *output,
  32. xmlAttrPtr attr,
  33. int depth);
  34. XMLPUBFUN void XMLCALL
  35. xmlDebugDumpOneNode (FILE *output,
  36. xmlNodePtr node,
  37. int depth);
  38. XMLPUBFUN void XMLCALL
  39. xmlDebugDumpNode (FILE *output,
  40. xmlNodePtr node,
  41. int depth);
  42. XMLPUBFUN void XMLCALL
  43. xmlDebugDumpNodeList (FILE *output,
  44. xmlNodePtr node,
  45. int depth);
  46. XMLPUBFUN void XMLCALL
  47. xmlDebugDumpDocumentHead(FILE *output,
  48. xmlDocPtr doc);
  49. XMLPUBFUN void XMLCALL
  50. xmlDebugDumpDocument (FILE *output,
  51. xmlDocPtr doc);
  52. XMLPUBFUN void XMLCALL
  53. xmlDebugDumpDTD (FILE *output,
  54. xmlDtdPtr dtd);
  55. XMLPUBFUN void XMLCALL
  56. xmlDebugDumpEntities (FILE *output,
  57. xmlDocPtr doc);
  58. /****************************************************************
  59. * *
  60. * Checking routines *
  61. * *
  62. ****************************************************************/
  63. XMLPUBFUN int XMLCALL
  64. xmlDebugCheckDocument (FILE * output,
  65. xmlDocPtr doc);
  66. /****************************************************************
  67. * *
  68. * XML shell helpers *
  69. * *
  70. ****************************************************************/
  71. XMLPUBFUN void XMLCALL
  72. xmlLsOneNode (FILE *output, xmlNodePtr node);
  73. XMLPUBFUN int XMLCALL
  74. xmlLsCountNode (xmlNodePtr node);
  75. XMLPUBFUN const char * XMLCALL
  76. xmlBoolToText (int boolval);
  77. /****************************************************************
  78. * *
  79. * The XML shell related structures and functions *
  80. * *
  81. ****************************************************************/
  82. #ifdef LIBXML_XPATH_ENABLED
  83. /**
  84. * xmlShellReadlineFunc:
  85. * @prompt: a string prompt
  86. *
  87. * This is a generic signature for the XML shell input function.
  88. *
  89. * Returns a string which will be freed by the Shell.
  90. */
  91. typedef char * (* xmlShellReadlineFunc)(char *prompt);
  92. /**
  93. * xmlShellCtxt:
  94. *
  95. * A debugging shell context.
  96. * TODO: add the defined function tables.
  97. */
  98. typedef struct _xmlShellCtxt xmlShellCtxt;
  99. typedef xmlShellCtxt *xmlShellCtxtPtr;
  100. struct _xmlShellCtxt {
  101. char *filename;
  102. xmlDocPtr doc;
  103. xmlNodePtr node;
  104. xmlXPathContextPtr pctxt;
  105. int loaded;
  106. FILE *output;
  107. xmlShellReadlineFunc input;
  108. };
  109. /**
  110. * xmlShellCmd:
  111. * @ctxt: a shell context
  112. * @arg: a string argument
  113. * @node: a first node
  114. * @node2: a second node
  115. *
  116. * This is a generic signature for the XML shell functions.
  117. *
  118. * Returns an int, negative returns indicating errors.
  119. */
  120. typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
  121. char *arg,
  122. xmlNodePtr node,
  123. xmlNodePtr node2);
  124. XMLPUBFUN void XMLCALL
  125. xmlShellPrintXPathError (int errorType,
  126. const char *arg);
  127. XMLPUBFUN void XMLCALL
  128. xmlShellPrintXPathResult(xmlXPathObjectPtr list);
  129. XMLPUBFUN int XMLCALL
  130. xmlShellList (xmlShellCtxtPtr ctxt,
  131. char *arg,
  132. xmlNodePtr node,
  133. xmlNodePtr node2);
  134. XMLPUBFUN int XMLCALL
  135. xmlShellBase (xmlShellCtxtPtr ctxt,
  136. char *arg,
  137. xmlNodePtr node,
  138. xmlNodePtr node2);
  139. XMLPUBFUN int XMLCALL
  140. xmlShellDir (xmlShellCtxtPtr ctxt,
  141. char *arg,
  142. xmlNodePtr node,
  143. xmlNodePtr node2);
  144. XMLPUBFUN int XMLCALL
  145. xmlShellLoad (xmlShellCtxtPtr ctxt,
  146. char *filename,
  147. xmlNodePtr node,
  148. xmlNodePtr node2);
  149. #ifdef LIBXML_OUTPUT_ENABLED
  150. XMLPUBFUN void XMLCALL
  151. xmlShellPrintNode (xmlNodePtr node);
  152. XMLPUBFUN int XMLCALL
  153. xmlShellCat (xmlShellCtxtPtr ctxt,
  154. char *arg,
  155. xmlNodePtr node,
  156. xmlNodePtr node2);
  157. XMLPUBFUN int XMLCALL
  158. xmlShellWrite (xmlShellCtxtPtr ctxt,
  159. char *filename,
  160. xmlNodePtr node,
  161. xmlNodePtr node2);
  162. XMLPUBFUN int XMLCALL
  163. xmlShellSave (xmlShellCtxtPtr ctxt,
  164. char *filename,
  165. xmlNodePtr node,
  166. xmlNodePtr node2);
  167. #endif /* LIBXML_OUTPUT_ENABLED */
  168. #ifdef LIBXML_VALID_ENABLED
  169. XMLPUBFUN int XMLCALL
  170. xmlShellValidate (xmlShellCtxtPtr ctxt,
  171. char *dtd,
  172. xmlNodePtr node,
  173. xmlNodePtr node2);
  174. #endif /* LIBXML_VALID_ENABLED */
  175. XMLPUBFUN int XMLCALL
  176. xmlShellDu (xmlShellCtxtPtr ctxt,
  177. char *arg,
  178. xmlNodePtr tree,
  179. xmlNodePtr node2);
  180. XMLPUBFUN int XMLCALL
  181. xmlShellPwd (xmlShellCtxtPtr ctxt,
  182. char *buffer,
  183. xmlNodePtr node,
  184. xmlNodePtr node2);
  185. /*
  186. * The Shell interface.
  187. */
  188. XMLPUBFUN void XMLCALL
  189. xmlShell (xmlDocPtr doc,
  190. char *filename,
  191. xmlShellReadlineFunc input,
  192. FILE *output);
  193. #endif /* LIBXML_XPATH_ENABLED */
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197. #endif /* LIBXML_DEBUG_ENABLED */
  198. #endif /* __DEBUG_XML__ */