codekingpro/portable-devtools
116k
1/*2 * Summary: Tree debugging APIs3 * Description: Interfaces to a set of routines used for debugging the tree4 * produced by the XML parser.5 *6 * Copy: See Copyright for the status of this software.7 *8 * Author: Daniel Veillard9 */10 11#ifndef __DEBUG_XML__12#define __DEBUG_XML__13#include <stdio.h>14#include <libxml/xmlversion.h>15#include <libxml/tree.h>16 17#ifdef LIBXML_DEBUG_ENABLED18 19#include <libxml/xpath.h>20 21#ifdef __cplusplus22extern "C" {23#endif24 25/*26 * The standard Dump routines.27 */28XMLPUBFUN void29 xmlDebugDumpString (FILE *output,30 const xmlChar *str);31XMLPUBFUN void32 xmlDebugDumpAttr (FILE *output,33 xmlAttrPtr attr,34 int depth);35XMLPUBFUN void36 xmlDebugDumpAttrList (FILE *output,37 xmlAttrPtr attr,38 int depth);39XMLPUBFUN void40 xmlDebugDumpOneNode (FILE *output,41 xmlNodePtr node,42 int depth);43XMLPUBFUN void44 xmlDebugDumpNode (FILE *output,45 xmlNodePtr node,46 int depth);47XMLPUBFUN void48 xmlDebugDumpNodeList (FILE *output,49 xmlNodePtr node,50 int depth);51XMLPUBFUN void52 xmlDebugDumpDocumentHead(FILE *output,53 xmlDocPtr doc);54XMLPUBFUN void55 xmlDebugDumpDocument (FILE *output,56 xmlDocPtr doc);57XMLPUBFUN void58 xmlDebugDumpDTD (FILE *output,59 xmlDtdPtr dtd);60XMLPUBFUN void61 xmlDebugDumpEntities (FILE *output,62 xmlDocPtr doc);63 64/****************************************************************65 * *66 * Checking routines *67 * *68 ****************************************************************/69 70XMLPUBFUN int71 xmlDebugCheckDocument (FILE * output,72 xmlDocPtr doc);73 74/****************************************************************75 * *76 * XML shell helpers *77 * *78 ****************************************************************/79 80XMLPUBFUN void81 xmlLsOneNode (FILE *output, xmlNodePtr node);82XMLPUBFUN int83 xmlLsCountNode (xmlNodePtr node);84 85XMLPUBFUN const char *86 xmlBoolToText (int boolval);87 88/****************************************************************89 * *90 * The XML shell related structures and functions *91 * *92 ****************************************************************/93 94#ifdef LIBXML_XPATH_ENABLED95/**96 * xmlShellReadlineFunc:97 * @prompt: a string prompt98 *99 * This is a generic signature for the XML shell input function.100 *101 * Returns a string which will be freed by the Shell.102 */103typedef char * (* xmlShellReadlineFunc)(char *prompt);104 105/**106 * xmlShellCtxt:107 *108 * A debugging shell context.109 * 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 context126 * @arg: a string argument127 * @node: a first node128 * @node2: a second node129 *130 * This is a generic signature for the XML shell functions.131 *132 * Returns an int, negative returns indicating errors.133 */134typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,135 char *arg,136 xmlNodePtr node,137 xmlNodePtr node2);138 139XMLPUBFUN void140 xmlShellPrintXPathError (int errorType,141 const char *arg);142XMLPUBFUN void143 xmlShellPrintXPathResult(xmlXPathObjectPtr list);144XMLPUBFUN int145 xmlShellList (xmlShellCtxtPtr ctxt,146 char *arg,147 xmlNodePtr node,148 xmlNodePtr node2);149XMLPUBFUN int150 xmlShellBase (xmlShellCtxtPtr ctxt,151 char *arg,152 xmlNodePtr node,153 xmlNodePtr node2);154XMLPUBFUN int155 xmlShellDir (xmlShellCtxtPtr ctxt,156 char *arg,157 xmlNodePtr node,158 xmlNodePtr node2);159XMLPUBFUN int160 xmlShellLoad (xmlShellCtxtPtr ctxt,161 char *filename,162 xmlNodePtr node,163 xmlNodePtr node2);164#ifdef LIBXML_OUTPUT_ENABLED165XMLPUBFUN void166 xmlShellPrintNode (xmlNodePtr node);167XMLPUBFUN int168 xmlShellCat (xmlShellCtxtPtr ctxt,169 char *arg,170 xmlNodePtr node,171 xmlNodePtr node2);172XMLPUBFUN int173 xmlShellWrite (xmlShellCtxtPtr ctxt,174 char *filename,175 xmlNodePtr node,176 xmlNodePtr node2);177XMLPUBFUN int178 xmlShellSave (xmlShellCtxtPtr ctxt,179 char *filename,180 xmlNodePtr node,181 xmlNodePtr node2);182#endif /* LIBXML_OUTPUT_ENABLED */183#ifdef LIBXML_VALID_ENABLED184XMLPUBFUN int185 xmlShellValidate (xmlShellCtxtPtr ctxt,186 char *dtd,187 xmlNodePtr node,188 xmlNodePtr node2);189#endif /* LIBXML_VALID_ENABLED */190XMLPUBFUN int191 xmlShellDu (xmlShellCtxtPtr ctxt,192 char *arg,193 xmlNodePtr tree,194 xmlNodePtr node2);195XMLPUBFUN int196 xmlShellPwd (xmlShellCtxtPtr ctxt,197 char *buffer,198 xmlNodePtr node,199 xmlNodePtr node2);200 201/*202 * The Shell interface.203 */204XMLPUBFUN void205 xmlShell (xmlDocPtr doc,206 char *filename,207 xmlShellReadlineFunc input,208 FILE *output);209 210#endif /* LIBXML_XPATH_ENABLED */211 212#ifdef __cplusplus213}214#endif215 216#endif /* LIBXML_DEBUG_ENABLED */217#endif /* __DEBUG_XML__ */218 