summaryrefslogtreecommitdiff
path: root/server/src/queryparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/queryparser.cc')
-rw-r--r--server/src/queryparser.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/src/queryparser.cc b/server/src/queryparser.cc
index 9649f1f..889810f 100644
--- a/server/src/queryparser.cc
+++ b/server/src/queryparser.cc
@@ -29,6 +29,10 @@
QueryParser::QueryParser(std::string document)
{
this->document = document;
+
+ // Make sure we always contain a valid xml document.
+ if(this->document == "") this->document = "<xml></xml>";
+
p = 0;
stack.push_back(&result);
}
@@ -62,6 +66,15 @@ int QueryParser::readData(char *data, size_t size)
return len;
}
+void QueryParser::parseError(char *buf, size_t len, std::string error, int lineno)
+{
+ fprintf(stderr, "QueryParser error at line %d: %s\n", lineno, error.c_str());
+ fprintf(stderr, "\tBuffer %u bytes: [", len);
+ if(fwrite(buf, len, 1, stderr) != len) {}
+ fprintf(stderr, "]\n");
+ fflush(stderr);
+}
+
#ifdef TEST_QUERYPARSER
#include "queryhandler.h"