Add xmlhandler.
authorAkos Polster <akos@pipacs.com>
Sun, 3 Oct 2010 20:25:07 +0000 (22:25 +0200)
committerAkos Polster <akos@pipacs.com>
Sun, 3 Oct 2010 20:25:07 +0000 (22:25 +0200)
model/xmlhandler.h [new file with mode: 0644]

diff --git a/model/xmlhandler.h b/model/xmlhandler.h
new file mode 100644 (file)
index 0000000..bcf23b6
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef XMLHANDLER_H
+#define XMLHANDLER_H
+
+#include <QXmlContentHandler>
+
+/** Generic XML handler. */
+class XmlHandler: public QXmlContentHandler
+{
+public:
+    bool endDocument() {return true;}
+    bool endPrefixMapping(const QString &) {return true;}
+    QString errorString() const {return QString();}
+    bool ignorableWhitespace(const QString &) {return true;}
+    bool processingInstruction(const QString &, const QString &) {
+        return true;
+    }
+    void setDocumentLocator(QXmlLocator *) {}
+    bool skippedEntity(const QString &) {return true;}
+    bool startDocument() {return true;}
+    bool startPrefixMapping(const QString &, const QString &) {return true;}
+
+    bool characters(const QString &ch) {
+        currentText += ch;
+        return true;
+    }
+
+protected:
+    QString currentText;
+};
+
+#endif // XMLHANDLER_H