From cdbae7738c35268fd9a208be0618c4ea11475935 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 23 Jan 2012 20:33:17 +0100 Subject: New config interface (xml). Instruments now contains pointers (fix memleak). --- src/saxparser.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/saxparser.cc') 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()); -- cgit v1.2.3