mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
integrating Keith Isdale patches for the XSLT debugger interfaces. Some
* include/libxml/debugXML.h debugXML.c tree.c: integrating Keith Isdale patches for the XSLT debugger interfaces. Some cleanup Daniel
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Thu Oct 11 11:10:31 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* include/libxml/debugXML.h debugXML.c tree.c: integrating
|
||||||
|
Keith Isdale patches for the XSLT debugger interfaces. Some
|
||||||
|
cleanup
|
||||||
|
|
||||||
Thu Oct 11 08:44:01 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
Thu Oct 11 08:44:01 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* win32/Makefile.mingw: update from Tobias Peters for 2.4.5
|
* win32/Makefile.mingw: update from Tobias Peters for 2.4.5
|
||||||
|
388
debugXML.c
388
debugXML.c
@ -1002,7 +1002,7 @@ xmlDebugDumpEntities(FILE * output, xmlDocPtr doc)
|
|||||||
fprintf(output, "No entities in external subset\n");
|
fprintf(output, "No entities in external subset\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xmlLsCountNode(xmlNodePtr node) {
|
int xmlLsCountNode(xmlNodePtr node) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
xmlNodePtr list = NULL;
|
xmlNodePtr list = NULL;
|
||||||
|
|
||||||
@ -1052,7 +1052,7 @@ static int xmlLsCountNode(xmlNodePtr node) {
|
|||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
xmlLsOneNode(FILE *output, xmlNodePtr node) {
|
xmlLsOneNode(FILE *output, xmlNodePtr node) {
|
||||||
switch (node->type) {
|
switch (node->type) {
|
||||||
case XML_ELEMENT_NODE:
|
case XML_ELEMENT_NODE:
|
||||||
@ -1159,12 +1159,57 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) {
|
|||||||
fprintf(output, "\n");
|
fprintf(output, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlBoolToText:
|
||||||
|
* @bool : a bool to turn into text
|
||||||
|
*
|
||||||
|
* Convenient way to turn bool into text
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
xmlBoolToText(int bool)
|
||||||
|
{
|
||||||
|
if (bool)
|
||||||
|
return("True");
|
||||||
|
else
|
||||||
|
return("False");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlGetLineNo:
|
||||||
|
* @node : valid node
|
||||||
|
*
|
||||||
|
* Get line number of node
|
||||||
|
*
|
||||||
|
* Returns the line number if sucessfull, -1 otherwise
|
||||||
|
*/
|
||||||
|
long
|
||||||
|
xmlGetLineNo(xmlNodePtr node)
|
||||||
|
{
|
||||||
|
long result = -1;
|
||||||
|
|
||||||
|
if (!node)
|
||||||
|
return result;
|
||||||
|
if (node->type == XML_ELEMENT_NODE)
|
||||||
|
result = (long) node->content;
|
||||||
|
else if ((node->prev != NULL) &&
|
||||||
|
(node->prev->type == XML_ELEMENT_NODE))
|
||||||
|
result = (long) node->prev->content;
|
||||||
|
else if ((node->parent != NULL) &&
|
||||||
|
(node->parent->type == XML_ELEMENT_NODE))
|
||||||
|
result = (long) node->parent->content;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* *
|
* *
|
||||||
* The XML shell related functions *
|
* The XML shell related functions *
|
||||||
* *
|
* *
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: Improvement/cleanups for the XML shell
|
* TODO: Improvement/cleanups for the XML shell
|
||||||
* - allow to shell out an editor on a subpart
|
* - allow to shell out an editor on a subpart
|
||||||
@ -1172,6 +1217,139 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) {
|
|||||||
* - provide registration routines
|
* - provide registration routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlShellPrintXpathError:
|
||||||
|
* @errorType: valid xpath error id
|
||||||
|
* @arg : the argument that cause xpath to fail
|
||||||
|
*
|
||||||
|
* Print the xpath error to libxml default error channel
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlShellPrintXPathError(int errorType, const char *arg)
|
||||||
|
{
|
||||||
|
const char *default_arg = "Result";
|
||||||
|
|
||||||
|
if (!arg)
|
||||||
|
arg = default_arg;
|
||||||
|
|
||||||
|
switch (errorType) {
|
||||||
|
case XPATH_UNDEFINED:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s: no such node\n", arg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case XPATH_BOOLEAN:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s is a Boolean\n", arg);
|
||||||
|
break;
|
||||||
|
case XPATH_NUMBER:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s is a number\n", arg);
|
||||||
|
break;
|
||||||
|
case XPATH_STRING:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s is a string\n", arg);
|
||||||
|
break;
|
||||||
|
case XPATH_POINT:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s is a point\n", arg);
|
||||||
|
break;
|
||||||
|
case XPATH_RANGE:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s is a range\n", arg);
|
||||||
|
break;
|
||||||
|
case XPATH_LOCATIONSET:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s is a range\n", arg);
|
||||||
|
break;
|
||||||
|
case XPATH_USERS:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s is user-defined\n", arg);
|
||||||
|
break;
|
||||||
|
case XPATH_XSLT_TREE:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"%s is an XSLT value tree\n", arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Try casting the result string function (xpath builtin)\n",
|
||||||
|
arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlShellPrintNode:
|
||||||
|
* @node : a non-null node to print to stdout
|
||||||
|
*
|
||||||
|
* Print node to stdout
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlShellPrintNode(xmlNodePtr node)
|
||||||
|
{
|
||||||
|
if (!node)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (node->type == XML_DOCUMENT_NODE)
|
||||||
|
xmlDocDump(stdout, (xmlDocPtr) node);
|
||||||
|
else if (node->type == XML_ATTRIBUTE_NODE)
|
||||||
|
xmlDebugDumpAttrList(stdout, (xmlAttrPtr) node, 0);
|
||||||
|
else
|
||||||
|
xmlElemDump(stdout, node->doc, node);
|
||||||
|
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlShellPrintXPathResult:
|
||||||
|
* list : a valid result generated by an xpath evaluation
|
||||||
|
*
|
||||||
|
* Prints result to stdout
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlShellPrintXPathResult(xmlXPathObjectPtr list)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
if (list != NULL) {
|
||||||
|
switch (list->type) {
|
||||||
|
case XPATH_NODESET:{
|
||||||
|
int indx;
|
||||||
|
|
||||||
|
if (list->nodesetval) {
|
||||||
|
for (indx = 0; indx < list->nodesetval->nodeNr;
|
||||||
|
indx++) {
|
||||||
|
if (i > 0)
|
||||||
|
fprintf(stderr, " -------\n");
|
||||||
|
xmlShellPrintNode(list->nodesetval->
|
||||||
|
nodeTab[indx]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Empty node set\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case XPATH_BOOLEAN:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Is a Boolean:%s\n",
|
||||||
|
xmlBoolToText(list->boolval));
|
||||||
|
break;
|
||||||
|
case XPATH_NUMBER:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Is a number:%0g\n", list->floatval);
|
||||||
|
break;
|
||||||
|
case XPATH_STRING:
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"Is a string:%s\n", list->stringval);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
xmlShellPrintXPathError(list->type, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlShellList:
|
* xmlShellList:
|
||||||
* @ctxt: the shell context
|
* @ctxt: the shell context
|
||||||
@ -1184,9 +1362,11 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) {
|
|||||||
*
|
*
|
||||||
* Returns 0
|
* Returns 0
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellList(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED , char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
xmlShellList(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
||||||
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
|
|
||||||
if ((node->type == XML_DOCUMENT_NODE) ||
|
if ((node->type == XML_DOCUMENT_NODE) ||
|
||||||
@ -1196,13 +1376,13 @@ xmlShellList(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED , char *arg ATTRIBUTE_UNUSED,
|
|||||||
cur = node->children;
|
cur = node->children;
|
||||||
} else {
|
} else {
|
||||||
xmlLsOneNode(stdout, node);
|
xmlLsOneNode(stdout, node);
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
xmlLsOneNode(stdout, cur);
|
xmlLsOneNode(stdout, cur);
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1217,9 +1397,11 @@ xmlShellList(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED , char *arg ATTRIBUTE_UNUSED,
|
|||||||
*
|
*
|
||||||
* Returns 0
|
* Returns 0
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellBase(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
xmlShellBase(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
||||||
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
xmlChar *base;
|
xmlChar *base;
|
||||||
|
|
||||||
base = xmlNodeGetBase(node->doc, node);
|
base = xmlNodeGetBase(node->doc, node);
|
||||||
@ -1230,7 +1412,7 @@ xmlShellBase(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED,
|
|||||||
printf("%s\n", base);
|
printf("%s\n", base);
|
||||||
xmlFree(base);
|
xmlFree(base);
|
||||||
}
|
}
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1245,9 +1427,11 @@ xmlShellBase(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED,
|
|||||||
*
|
*
|
||||||
* Returns 0
|
* Returns 0
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
||||||
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
if ((node->type == XML_DOCUMENT_NODE) ||
|
if ((node->type == XML_DOCUMENT_NODE) ||
|
||||||
(node->type == XML_HTML_DOCUMENT_NODE)) {
|
(node->type == XML_HTML_DOCUMENT_NODE)) {
|
||||||
xmlDebugDumpDocumentHead(stdout, (xmlDocPtr) node);
|
xmlDebugDumpDocumentHead(stdout, (xmlDocPtr) node);
|
||||||
@ -1256,7 +1440,7 @@ xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, x
|
|||||||
} else {
|
} else {
|
||||||
xmlDebugDumpOneNode(stdout, node, 0);
|
xmlDebugDumpOneNode(stdout, node, 0);
|
||||||
}
|
}
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1271,9 +1455,10 @@ xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, x
|
|||||||
*
|
*
|
||||||
* Returns 0
|
* Returns 0
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellCat(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
xmlShellCat(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) {
|
if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) {
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
if (node->type == XML_HTML_DOCUMENT_NODE)
|
if (node->type == XML_HTML_DOCUMENT_NODE)
|
||||||
@ -1293,7 +1478,7 @@ xmlShellCat(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
|||||||
xmlElemDump(stdout, ctxt->doc, node);
|
xmlElemDump(stdout, ctxt->doc, node);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1308,9 +1493,11 @@ xmlShellCat(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 if loading failed
|
* Returns 0 or -1 if loading failed
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNUSED,
|
xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
xmlNodePtr node ATTRIBUTE_UNUSED,
|
||||||
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
int html = 0;
|
int html = 0;
|
||||||
|
|
||||||
@ -1343,8 +1530,8 @@ xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNU
|
|||||||
#endif /* LIBXML_XPATH_ENABLED */
|
#endif /* LIBXML_XPATH_ENABLED */
|
||||||
ctxt->filename = (char *) xmlStrdup((xmlChar *) filename);
|
ctxt->filename = (char *) xmlStrdup((xmlChar *) filename);
|
||||||
} else
|
} else
|
||||||
return(-1);
|
return (-1);
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1360,29 +1547,30 @@ xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNU
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 in case of error
|
* Returns 0 or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
|
xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return(-1);
|
return (-1);
|
||||||
if ((filename == NULL) || (filename[0] == 0)) {
|
if ((filename == NULL) || (filename[0] == 0)) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Write command requires a filename argument\n");
|
"Write command requires a filename argument\n");
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
#ifdef W_OK
|
#ifdef W_OK
|
||||||
if (access((char *) filename, W_OK)) {
|
if (access((char *) filename, W_OK)) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Cannot write to %s\n", filename);
|
"Cannot write to %s\n", filename);
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
switch(node->type) {
|
switch (node->type) {
|
||||||
case XML_DOCUMENT_NODE:
|
case XML_DOCUMENT_NODE:
|
||||||
if (xmlSaveFile((char *) filename, ctxt->doc) < -1) {
|
if (xmlSaveFile((char *) filename, ctxt->doc) < -1) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Failed to write to %s\n", filename);
|
"Failed to write to %s\n", filename);
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XML_HTML_DOCUMENT_NODE:
|
case XML_HTML_DOCUMENT_NODE:
|
||||||
@ -1390,30 +1578,30 @@ xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
|
|||||||
if (htmlSaveFile((char *) filename, ctxt->doc) < 0) {
|
if (htmlSaveFile((char *) filename, ctxt->doc) < 0) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Failed to write to %s\n", filename);
|
"Failed to write to %s\n", filename);
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (xmlSaveFile((char *) filename, ctxt->doc) < -1) {
|
if (xmlSaveFile((char *) filename, ctxt->doc) < -1) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Failed to write to %s\n", filename);
|
"Failed to write to %s\n", filename);
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
#endif /* LIBXML_HTML_ENABLED */
|
#endif /* LIBXML_HTML_ENABLED */
|
||||||
break;
|
break;
|
||||||
default: {
|
default:{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
f = fopen((char *) filename, "w");
|
f = fopen((char *) filename, "w");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Failed to write to %s\n", filename);
|
"Failed to write to %s\n", filename);
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
xmlElemDump(f, ctxt->doc, node);
|
xmlElemDump(f, ctxt->doc, node);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1428,21 +1616,23 @@ xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 in case of error
|
* Returns 0 or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNUSED,
|
xmlShellSave(xmlShellCtxtPtr ctxt, char *filename,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
xmlNodePtr node ATTRIBUTE_UNUSED,
|
||||||
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
if (ctxt->doc == NULL)
|
if (ctxt->doc == NULL)
|
||||||
return(-1);
|
return (-1);
|
||||||
if ((filename == NULL) || (filename[0] == 0))
|
if ((filename == NULL) || (filename[0] == 0))
|
||||||
filename = ctxt->filename;
|
filename = ctxt->filename;
|
||||||
#ifdef W_OK
|
#ifdef W_OK
|
||||||
if (access((char *) filename, W_OK)) {
|
if (access((char *) filename, W_OK)) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Cannot save to %s\n", filename);
|
"Cannot save to %s\n", filename);
|
||||||
return(-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
switch(ctxt->doc->type) {
|
switch (ctxt->doc->type) {
|
||||||
case XML_DOCUMENT_NODE:
|
case XML_DOCUMENT_NODE:
|
||||||
if (xmlSaveFile((char *) filename, ctxt->doc) < 0) {
|
if (xmlSaveFile((char *) filename, ctxt->doc) < 0) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
@ -1465,10 +1655,10 @@ xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNU
|
|||||||
default:
|
default:
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"To save to subparts of a document use the 'write' command\n");
|
"To save to subparts of a document use the 'write' command\n");
|
||||||
return(-1);
|
return (-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1484,9 +1674,11 @@ xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNU
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 in case of error
|
* Returns 0 or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node ATTRIBUTE_UNUSED,
|
xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
xmlNodePtr node ATTRIBUTE_UNUSED,
|
||||||
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
xmlValidCtxt vctxt;
|
xmlValidCtxt vctxt;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
@ -1506,7 +1698,7 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node ATTRIBUTE_UNUS
|
|||||||
xmlFreeDtd(subset);
|
xmlFreeDtd(subset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(res);
|
return (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1522,20 +1714,23 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node ATTRIBUTE_UNUS
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 in case of error
|
* Returns 0 or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellDu(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, xmlNodePtr tree,
|
xmlShellDu(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
char *arg ATTRIBUTE_UNUSED, xmlNodePtr tree,
|
||||||
|
xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
int indent = 0,i;
|
int indent = 0, i;
|
||||||
|
|
||||||
if (tree == NULL) return(-1);
|
if (tree == NULL)
|
||||||
|
return (-1);
|
||||||
node = tree;
|
node = tree;
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
if ((node->type == XML_DOCUMENT_NODE) ||
|
if ((node->type == XML_DOCUMENT_NODE) ||
|
||||||
(node->type == XML_HTML_DOCUMENT_NODE)) {
|
(node->type == XML_HTML_DOCUMENT_NODE)) {
|
||||||
printf("/\n");
|
printf("/\n");
|
||||||
} else if (node->type == XML_ELEMENT_NODE) {
|
} else if (node->type == XML_ELEMENT_NODE) {
|
||||||
for (i = 0;i < indent;i++)
|
for (i = 0; i < indent; i++)
|
||||||
printf(" ");
|
printf(" ");
|
||||||
printf("%s\n", node->name);
|
printf("%s\n", node->name);
|
||||||
} else {
|
} else {
|
||||||
@ -1548,7 +1743,8 @@ xmlShellDu(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, xm
|
|||||||
if ((node->type == XML_DOCUMENT_NODE) ||
|
if ((node->type == XML_DOCUMENT_NODE) ||
|
||||||
(node->type == XML_HTML_DOCUMENT_NODE)) {
|
(node->type == XML_HTML_DOCUMENT_NODE)) {
|
||||||
node = ((xmlDocPtr) node)->children;
|
node = ((xmlDocPtr) node)->children;
|
||||||
} else if ((node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
|
} else if ((node->children != NULL)
|
||||||
|
&& (node->type != XML_ENTITY_REF_NODE)) {
|
||||||
/* deep first */
|
/* deep first */
|
||||||
node = node->children;
|
node = node->children;
|
||||||
indent++;
|
indent++;
|
||||||
@ -1581,7 +1777,7 @@ xmlShellDu(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, xm
|
|||||||
} else
|
} else
|
||||||
node = NULL;
|
node = NULL;
|
||||||
}
|
}
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1598,21 +1794,24 @@ xmlShellDu(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED, xm
|
|||||||
*
|
*
|
||||||
* Returns 0 or -1 in case of error
|
* Returns 0 or -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer, xmlNodePtr node,
|
xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer,
|
||||||
xmlNodePtr node2 ATTRIBUTE_UNUSED) {
|
xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
xmlNodePtr cur, tmp, next;
|
xmlNodePtr cur, tmp, next;
|
||||||
char buf[500];
|
char buf[500];
|
||||||
char sep;
|
char sep;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
char nametemp[100];
|
||||||
int occur = 0;
|
int occur = 0;
|
||||||
|
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
if (node == NULL) return(-1);
|
if (node == NULL)
|
||||||
|
return (-1);
|
||||||
cur = node;
|
cur = node;
|
||||||
do {
|
do {
|
||||||
name = "";
|
name = "";
|
||||||
sep= '?';
|
sep = '?';
|
||||||
occur = 0;
|
occur = 0;
|
||||||
if ((cur->type == XML_DOCUMENT_NODE) ||
|
if ((cur->type == XML_DOCUMENT_NODE) ||
|
||||||
(cur->type == XML_HTML_DOCUMENT_NODE)) {
|
(cur->type == XML_HTML_DOCUMENT_NODE)) {
|
||||||
@ -1620,7 +1819,12 @@ xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer, xmlNodePtr node
|
|||||||
next = NULL;
|
next = NULL;
|
||||||
} else if (cur->type == XML_ELEMENT_NODE) {
|
} else if (cur->type == XML_ELEMENT_NODE) {
|
||||||
sep = '/';
|
sep = '/';
|
||||||
name = (const char *)cur->name;
|
name = (const char *) cur->name;
|
||||||
|
if (cur->ns) {
|
||||||
|
snprintf(nametemp, 99, "%s:%s", cur->ns->prefix,
|
||||||
|
cur->name);
|
||||||
|
name = nametemp;
|
||||||
|
}
|
||||||
next = cur->parent;
|
next = cur->parent;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1639,7 +1843,8 @@ xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer, xmlNodePtr node
|
|||||||
occur++;
|
occur++;
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
if (occur != 0) occur = 1;
|
if (occur != 0)
|
||||||
|
occur = 1;
|
||||||
} else
|
} else
|
||||||
occur++;
|
occur++;
|
||||||
} else if (cur->type == XML_ATTRIBUTE_NODE) {
|
} else if (cur->type == XML_ATTRIBUTE_NODE) {
|
||||||
@ -1668,7 +1873,7 @@ xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer, xmlNodePtr node
|
|||||||
strcpy(buffer, buf);
|
strcpy(buffer, buf);
|
||||||
cur = next;
|
cur = next;
|
||||||
} while (cur != NULL);
|
} while (cur != NULL);
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1684,7 +1889,8 @@ xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer, xmlNodePtr node
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||||
FILE *output) {
|
FILE * output)
|
||||||
|
{
|
||||||
char prompt[500] = "/ > ";
|
char prompt[500] = "/ > ";
|
||||||
char *cmdline = NULL, *cur;
|
char *cmdline = NULL, *cur;
|
||||||
int nbargs;
|
int nbargs;
|
||||||
@ -1732,14 +1938,16 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
* Get a new command line
|
* Get a new command line
|
||||||
*/
|
*/
|
||||||
cmdline = ctxt->input(prompt);
|
cmdline = ctxt->input(prompt);
|
||||||
if (cmdline == NULL) break;
|
if (cmdline == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse the command itself
|
* Parse the command itself
|
||||||
*/
|
*/
|
||||||
cur = cmdline;
|
cur = cmdline;
|
||||||
nbargs = 0;
|
nbargs = 0;
|
||||||
while ((*cur == ' ') || (*cur == '\t')) cur++;
|
while ((*cur == ' ') || (*cur == '\t'))
|
||||||
|
cur++;
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((*cur != ' ') && (*cur != '\t') &&
|
while ((*cur != ' ') && (*cur != '\t') &&
|
||||||
(*cur != '\n') && (*cur != '\r')) {
|
(*cur != '\n') && (*cur != '\r')) {
|
||||||
@ -1748,13 +1956,15 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
command[i++] = *cur++;
|
command[i++] = *cur++;
|
||||||
}
|
}
|
||||||
command[i] = 0;
|
command[i] = 0;
|
||||||
if (i == 0) continue;
|
if (i == 0)
|
||||||
|
continue;
|
||||||
nbargs++;
|
nbargs++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse the argument
|
* Parse the argument
|
||||||
*/
|
*/
|
||||||
while ((*cur == ' ') || (*cur == '\t')) cur++;
|
while ((*cur == ' ') || (*cur == '\t'))
|
||||||
|
cur++;
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((*cur != '\n') && (*cur != '\r') && (*cur != 0)) {
|
while ((*cur != '\n') && (*cur != '\r') && (*cur != 0)) {
|
||||||
if (*cur == 0)
|
if (*cur == 0)
|
||||||
@ -1787,20 +1997,22 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
xmlMemShow(stdout, 0);
|
xmlMemShow(stdout, 0);
|
||||||
} else {
|
} else {
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
sscanf(arg, "%d", &len);
|
sscanf(arg, "%d", &len);
|
||||||
xmlMemShow(stdout, len);
|
xmlMemShow(stdout, len);
|
||||||
}
|
}
|
||||||
} else if (!strcmp(command, "pwd")) {
|
} else if (!strcmp(command, "pwd")) {
|
||||||
char dir[500];
|
char dir[500];
|
||||||
|
|
||||||
if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL))
|
if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL))
|
||||||
printf("%s\n", dir);
|
printf("%s\n", dir);
|
||||||
} else if (!strcmp(command, "du")) {
|
} else if (!strcmp(command, "du")) {
|
||||||
xmlShellDu(ctxt, NULL, ctxt->node, NULL);
|
xmlShellDu(ctxt, NULL, ctxt->node, NULL);
|
||||||
} else if (!strcmp(command, "base")) {
|
} else if (!strcmp(command, "base")) {
|
||||||
xmlShellBase(ctxt, NULL, ctxt->node, NULL);
|
xmlShellBase(ctxt, NULL, ctxt->node, NULL);
|
||||||
} else if ((!strcmp(command, "ls")) ||
|
} else if ((!strcmp(command, "ls")) || (!strcmp(command, "dir"))) {
|
||||||
(!strcmp(command, "dir"))) {
|
|
||||||
int dir = (!strcmp(command, "dir"));
|
int dir = (!strcmp(command, "dir"));
|
||||||
|
|
||||||
if (arg[0] == 0) {
|
if (arg[0] == 0) {
|
||||||
if (dir)
|
if (dir)
|
||||||
xmlShellDir(ctxt, NULL, ctxt->node, NULL);
|
xmlShellDir(ctxt, NULL, ctxt->node, NULL);
|
||||||
@ -1820,17 +2032,20 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"%s: no such node\n", arg);
|
"%s: no such node\n", arg);
|
||||||
break;
|
break;
|
||||||
case XPATH_NODESET: {
|
case XPATH_NODESET:{
|
||||||
int indx;
|
int indx;
|
||||||
|
|
||||||
for (indx = 0;indx < list->nodesetval->nodeNr;
|
for (indx = 0;
|
||||||
|
indx < list->nodesetval->nodeNr;
|
||||||
indx++) {
|
indx++) {
|
||||||
if (dir)
|
if (dir)
|
||||||
xmlShellDir(ctxt, NULL,
|
xmlShellDir(ctxt, NULL,
|
||||||
list->nodesetval->nodeTab[indx], NULL);
|
list->nodesetval->
|
||||||
|
nodeTab[indx], NULL);
|
||||||
else
|
else
|
||||||
xmlShellList(ctxt, NULL,
|
xmlShellList(ctxt, NULL,
|
||||||
list->nodesetval->nodeTab[indx], NULL);
|
list->nodesetval->
|
||||||
|
nodeTab[indx], NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1864,7 +2079,8 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
break;
|
break;
|
||||||
case XPATH_XSLT_TREE:
|
case XPATH_XSLT_TREE:
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"%s is an XSLT value tree\n", arg);
|
"%s is an XSLT value tree\n",
|
||||||
|
arg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
#ifdef LIBXML_XPATH_ENABLED
|
||||||
@ -1898,7 +2114,8 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
} else
|
} else
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"%s is a %d Node Set\n",
|
"%s is a %d Node Set\n",
|
||||||
arg, list->nodesetval->nodeNr);
|
arg,
|
||||||
|
list->nodesetval->nodeNr);
|
||||||
break;
|
break;
|
||||||
case XPATH_BOOLEAN:
|
case XPATH_BOOLEAN:
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
@ -1930,7 +2147,8 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
break;
|
break;
|
||||||
case XPATH_XSLT_TREE:
|
case XPATH_XSLT_TREE:
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"%s is an XSLT value tree\n", arg);
|
"%s is an XSLT value tree\n",
|
||||||
|
arg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
#ifdef LIBXML_XPATH_ENABLED
|
||||||
@ -1959,14 +2177,17 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"%s: no such node\n", arg);
|
"%s: no such node\n", arg);
|
||||||
break;
|
break;
|
||||||
case XPATH_NODESET: {
|
case XPATH_NODESET:{
|
||||||
int indx;
|
int indx;
|
||||||
|
|
||||||
for (indx = 0;indx < list->nodesetval->nodeNr;
|
for (indx = 0;
|
||||||
|
indx < list->nodesetval->nodeNr;
|
||||||
indx++) {
|
indx++) {
|
||||||
if (i > 0) printf(" -------\n");
|
if (i > 0)
|
||||||
|
printf(" -------\n");
|
||||||
xmlShellCat(ctxt, NULL,
|
xmlShellCat(ctxt, NULL,
|
||||||
list->nodesetval->nodeTab[indx], NULL);
|
list->nodesetval->
|
||||||
|
nodeTab[indx], NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2000,7 +2221,8 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
|||||||
break;
|
break;
|
||||||
case XPATH_XSLT_TREE:
|
case XPATH_XSLT_TREE:
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"%s is an XSLT value tree\n", arg);
|
"%s is an XSLT value tree\n",
|
||||||
|
arg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
#ifdef LIBXML_XPATH_ENABLED
|
||||||
|
@ -47,6 +47,12 @@ void xmlDebugDumpDTD (FILE *output,
|
|||||||
void xmlDebugDumpEntities (FILE *output,
|
void xmlDebugDumpEntities (FILE *output,
|
||||||
xmlDocPtr doc);
|
xmlDocPtr doc);
|
||||||
|
|
||||||
|
void xmlLsOneNode (FILE *output, xmlNodePtr node);
|
||||||
|
int xmlLsCountNode (xmlNodePtr node);
|
||||||
|
|
||||||
|
const char *xmlBoolToText (int bool);
|
||||||
|
long xmlGetLineNo (xmlNodePtr node);
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* *
|
* *
|
||||||
* The XML shell related structures and functions *
|
* The XML shell related structures and functions *
|
||||||
@ -97,6 +103,50 @@ typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
|
|||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
xmlNodePtr node2);
|
xmlNodePtr node2);
|
||||||
|
|
||||||
|
void xmlShellPrintXPathError (int errorType, const char* arg);
|
||||||
|
void xmlShellPrintNode (xmlNodePtr node);
|
||||||
|
void xmlShellPrintXPathResult(xmlXPathObjectPtr list);
|
||||||
|
int xmlShellList (xmlShellCtxtPtr ctxt,
|
||||||
|
char *arg,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellBase (xmlShellCtxtPtr ctxt,
|
||||||
|
char *arg,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellDir (xmlShellCtxtPtr ctxt,
|
||||||
|
char *arg,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellCat (xmlShellCtxtPtr ctxt,
|
||||||
|
char *arg,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellLoad (xmlShellCtxtPtr ctxt,
|
||||||
|
char *filename,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellWrite (xmlShellCtxtPtr ctxt,
|
||||||
|
char *filename,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellSave (xmlShellCtxtPtr ctxt,
|
||||||
|
char *filename,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellValidate (xmlShellCtxtPtr ctxt,
|
||||||
|
char *dtd,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellDu (xmlShellCtxtPtr ctxt,
|
||||||
|
char *arg,
|
||||||
|
xmlNodePtr tree,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
int xmlShellPwd (xmlShellCtxtPtr ctxt,
|
||||||
|
char *buffer,
|
||||||
|
xmlNodePtr node,
|
||||||
|
xmlNodePtr node2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The Shell interface.
|
* The Shell interface.
|
||||||
*/
|
*/
|
||||||
|
5
tree.c
5
tree.c
@ -5479,6 +5479,10 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
|
|||||||
xmlDumpElementDecl(buf, (xmlElementPtr) cur);
|
xmlDumpElementDecl(buf, (xmlElementPtr) cur);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (cur->type == XML_ATTRIBUTE_NODE){
|
||||||
|
xmlAttrDump(buf, doc, (xmlAttrPtr)cur);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (cur->type == XML_ATTRIBUTE_DECL) {
|
if (cur->type == XML_ATTRIBUTE_DECL) {
|
||||||
xmlDumpAttributeDecl(buf, (xmlAttributePtr) cur);
|
xmlDumpAttributeDecl(buf, (xmlAttributePtr) cur);
|
||||||
return;
|
return;
|
||||||
@ -5653,6 +5657,7 @@ xmlElemDump(FILE *f, xmlDocPtr doc, xmlNodePtr cur) {
|
|||||||
"xmlElemDump : doc == NULL\n");
|
"xmlElemDump : doc == NULL\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf = xmlBufferCreate();
|
buf = xmlBufferCreate();
|
||||||
if (buf == NULL) return;
|
if (buf == NULL) return;
|
||||||
if ((doc != NULL) &&
|
if ((doc != NULL) &&
|
||||||
|
Reference in New Issue
Block a user