diff options
Diffstat (limited to 'src/saxparser.cc')
-rw-r--r-- | src/saxparser.cc | 12 |
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()); |