summaryrefslogtreecommitdiff
path: root/src/saxparser.h
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-03-23 18:24:29 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-03-29 22:19:49 +0200
commit8c585aa006741b95c1175afcdb01cdd3d8d2d7db (patch)
tree66c482877189c0d63708caffa0e614caf1b8f228 /src/saxparser.h
parent01e216f82e24e7668a892e5a912ccbf1369ae255 (diff)
Do the file related actions in SAXParser.
Diffstat (limited to 'src/saxparser.h')
-rw-r--r--src/saxparser.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/saxparser.h b/src/saxparser.h
index c43f00a..b4d9823 100644
--- a/src/saxparser.h
+++ b/src/saxparser.h
@@ -29,17 +29,18 @@
#include <string>
#include <map>
#include <expat.h>
+#include <fstream>
class SAXParser {
public:
SAXParser();
virtual ~SAXParser();
- //! Parses the data obtained by readData in chunks.
- int parse();
+ //! Parses the data from the file.
+ virtual int parseFile(const std::string& filename);
//! Parses all the data in the buffer.
- int parse(const std::string& buffer);
+ virtual int parseString(const std::string& str, const std::string& xml_source_name = "");
protected:
using attr_t = std::map<std::string, std::string>;
@@ -47,12 +48,11 @@ protected:
virtual void characterData(const std::string& data) {}
virtual void startTag(const std::string& name, const attr_t& attr) {}
virtual void endTag(const std::string& name) {}
- virtual void parseError(const std::string& buf, std::size_t len, const std::string& error, std::size_t lineno);
-
- virtual int readData(std::string& data, std::size_t size) { return 0; }
+ virtual void parseError(const std::string& buf, const std::string& error, const std::string& xml_source_name, std::size_t lineno);
private:
XML_Parser p;
+ std::string filename;
static void character_hndl(void* p, const XML_Char* s, int len);
static void start_hndl(void* p, const char* el, const char** attr);