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
diff --git a/testXPath.c b/testXPath.c
index f91a2e6..983299d 100644
--- a/testXPath.c
+++ b/testXPath.c
@@ -44,6 +44,7 @@
static int valid = 0;
static int expr = 0;
static int tree = 0;
+static int nocdata = 0;
static xmlDocPtr document = NULL;
/*
@@ -157,20 +158,27 @@
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 @@
#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");