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