From e2120257dda4d91b48bb031a96edda810ce30dfb Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 30 Sep 2008 12:49:34 +0000 Subject: Changed SAXParser parse method to take a buffer and a size instead of a c++ string. Made the queryhandler use a read loop, parsing on-the-fly to determine when the entire document has been read. --- server/src/transactionparser.cc | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'server/src/transactionparser.cc') diff --git a/server/src/transactionparser.cc b/server/src/transactionparser.cc index 2ba4fc4..78c9b21 100644 --- a/server/src/transactionparser.cc +++ b/server/src/transactionparser.cc @@ -71,41 +71,6 @@ void TransactionParser::startTag(std::string name, std::map< std::string, std::s } } -void TransactionParser::endTag(std::string name) -{ - if(name == "pracro") done = true; -} - -int TransactionParser::readData(char *data, size_t size) -{ - printf("readData is not uasble with transaction parser!.\nUse parse(std::string) instead.\n"); - return 0; -} - -bool TransactionParser::parse(std::string data) -{ - bufferbytes = data.length(); - totalbytes += bufferbytes; - - if(! XML_Parse(p, (char*)data.c_str(), data.size(), false) ) { - if(XML_GetErrorCode(p) == XML_ERROR_JUNK_AFTER_DOC_ELEMENT) return true; - parseError((char*)data.c_str(), data.size(), XML_ErrorString(XML_GetErrorCode(p)), (int)XML_GetCurrentLineNumber(p)); - return false; - } - - if(done) { - if(! XML_Parse(p, (char*)data.c_str(), 0, true) ) { - if(XML_GetErrorCode(p) == XML_ERROR_JUNK_AFTER_DOC_ELEMENT) return true; - parseError((char*)data.c_str(), 0, XML_ErrorString(XML_GetErrorCode(p)), (int)XML_GetCurrentLineNumber(p)); - return false; - } - } - - printf("Got END_OF_TEMPLATE at %ld\n", XML_GetCurrentByteIndex(p)); - - return done; -} - void TransactionParser::parseError(char *buf, size_t len, std::string error, int lineno) { fprintf(stderr, "TransactionParser error at line %d: %s\n", lineno, error.c_str()); @@ -114,8 +79,3 @@ void TransactionParser::parseError(char *buf, size_t len, std::string error, int fprintf(stderr, "]\n"); fflush(stderr); } - -unsigned int TransactionParser::usedBytes() -{ - return bufferbytes + (XML_GetCurrentByteIndex(p) - totalbytes); -} -- cgit v1.2.3