Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +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 | * |
Daniel Veillard | c5d6434 | 2001-06-24 12:13:24 +0000 | [diff] [blame] | 5 | * Daniel Veillard <daniel@veillard.com> |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef __DEBUG_XML__ |
| 9 | #define __DEBUG_XML__ |
| 10 | #include <stdio.h> |
| 11 | #include <libxml/tree.h> |
| 12 | |
| 13 | #ifdef LIBXML_DEBUG_ENABLED |
| 14 | |
| 15 | #include <libxml/xpath.h> |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 22 | * The standard Dump routines. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 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); |
| 45 | void xmlDebugDumpDTD (FILE *output, |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 46 | xmlDtdPtr dtd); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 47 | void xmlDebugDumpEntities (FILE *output, |
| 48 | xmlDocPtr doc); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 49 | |
Daniel Veillard | 78d1209 | 2001-10-11 09:12:24 +0000 | [diff] [blame] | 50 | void xmlLsOneNode (FILE *output, xmlNodePtr node); |
| 51 | int xmlLsCountNode (xmlNodePtr node); |
| 52 | |
Daniel Veillard | 7f9a680 | 2001-12-20 14:01:47 +0000 | [diff] [blame] | 53 | LIBXML_DLL_IMPORT const char *xmlBoolToText (int boolval); |
Daniel Veillard | 78d1209 | 2001-10-11 09:12:24 +0000 | [diff] [blame] | 54 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 55 | /**************************************************************** |
| 56 | * * |
| 57 | * The XML shell related structures and functions * |
| 58 | * * |
| 59 | ****************************************************************/ |
| 60 | |
| 61 | /** |
| 62 | * xmlShellReadlineFunc: |
| 63 | * @prompt: a string prompt |
| 64 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 65 | * This is a generic signature for the XML shell input function. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 66 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 67 | * Returns a string which will be freed by the Shell. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 68 | */ |
| 69 | typedef char * (* xmlShellReadlineFunc)(char *prompt); |
| 70 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 71 | /** |
| 72 | * xmlShellCtxt: |
| 73 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 74 | * A debugging shell context. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 75 | * TODO: add the defined function tables. |
| 76 | */ |
| 77 | typedef struct _xmlShellCtxt xmlShellCtxt; |
| 78 | typedef xmlShellCtxt *xmlShellCtxtPtr; |
| 79 | struct _xmlShellCtxt { |
| 80 | char *filename; |
| 81 | xmlDocPtr doc; |
| 82 | xmlNodePtr node; |
| 83 | xmlXPathContextPtr pctxt; |
| 84 | int loaded; |
| 85 | FILE *output; |
| 86 | xmlShellReadlineFunc input; |
| 87 | }; |
| 88 | |
| 89 | /** |
| 90 | * xmlShellCmd: |
| 91 | * @ctxt: a shell context |
| 92 | * @arg: a string argument |
| 93 | * @node: a first node |
| 94 | * @node2: a second node |
| 95 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 96 | * This is a generic signature for the XML shell functions. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 97 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 98 | * Returns an int, negative returns indicating errors. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 99 | */ |
| 100 | typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, |
| 101 | char *arg, |
| 102 | xmlNodePtr node, |
| 103 | xmlNodePtr node2); |
| 104 | |
Daniel Veillard | 963d2ae | 2002-01-20 22:08:18 +0000 | [diff] [blame] | 105 | void xmlShellPrintXPathError (int errorType, |
| 106 | const char *arg); |
Daniel Veillard | 78d1209 | 2001-10-11 09:12:24 +0000 | [diff] [blame] | 107 | void xmlShellPrintNode (xmlNodePtr node); |
| 108 | void xmlShellPrintXPathResult(xmlXPathObjectPtr list); |
| 109 | int xmlShellList (xmlShellCtxtPtr ctxt, |
| 110 | char *arg, |
| 111 | xmlNodePtr node, |
| 112 | xmlNodePtr node2); |
| 113 | int xmlShellBase (xmlShellCtxtPtr ctxt, |
| 114 | char *arg, |
| 115 | xmlNodePtr node, |
| 116 | xmlNodePtr node2); |
| 117 | int xmlShellDir (xmlShellCtxtPtr ctxt, |
| 118 | char *arg, |
| 119 | xmlNodePtr node, |
| 120 | xmlNodePtr node2); |
| 121 | int xmlShellCat (xmlShellCtxtPtr ctxt, |
| 122 | char *arg, |
| 123 | xmlNodePtr node, |
| 124 | xmlNodePtr node2); |
| 125 | int xmlShellLoad (xmlShellCtxtPtr ctxt, |
| 126 | char *filename, |
| 127 | xmlNodePtr node, |
| 128 | xmlNodePtr node2); |
| 129 | int xmlShellWrite (xmlShellCtxtPtr ctxt, |
| 130 | char *filename, |
| 131 | xmlNodePtr node, |
| 132 | xmlNodePtr node2); |
| 133 | int xmlShellSave (xmlShellCtxtPtr ctxt, |
| 134 | char *filename, |
| 135 | xmlNodePtr node, |
| 136 | xmlNodePtr node2); |
| 137 | int xmlShellValidate (xmlShellCtxtPtr ctxt, |
| 138 | char *dtd, |
| 139 | xmlNodePtr node, |
| 140 | xmlNodePtr node2); |
| 141 | int xmlShellDu (xmlShellCtxtPtr ctxt, |
| 142 | char *arg, |
| 143 | xmlNodePtr tree, |
| 144 | xmlNodePtr node2); |
| 145 | int xmlShellPwd (xmlShellCtxtPtr ctxt, |
| 146 | char *buffer, |
| 147 | xmlNodePtr node, |
| 148 | xmlNodePtr node2); |
| 149 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 150 | /* |
| 151 | * The Shell interface. |
| 152 | */ |
Daniel Veillard | 78d1209 | 2001-10-11 09:12:24 +0000 | [diff] [blame] | 153 | void xmlShell (xmlDocPtr doc, |
| 154 | char *filename, |
| 155 | xmlShellReadlineFunc input, |
| 156 | FILE *output); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 157 | |
| 158 | #ifdef __cplusplus |
| 159 | } |
| 160 | #endif |
| 161 | |
| 162 | #endif /* LIBXML_DEBUG_ENABLED */ |
| 163 | #endif /* __DEBUG_XML__ */ |