diff options
author | deva <deva> | 2008-09-30 12:49:34 +0000 |
---|---|---|
committer | deva <deva> | 2008-09-30 12:49:34 +0000 |
commit | e2120257dda4d91b48bb031a96edda810ce30dfb (patch) | |
tree | f83eadbbb6d84fd0d6fb7d7a4d3e342535854795 /server/src/transactionparser.cc | |
parent | a01f655935558e0f71253907fd8e4c57b0d2f64c (diff) |
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.
Diffstat (limited to 'server/src/transactionparser.cc')
-rw-r--r-- | server/src/transactionparser.cc | 40 |
1 files changed, 0 insertions, 40 deletions
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); -} |