Daniel Veillard | baf4cd5 | 1998-10-27 22:56:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * debugXML.h : Interfaces to a set of routines used for debugging the tree |
| 3 | * produced by the XML parser. |
| 4 | * |
| 5 | * Daniel Veillard <Daniel.Veillard@w3.org> |
| 6 | */ |
| 7 | |
| 8 | #ifndef __DEBUG_XML__ |
| 9 | #define __DEBUG_XML__ |
Daniel Veillard | dbfd641 | 1999-12-28 16:35:14 +0000 | [diff] [blame] | 10 | #include <stdio.h> |
Daniel Veillard | 361d845 | 2000-04-03 19:48:13 +0000 | [diff] [blame] | 11 | #include <libxml/tree.h> |
| 12 | |
| 13 | #ifdef LIBXML_DEBUG_ENABLED |
| 14 | |
| 15 | #include <libxml/xpath.h> |
Daniel Veillard | baf4cd5 | 1998-10-27 22:56:57 +0000 | [diff] [blame] | 16 | |
Daniel Veillard | f600e25 | 1999-12-18 15:32:46 +0000 | [diff] [blame] | 17 | #ifdef __cplusplus |
Daniel Veillard | 5cb5ab8 | 1999-12-21 15:35:29 +0000 | [diff] [blame] | 18 | extern "C" { |
Daniel Veillard | f600e25 | 1999-12-18 15:32:46 +0000 | [diff] [blame] | 19 | #endif |
Daniel Veillard | dbfd641 | 1999-12-28 16:35:14 +0000 | [diff] [blame] | 20 | |
| 21 | /* |
| 22 | * The standard Dump routines |
| 23 | */ |
| 24 | void xmlDebugDumpString (FILE *output, |
| 25 | const xmlChar *str); |
| 26 | void xmlDebugDumpAttr (FILE *output, |
| 27 | xmlAttrPtr attr, |
| 28 | int depth); |
| 29 | void xmlDebugDumpAttrList (FILE *output, |
| 30 | xmlAttrPtr attr, |
| 31 | int depth); |
| 32 | void xmlDebugDumpOneNode (FILE *output, |
| 33 | xmlNodePtr node, |
| 34 | int depth); |
| 35 | void xmlDebugDumpNode (FILE *output, |
| 36 | xmlNodePtr node, |
| 37 | int depth); |
| 38 | void xmlDebugDumpNodeList (FILE *output, |
| 39 | xmlNodePtr node, |
| 40 | int depth); |
| 41 | void xmlDebugDumpDocumentHead(FILE *output, |
| 42 | xmlDocPtr doc); |
| 43 | void xmlDebugDumpDocument (FILE *output, |
| 44 | xmlDocPtr doc); |
Daniel Veillard | 39c7d71 | 2000-09-10 16:14:55 +0000 | [diff] [blame] | 45 | void xmlDebugDumpDTD (FILE *output, |
| 46 | xmlDtdPtr doc); |
Daniel Veillard | dbfd641 | 1999-12-28 16:35:14 +0000 | [diff] [blame] | 47 | void xmlDebugDumpEntities (FILE *output, |
| 48 | xmlDocPtr doc); |
| 49 | void xmlLsOneNode (FILE *output, |
| 50 | xmlNodePtr node); |
| 51 | |
| 52 | /**************************************************************** |
| 53 | * * |
| 54 | * The XML shell related structures and functions * |
| 55 | * * |
| 56 | ****************************************************************/ |
| 57 | |
| 58 | /** |
| 59 | * xmlShellReadlineFunc: |
| 60 | * @prompt: a string prompt |
| 61 | * |
| 62 | * This is a generic signature for the XML shell input function |
| 63 | * |
| 64 | * Returns a string which will be freed by the Shell |
| 65 | */ |
| 66 | typedef char * (* xmlShellReadlineFunc)(char *prompt); |
| 67 | |
| 68 | /* |
| 69 | * The shell context itself |
| 70 | * TODO: add the defined function tables. |
| 71 | */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 72 | typedef struct _xmlShellCtxt xmlShellCtxt; |
| 73 | typedef xmlShellCtxt *xmlShellCtxtPtr; |
| 74 | struct _xmlShellCtxt { |
Daniel Veillard | dbfd641 | 1999-12-28 16:35:14 +0000 | [diff] [blame] | 75 | char *filename; |
| 76 | xmlDocPtr doc; |
| 77 | xmlNodePtr node; |
| 78 | xmlXPathContextPtr pctxt; |
| 79 | int loaded; |
| 80 | FILE *output; |
| 81 | xmlShellReadlineFunc input; |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 82 | }; |
Daniel Veillard | dbfd641 | 1999-12-28 16:35:14 +0000 | [diff] [blame] | 83 | |
| 84 | /** |
| 85 | * xmlShellCmd: |
| 86 | * @ctxt: a shell context |
| 87 | * @arg: a string argument |
| 88 | * @node: a first node |
| 89 | * @node2: a second node |
| 90 | * |
| 91 | * This is a generic signature for the XML shell functions |
| 92 | * |
| 93 | * Returns an int, negative returns indicating errors |
| 94 | */ |
| 95 | typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, |
| 96 | char *arg, |
| 97 | xmlNodePtr node, |
| 98 | xmlNodePtr node2); |
| 99 | |
| 100 | /* |
| 101 | * The Shell interface. |
| 102 | */ |
| 103 | void xmlShell (xmlDocPtr doc, |
| 104 | char *filename, |
| 105 | xmlShellReadlineFunc input, |
| 106 | FILE *output); |
| 107 | |
Daniel Veillard | f600e25 | 1999-12-18 15:32:46 +0000 | [diff] [blame] | 108 | #ifdef __cplusplus |
| 109 | } |
| 110 | #endif |
Daniel Veillard | 361d845 | 2000-04-03 19:48:13 +0000 | [diff] [blame] | 111 | |
| 112 | #endif /* LIBXML_DEBUG_ENABLED */ |
Daniel Veillard | baf4cd5 | 1998-10-27 22:56:57 +0000 | [diff] [blame] | 113 | #endif /* __DEBUG_XML__ */ |