version 1.1.1.1, 2012/02/21 23:37:57
|
version 1.1.1.2, 2014/06/15 19:53:29
|
Line 51 static xmlDocPtr document = NULL;
|
Line 51 static xmlDocPtr document = NULL;
|
/* |
/* |
* Default document |
* Default document |
*/ |
*/ |
static xmlChar buffer[] = | static xmlChar buffer[] = |
"<?xml version=\"1.0\"?>\n\ |
"<?xml version=\"1.0\"?>\n\ |
<EXAMPLE prop1=\"gnome is great\" prop2=\"& linux too\">\n\ |
<EXAMPLE prop1=\"gnome is great\" prop2=\"& linux too\">\n\ |
<head>\n\ |
<head>\n\ |
Line 79 static void
|
Line 79 static void
|
testXPath(const char *str) { |
testXPath(const char *str) { |
xmlXPathObjectPtr res; |
xmlXPathObjectPtr res; |
xmlXPathContextPtr ctxt; |
xmlXPathContextPtr ctxt; |
| |
#if defined(LIBXML_XPTR_ENABLED) |
#if defined(LIBXML_XPTR_ENABLED) |
if (xptr) { |
if (xptr) { |
ctxt = xmlXPtrNewContext(document, NULL, NULL); |
ctxt = xmlXPtrNewContext(document, NULL, NULL); |
Line 96 testXPath(const char *str) {
|
Line 96 testXPath(const char *str) {
|
|
|
comp = xmlXPathCompile(BAD_CAST str); |
comp = xmlXPathCompile(BAD_CAST str); |
if (comp != NULL) { |
if (comp != NULL) { |
if (tree) | if (tree) |
xmlXPathDebugDumpCompExpr(stdout, comp, 0); |
xmlXPathDebugDumpCompExpr(stdout, comp, 0); |
|
|
res = xmlXPathCompiledEval(comp, ctxt); |
res = xmlXPathCompiledEval(comp, ctxt); |
Line 127 testXPathFile(const char *filename) {
|
Line 127 testXPathFile(const char *filename) {
|
while (fgets(expression, 4500, input) != NULL) { |
while (fgets(expression, 4500, input) != NULL) { |
len = strlen(expression); |
len = strlen(expression); |
len--; |
len--; |
while ((len >= 0) && | while ((len >= 0) && |
((expression[len] == '\n') || (expression[len] == '\t') || |
((expression[len] == '\n') || (expression[len] == '\t') || |
(expression[len] == '\r') || (expression[len] == ' '))) len--; |
(expression[len] == '\r') || (expression[len] == ' '))) len--; |
expression[len + 1] = 0; | expression[len + 1] = 0; |
if (len >= 0) { |
if (len >= 0) { |
printf("\n========================\nExpression: %s\n", expression) ; |
printf("\n========================\nExpression: %s\n", expression) ; |
testXPath(expression); |
testXPath(expression); |
Line 150 int main(int argc, char **argv) {
|
Line 150 int main(int argc, char **argv) {
|
#if defined(LIBXML_XPTR_ENABLED) |
#if defined(LIBXML_XPTR_ENABLED) |
if ((!strcmp(argv[i], "-xptr")) || (!strcmp(argv[i], "--xptr"))) |
if ((!strcmp(argv[i], "-xptr")) || (!strcmp(argv[i], "--xptr"))) |
xptr++; |
xptr++; |
else | else |
#endif |
#endif |
if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) |
if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) |
debug++; |
debug++; |
Line 172 int main(int argc, char **argv) {
|
Line 172 int main(int argc, char **argv) {
|
xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS; |
xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS; |
xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS; |
xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS; |
xmlSubstituteEntitiesDefaultValue = 1; |
xmlSubstituteEntitiesDefaultValue = 1; |
|
#ifdef LIBXML_SAX1_ENABLED |
if (nocdata != 0) { |
if (nocdata != 0) { |
xmlDefaultSAXHandlerInit(); |
xmlDefaultSAXHandlerInit(); |
xmlDefaultSAXHandler.cdataBlock = NULL; |
xmlDefaultSAXHandler.cdataBlock = NULL; |
} |
} |
|
#endif |
if (document == NULL) { |
if (document == NULL) { |
if (filename == NULL) |
if (filename == NULL) |
document = xmlReadDoc(buffer,NULL,NULL,XML_PARSE_COMPACT); |
document = xmlReadDoc(buffer,NULL,NULL,XML_PARSE_COMPACT); |
Line 211 int main(int argc, char **argv) {
|
Line 213 int main(int argc, char **argv) {
|
printf("\t--file : or\n"); |
printf("\t--file : or\n"); |
printf("\t-f : read queries from files, args\n"); |
printf("\t-f : read queries from files, args\n"); |
} |
} |
if (document != NULL) | if (document != NULL) |
xmlFreeDoc(document); |
xmlFreeDoc(document); |
xmlCleanupParser(); |
xmlCleanupParser(); |
xmlMemoryDump(); |
xmlMemoryDump(); |