blob: a4619029cbd3116cb8a64432cf50a6da47d4f5b8 [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/*
22 * The standard Dump routines
23 */
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 Veillardebd38c52001-11-01 08:38:12 +000053const char *xmlBoolToText (int boolval);
Daniel Veillard78d12092001-10-11 09:12:24 +000054long xmlGetLineNo (xmlNodePtr node);
55
Owen Taylor3473f882001-02-23 17:55:21 +000056/****************************************************************
57 * *
58 * The XML shell related structures and functions *
59 * *
60 ****************************************************************/
61
62/**
63 * xmlShellReadlineFunc:
64 * @prompt: a string prompt
65 *
66 * This is a generic signature for the XML shell input function
67 *
68 * Returns a string which will be freed by the Shell
69 */
70typedef char * (* xmlShellReadlineFunc)(char *prompt);
71
Daniel Veillardbed7b052001-05-19 14:59:49 +000072/**
73 * xmlShellCtxt:
74 *
75 * A debugging shell context
Owen Taylor3473f882001-02-23 17:55:21 +000076 * TODO: add the defined function tables.
77 */
78typedef struct _xmlShellCtxt xmlShellCtxt;
79typedef xmlShellCtxt *xmlShellCtxtPtr;
80struct _xmlShellCtxt {
81 char *filename;
82 xmlDocPtr doc;
83 xmlNodePtr node;
84 xmlXPathContextPtr pctxt;
85 int loaded;
86 FILE *output;
87 xmlShellReadlineFunc input;
88};
89
90/**
91 * xmlShellCmd:
92 * @ctxt: a shell context
93 * @arg: a string argument
94 * @node: a first node
95 * @node2: a second node
96 *
97 * This is a generic signature for the XML shell functions
98 *
99 * Returns an int, negative returns indicating errors
100 */
101typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
102 char *arg,
103 xmlNodePtr node,
104 xmlNodePtr node2);
105
Daniel Veillard78d12092001-10-11 09:12:24 +0000106void xmlShellPrintXPathError (int errorType, const char* arg);
107void 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__ */