blob: 5b3be13d8572021404e69a261a4f6ece2fd22e62 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
Daniel Veillardbe586972003-11-18 20:56:51 +00002 * Summary: Tree debugging APIs
3 * Description: Interfaces to a set of routines used for debugging the tree
Owen Taylor3473f882001-02-23 17:55:21 +00004 * produced by the XML parser.
5 *
Daniel Veillardbe586972003-11-18 20:56:51 +00006 * Copy: See Copyright for the status of this software.
7 *
8 * Author: Daniel Veillard
Owen Taylor3473f882001-02-23 17:55:21 +00009 */
10
11#ifndef __DEBUG_XML__
12#define __DEBUG_XML__
13#include <stdio.h>
Igor Zlatkovic76874e42003-08-25 09:05:12 +000014#include <libxml/xmlversion.h>
Owen Taylor3473f882001-02-23 17:55:21 +000015#include <libxml/tree.h>
16
17#ifdef LIBXML_DEBUG_ENABLED
18
19#include <libxml/xpath.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/*
Daniel Veillard61f26172002-03-12 18:46:39 +000026 * The standard Dump routines.
Owen Taylor3473f882001-02-23 17:55:21 +000027 */
Daniel Veillardf8e3db02012-09-11 13:26:36 +080028XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000029 xmlDebugDumpString (FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000030 const xmlChar *str);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080031XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000032 xmlDebugDumpAttr (FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000033 xmlAttrPtr attr,
34 int depth);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080035XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000036 xmlDebugDumpAttrList (FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000037 xmlAttrPtr attr,
38 int depth);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080039XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000040 xmlDebugDumpOneNode (FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000041 xmlNodePtr node,
42 int depth);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000043XMLPUBFUN void XMLCALL
44 xmlDebugDumpNode (FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000045 xmlNodePtr node,
46 int depth);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000047XMLPUBFUN void XMLCALL
48 xmlDebugDumpNodeList (FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000049 xmlNodePtr node,
50 int depth);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000051XMLPUBFUN void XMLCALL
52 xmlDebugDumpDocumentHead(FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000053 xmlDocPtr doc);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000054XMLPUBFUN void XMLCALL
55 xmlDebugDumpDocument (FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000056 xmlDocPtr doc);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080057XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000058 xmlDebugDumpDTD (FILE *output,
Daniel Veillard5e2dace2001-07-18 19:30:27 +000059 xmlDtdPtr dtd);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080060XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000061 xmlDebugDumpEntities (FILE *output,
Owen Taylor3473f882001-02-23 17:55:21 +000062 xmlDocPtr doc);
Owen Taylor3473f882001-02-23 17:55:21 +000063
Daniel Veillard8de5c0b2004-10-07 13:14:19 +000064/****************************************************************
65 * *
Daniel Veillardf8e3db02012-09-11 13:26:36 +080066 * Checking routines *
Daniel Veillard8de5c0b2004-10-07 13:14:19 +000067 * *
68 ****************************************************************/
69
70XMLPUBFUN int XMLCALL
71 xmlDebugCheckDocument (FILE * output,
72 xmlDocPtr doc);
73
74/****************************************************************
75 * *
Daniel Veillardf8e3db02012-09-11 13:26:36 +080076 * XML shell helpers *
Daniel Veillard8de5c0b2004-10-07 13:14:19 +000077 * *
78 ****************************************************************/
79
Daniel Veillardf8e3db02012-09-11 13:26:36 +080080XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000081 xmlLsOneNode (FILE *output, xmlNodePtr node);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080082XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000083 xmlLsCountNode (xmlNodePtr node);
Daniel Veillard78d12092001-10-11 09:12:24 +000084
Daniel Veillardf8e3db02012-09-11 13:26:36 +080085XMLPUBFUN const char * XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +000086 xmlBoolToText (int boolval);
Daniel Veillard78d12092001-10-11 09:12:24 +000087
Owen Taylor3473f882001-02-23 17:55:21 +000088/****************************************************************
89 * *
90 * The XML shell related structures and functions *
91 * *
92 ****************************************************************/
93
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000094#ifdef LIBXML_XPATH_ENABLED
Owen Taylor3473f882001-02-23 17:55:21 +000095/**
96 * xmlShellReadlineFunc:
97 * @prompt: a string prompt
98 *
Daniel Veillard61f26172002-03-12 18:46:39 +000099 * This is a generic signature for the XML shell input function.
Owen Taylor3473f882001-02-23 17:55:21 +0000100 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000101 * Returns a string which will be freed by the Shell.
Owen Taylor3473f882001-02-23 17:55:21 +0000102 */
103typedef char * (* xmlShellReadlineFunc)(char *prompt);
104
Daniel Veillardbed7b052001-05-19 14:59:49 +0000105/**
106 * xmlShellCtxt:
107 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000108 * A debugging shell context.
Owen Taylor3473f882001-02-23 17:55:21 +0000109 * TODO: add the defined function tables.
110 */
111typedef struct _xmlShellCtxt xmlShellCtxt;
112typedef xmlShellCtxt *xmlShellCtxtPtr;
113struct _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 Veillard61f26172002-03-12 18:46:39 +0000130 * This is a generic signature for the XML shell functions.
Owen Taylor3473f882001-02-23 17:55:21 +0000131 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000132 * Returns an int, negative returns indicating errors.
Owen Taylor3473f882001-02-23 17:55:21 +0000133 */
134typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
135 char *arg,
136 xmlNodePtr node,
137 xmlNodePtr node2);
138
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800139XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000140 xmlShellPrintXPathError (int errorType,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000141 const char *arg);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800142XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000143 xmlShellPrintXPathResult(xmlXPathObjectPtr list);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800144XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000145 xmlShellList (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000146 char *arg,
147 xmlNodePtr node,
148 xmlNodePtr node2);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800149XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000150 xmlShellBase (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000151 char *arg,
152 xmlNodePtr node,
153 xmlNodePtr node2);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800154XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000155 xmlShellDir (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000156 char *arg,
157 xmlNodePtr node,
158 xmlNodePtr node2);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800159XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000160 xmlShellLoad (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000161 char *filename,
162 xmlNodePtr node,
163 xmlNodePtr node2);
Daniel Veillarda9cce9c2003-09-29 13:20:24 +0000164#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800165XMLPUBFUN void XMLCALL
William M. Brack21e4ef22005-01-02 09:53:13 +0000166 xmlShellPrintNode (xmlNodePtr node);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800167XMLPUBFUN int XMLCALL
William M. Brack21e4ef22005-01-02 09:53:13 +0000168 xmlShellCat (xmlShellCtxtPtr ctxt,
169 char *arg,
170 xmlNodePtr node,
171 xmlNodePtr node2);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800172XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000173 xmlShellWrite (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000174 char *filename,
175 xmlNodePtr node,
176 xmlNodePtr node2);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800177XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000178 xmlShellSave (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000179 char *filename,
180 xmlNodePtr node,
181 xmlNodePtr node2);
Daniel Veillarda9cce9c2003-09-29 13:20:24 +0000182#endif /* LIBXML_OUTPUT_ENABLED */
William M. Brack21e4ef22005-01-02 09:53:13 +0000183#ifdef LIBXML_VALID_ENABLED
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800184XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000185 xmlShellValidate (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000186 char *dtd,
187 xmlNodePtr node,
188 xmlNodePtr node2);
William M. Brack21e4ef22005-01-02 09:53:13 +0000189#endif /* LIBXML_VALID_ENABLED */
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800190XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000191 xmlShellDu (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000192 char *arg,
193 xmlNodePtr tree,
194 xmlNodePtr node2);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800195XMLPUBFUN int XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000196 xmlShellPwd (xmlShellCtxtPtr ctxt,
Daniel Veillard78d12092001-10-11 09:12:24 +0000197 char *buffer,
198 xmlNodePtr node,
199 xmlNodePtr node2);
200
Owen Taylor3473f882001-02-23 17:55:21 +0000201/*
202 * The Shell interface.
203 */
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800204XMLPUBFUN void XMLCALL
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000205 xmlShell (xmlDocPtr doc,
Daniel Veillard78d12092001-10-11 09:12:24 +0000206 char *filename,
207 xmlShellReadlineFunc input,
208 FILE *output);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800209
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000210#endif /* LIBXML_XPATH_ENABLED */
211
Owen Taylor3473f882001-02-23 17:55:21 +0000212#ifdef __cplusplus
213}
214#endif
215
216#endif /* LIBXML_DEBUG_ENABLED */
217#endif /* __DEBUG_XML__ */