summaryrefslogtreecommitdiff
path: root/src/saxparser.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-01-23 20:33:17 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2012-01-23 20:33:17 +0100
commitcdbae7738c35268fd9a208be0618c4ea11475935 (patch)
tree60acd18fcf988d5bfa31559520816aa0735b6e6c /src/saxparser.cc
parentf58c2e7aee2e392bdeea68abea960db0178b0a98 (diff)
New config interface (xml). Instruments now contains pointers (fix memleak).
Diffstat (limited to 'src/saxparser.cc')
-rw-r--r--src/saxparser.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/saxparser.cc b/src/saxparser.cc
index 1090ef3..b6bfa7c 100644
--- a/src/saxparser.cc
+++ b/src/saxparser.cc
@@ -108,6 +108,18 @@ int SAXParser::parse()
return 0;
}
+int SAXParser::parse(std::string buffer)
+{
+ if(!XML_Parse(p, buffer.c_str(), buffer.length(), true)) {
+ parseError((char*)buffer.c_str(), buffer.length(),
+ XML_ErrorString(XML_GetErrorCode(p)),
+ (int)XML_GetCurrentLineNumber(p));
+ return 1;
+ }
+
+ return 0;
+}
+
void SAXParser::parseError(char *buf, size_t len, std::string error, int lineno)
{
fprintf(stderr, "SAXParser error at line %d: %s\n", lineno, error.c_str());