blob: cf017a4a734076a99bc0fbda5cc0d8d96315b55a [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
2 * debugXML.h : Interfaces to a set of routines used for debugging the tree
3 * produced by the XML parser.
4 *
Daniel Veillardc5d64342001-06-24 12:13:24 +00005 * Daniel Veillard <daniel@veillard.com>
Owen Taylor3473f882001-02-23 17:55:21 +00006 */
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
18extern "C" {
19#endif
20
21/*
Daniel Veillard61f26172002-03-12 18:46:39 +000022 * The standard Dump routines.
Owen Taylor3473f882001-02-23 17:55:21 +000023 */
24void xmlDebugDumpString (FILE *output,
25 const xmlChar *str);
26void xmlDebugDumpAttr (FILE *output,
27 xmlAttrPtr attr,
28 int depth);
29void xmlDebugDumpAttrList (FILE *output,
30 xmlAttrPtr attr,
31 int depth);
32void xmlDebugDumpOneNode (FILE *output,
33 xmlNodePtr node,
34 int depth);
35void xmlDebugDumpNode (FILE *output,
36 xmlNodePtr node,
37 int depth);
38void xmlDebugDumpNodeList (FILE *output,
39 xmlNodePtr node,
40 int depth);
41void xmlDebugDumpDocumentHead(FILE *output,
42 xmlDocPtr doc);
43void xmlDebugDumpDocument (FILE *output,
44 xmlDocPtr doc);
45void xmlDebugDumpDTD (FILE *output,
Daniel Veillard5e2dace2001-07-18 19:30:27 +000046 xmlDtdPtr dtd);
Owen Taylor3473f882001-02-23 17:55:21 +000047void xmlDebugDumpEntities (FILE *output,
48 xmlDocPtr doc);
Owen Taylor3473f882001-02-23 17:55:21 +000049
Daniel Veillard78d12092001-10-11 09:12:24 +000050void xmlLsOneNode (FILE *output, xmlNodePtr node);
51int xmlLsCountNode (xmlNodePtr node);
52
Daniel Veillard7f9a6802001-12-20 14:01:47 +000053LIBXML_DLL_IMPORT const char *xmlBoolToText (int boolval);
Daniel Veillard78d12092001-10-11 09:12:24 +000054
Owen Taylor3473f882001-02-23 17:55:21 +000055/****************************************************************
56 * *
57 * The XML shell related structures and functions *
58 * *
59 ****************************************************************/
60
61/**
62 * xmlShellReadlineFunc:
63 * @prompt: a string prompt
64 *
Daniel Veillard61f26172002-03-12 18:46:39 +000065 * This is a generic signature for the XML shell input function.
Owen Taylor3473f882001-02-23 17:55:21 +000066 *
Daniel Veillard61f26172002-03-12 18:46:39 +000067 * Returns a string which will be freed by the Shell.
Owen Taylor3473f882001-02-23 17:55:21 +000068 */
69typedef char * (* xmlShellReadlineFunc)(char *prompt);
70
Daniel Veillardbed7b052001-05-19 14:59:49 +000071/**
72 * xmlShellCtxt:
73 *
Daniel Veillard61f26172002-03-12 18:46:39 +000074 * A debugging shell context.
Owen Taylor3473f882001-02-23 17:55:21 +000075 * TODO: add the defined function tables.
76 */
77typedef struct _xmlShellCtxt xmlShellCtxt;
78typedef xmlShellCtxt *xmlShellCtxtPtr;
79struct _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 Veillard61f26172002-03-12 18:46:39 +000096 * This is a generic signature for the XML shell functions.
Owen Taylor3473f882001-02-23 17:55:21 +000097 *
Daniel Veillard61f26172002-03-12 18:46:39 +000098 * Returns an int, negative returns indicating errors.
Owen Taylor3473f882001-02-23 17:55:21 +000099 */
100typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
101 char *arg,
102 xmlNodePtr node,
103 xmlNodePtr node2);
104
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000105void xmlShellPrintXPathError (int errorType,
106 const char *arg);
Daniel Veillard78d12092001-10-11 09:12:24 +0000107void xmlShellPrintNode (xmlNodePtr node);
108void xmlShellPrintXPathResult(xmlXPathObjectPtr list);
109int xmlShellList (xmlShellCtxtPtr ctxt,
110 char *arg,
111 xmlNodePtr node,
112 xmlNodePtr node2);
113int xmlShellBase (xmlShellCtxtPtr ctxt,
114 char *arg,
115 xmlNodePtr node,
116 xmlNodePtr node2);
117int xmlShellDir (xmlShellCtxtPtr ctxt,
118 char *arg,
119 xmlNodePtr node,
120 xmlNodePtr node2);
121int xmlShellCat (xmlShellCtxtPtr ctxt,
122 char *arg,
123 xmlNodePtr node,
124 xmlNodePtr node2);
125int xmlShellLoad (xmlShellCtxtPtr ctxt,
126 char *filename,
127 xmlNodePtr node,
128 xmlNodePtr node2);
129int xmlShellWrite (xmlShellCtxtPtr ctxt,
130 char *filename,
131 xmlNodePtr node,
132 xmlNodePtr node2);
133int xmlShellSave (xmlShellCtxtPtr ctxt,
134 char *filename,
135 xmlNodePtr node,
136 xmlNodePtr node2);
137int xmlShellValidate (xmlShellCtxtPtr ctxt,
138 char *dtd,
139 xmlNodePtr node,
140 xmlNodePtr node2);
141int xmlShellDu (xmlShellCtxtPtr ctxt,
142 char *arg,
143 xmlNodePtr tree,
144 xmlNodePtr node2);
145int xmlShellPwd (xmlShellCtxtPtr ctxt,
146 char *buffer,
147 xmlNodePtr node,
148 xmlNodePtr node2);
149
Owen Taylor3473f882001-02-23 17:55:21 +0000150/*
151 * The Shell interface.
152 */
Daniel Veillard78d12092001-10-11 09:12:24 +0000153void xmlShell (xmlDocPtr doc,
154 char *filename,
155 xmlShellReadlineFunc input,
156 FILE *output);
Owen Taylor3473f882001-02-23 17:55:21 +0000157
158#ifdef __cplusplus
159}
160#endif
161
162#endif /* LIBXML_DEBUG_ENABLED */
163#endif /* __DEBUG_XML__ */