mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
- xmllint.[c1] : added return code errors for xmllint
- xpath.c: specific debug dump function for result value trees Daniel
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
Sat Feb 24 03:35:48 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* xmllint.[c1] : added return code errors for xmllint
|
||||||
|
* xpath.c: specific debug dump function for result value trees
|
||||||
|
|
||||||
Thu Feb 22 07:52:27 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Thu Feb 22 07:52:27 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* xpath.c: finally implemented xmlXPathCompareNodeSets
|
* xpath.c: finally implemented xmlXPathCompareNodeSets
|
||||||
|
@ -95,6 +95,10 @@ Test user i/o support.
|
|||||||
.TP
|
.TP
|
||||||
.B \-\-valid
|
.B \-\-valid
|
||||||
Validate the document in addition to std well-formed.
|
Validate the document in addition to std well-formed.
|
||||||
|
.SH RESULT
|
||||||
|
xmllint will return 1 if the XML is not well formed, 2 if the
|
||||||
|
Dtd could not be loaded and 3 if the valiadtion fails. If no
|
||||||
|
error is detected it will return 0.
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.TP 2.2i
|
.TP 2.2i
|
||||||
.B /depot/package/libxml_2.0.0/bin/xmllint
|
.B /depot/package/libxml_2.0.0/bin/xmllint
|
||||||
|
@ -87,6 +87,7 @@ static char *encoding = NULL;
|
|||||||
#ifdef LIBXML_XINCLUDE_ENABLED
|
#ifdef LIBXML_XINCLUDE_ENABLED
|
||||||
static int xinclude = 0;
|
static int xinclude = 0;
|
||||||
#endif
|
#endif
|
||||||
|
static int progresult = 0;
|
||||||
|
|
||||||
|
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
@ -522,6 +523,7 @@ void parseAndPrintFile(char *filename) {
|
|||||||
* If we don't have a document we might as well give up. Do we
|
* If we don't have a document we might as well give up. Do we
|
||||||
* want an error message here? <sven@zen.org> */
|
* want an error message here? <sven@zen.org> */
|
||||||
if (doc == NULL) {
|
if (doc == NULL) {
|
||||||
|
progresult = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,6 +617,7 @@ void parseAndPrintFile(char *filename) {
|
|||||||
if (dtd == NULL) {
|
if (dtd == NULL) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Could not parse DTD %s\n", dtdvalid);
|
"Could not parse DTD %s\n", dtdvalid);
|
||||||
|
progresult = 2;
|
||||||
} else {
|
} else {
|
||||||
xmlValidCtxt cvp;
|
xmlValidCtxt cvp;
|
||||||
cvp.userData = (void *) stderr; cvp.error = (xmlValidityErrorFunc) fprintf; cvp.warning = (xmlValidityWarningFunc) fprintf;
|
cvp.userData = (void *) stderr; cvp.error = (xmlValidityErrorFunc) fprintf; cvp.warning = (xmlValidityWarningFunc) fprintf;
|
||||||
@ -622,6 +625,7 @@ void parseAndPrintFile(char *filename) {
|
|||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Document %s does not validate against %s\n",
|
"Document %s does not validate against %s\n",
|
||||||
filename, dtdvalid);
|
filename, dtdvalid);
|
||||||
|
progresult = 3;
|
||||||
}
|
}
|
||||||
xmlFreeDtd(dtd);
|
xmlFreeDtd(dtd);
|
||||||
}
|
}
|
||||||
@ -631,6 +635,7 @@ void parseAndPrintFile(char *filename) {
|
|||||||
if (!xmlValidateDocument(&cvp, doc)) {
|
if (!xmlValidateDocument(&cvp, doc)) {
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"Document %s does not validate\n", filename);
|
"Document %s does not validate\n", filename);
|
||||||
|
progresult = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,6 +836,6 @@ main(int argc, char **argv) {
|
|||||||
xmlCleanupParser();
|
xmlCleanupParser();
|
||||||
xmlMemoryDump();
|
xmlMemoryDump();
|
||||||
|
|
||||||
return(0);
|
return(progresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
42
xpath.c
42
xpath.c
@ -211,6 +211,27 @@ void xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
|
|||||||
else
|
else
|
||||||
xmlDebugDumpOneNode(output, cur, depth);
|
xmlDebugDumpOneNode(output, cur, depth);
|
||||||
}
|
}
|
||||||
|
void xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) {
|
||||||
|
xmlNodePtr tmp;
|
||||||
|
int i;
|
||||||
|
char shift[100];
|
||||||
|
|
||||||
|
for (i = 0;((i < depth) && (i < 25));i++)
|
||||||
|
shift[2 * i] = shift[2 * i + 1] = ' ';
|
||||||
|
shift[2 * i] = shift[2 * i + 1] = 0;
|
||||||
|
if (cur == NULL) {
|
||||||
|
fprintf(output, shift);
|
||||||
|
fprintf(output, "Node is NULL !\n");
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
while (cur != NULL) {
|
||||||
|
tmp = cur;
|
||||||
|
cur = cur->next;
|
||||||
|
xmlDebugDumpOneNode(output, tmp, depth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
|
void xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
|
||||||
int i;
|
int i;
|
||||||
@ -235,6 +256,25 @@ void xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) {
|
||||||
|
int i;
|
||||||
|
char shift[100];
|
||||||
|
|
||||||
|
for (i = 0;((i < depth) && (i < 25));i++)
|
||||||
|
shift[2 * i] = shift[2 * i + 1] = ' ';
|
||||||
|
shift[2 * i] = shift[2 * i + 1] = 0;
|
||||||
|
|
||||||
|
if ((cur == NULL) || (cur->nodeNr == 0) || (cur->nodeTab[0] == NULL)) {
|
||||||
|
fprintf(output, shift);
|
||||||
|
fprintf(output, "Value Tree is NULL !\n");
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(output, shift);
|
||||||
|
fprintf(output, "%d", i + 1);
|
||||||
|
xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1);
|
||||||
|
}
|
||||||
#if defined(LIBXML_XPTR_ENABLED)
|
#if defined(LIBXML_XPTR_ENABLED)
|
||||||
void xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth);
|
void xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth);
|
||||||
void xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
|
void xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
|
||||||
@ -284,7 +324,7 @@ void xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
|
|||||||
break;
|
break;
|
||||||
case XPATH_XSLT_TREE:
|
case XPATH_XSLT_TREE:
|
||||||
fprintf(output, "Object is an XSLT value tree :\n");
|
fprintf(output, "Object is an XSLT value tree :\n");
|
||||||
xmlXPathDebugDumpNode(output, cur->user, depth);
|
xmlXPathDebugDumpValueTree(output, cur->nodesetval, depth);
|
||||||
break;
|
break;
|
||||||
case XPATH_BOOLEAN:
|
case XPATH_BOOLEAN:
|
||||||
fprintf(output, "Object is a Boolean : ");
|
fprintf(output, "Object is a Boolean : ");
|
||||||
|
Reference in New Issue
Block a user