1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

trying to fix #56948, this led to an XPath fix, improvements of SAX

* SAX.c parser.c testXPath.c xpath.c: trying to fix #56948, this
  led to an XPath fix, improvements of SAX initialization, and
  an added option --nocdata to testXPath
Daniel
This commit is contained in:
Daniel Veillard
2001-07-08 13:15:55 +00:00
parent 449d73988a
commit 7583a59b5a
6 changed files with 66 additions and 25 deletions

View File

@ -44,6 +44,7 @@ static int debug = 0;
static int valid = 0;
static int expr = 0;
static int tree = 0;
static int nocdata = 0;
static xmlDocPtr document = NULL;
/*
@ -157,20 +158,27 @@ int main(int argc, char **argv) {
if ((!strcmp(argv[i], "-xptr")) || (!strcmp(argv[i], "--xptr")))
xptr++;
#endif
if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
else if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
debug++;
if ((!strcmp(argv[i], "-valid")) || (!strcmp(argv[i], "--valid")))
else if ((!strcmp(argv[i], "-valid")) || (!strcmp(argv[i], "--valid")))
valid++;
if ((!strcmp(argv[i], "-expr")) || (!strcmp(argv[i], "--expr")))
else if ((!strcmp(argv[i], "-expr")) || (!strcmp(argv[i], "--expr")))
expr++;
if ((!strcmp(argv[i], "-tree")) || (!strcmp(argv[i], "--tree")))
else if ((!strcmp(argv[i], "-tree")) || (!strcmp(argv[i], "--tree")))
tree++;
if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input")))
else if ((!strcmp(argv[i], "-nocdata")) ||
(!strcmp(argv[i], "--nocdata")))
nocdata++;
else if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input")))
filename = argv[++i];
if ((!strcmp(argv[i], "-f")) || (!strcmp(argv[i], "--file")))
else if ((!strcmp(argv[i], "-f")) || (!strcmp(argv[i], "--file")))
usefile++;
}
if (valid != 0) xmlDoValidityCheckingDefaultValue = 1;
if (nocdata != 0) {
xmlDefaultSAXHandlerInit();
xmlDefaultSAXHandler.cdataBlock = NULL;
}
if (document == NULL) {
if (filename == NULL)
document = xmlParseDoc(buffer);
@ -200,6 +208,7 @@ int main(int argc, char **argv) {
#endif
printf("\t--expr : debug XPath expressions only\n");
printf("\t--tree : show the compiled XPath tree\n");
printf("\t--nocdata : do not generate CDATA nodes\n");
printf("\t--input filename : or\n");
printf("\t-i filename : read the document from filename\n");
printf("\t--file : or\n");