]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
try to work with sax2 !!!
authorNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Wed, 30 Apr 2014 21:48:21 +0000 (23:48 +0200)
committerNorbert Moutarde <norbert.moutarde@nothing2do.eu>
Wed, 30 Apr 2014 21:48:21 +0000 (23:48 +0200)
mainwindow.cpp
mainwindow.h
sax2.cpp
sax2.h

index 016da8db8e6e99a1b06d8cf51e83820a51f6c9c8..c025bd51f7d543fd30269431793b4f5a4dae5078 100644 (file)
@@ -511,7 +511,7 @@ QByteArray FileDownloader::downloadedData() const
     return m_DownloadedData;
 }
 void MainWindow::readButtons(const QByteArray &in){
-    int a=in.count('\n');
+    /*int a=in.count('\n');
     QString d=in.split('\n').at(0);
     conf->setValue(QString("firstline"), d);
     qDebug()<<"first line : "<<d;
@@ -525,7 +525,9 @@ void MainWindow::readButtons(const QByteArray &in){
         }
         qDebug()<<"q->exec() : "<<q->exec()<<" lastError()="<<q->lastError();
 
-    };
+    };*/
+    bool ok = sax2.parse(in);
+    if (!ok)qDebug() << "Parsing failed.\n";
     db.commit();
     flush();
     emit datafilled();
index 4ab06c08a867d77572002795c0d98765e3170869..b04c9bcfccf8bccd4445120d9fd45fb56c2cf336 100644 (file)
@@ -53,7 +53,7 @@ private:
     QByteArray m_DownloadedData;
 
 };
-
+#include "sax2.h"
 #endif // FILEDOWNLOADER_H
 
 
@@ -135,6 +135,7 @@ public slots:
 signals:
     void datafilled();
 private:
+
     //QsKineticScroller * ks;
     //QScrollArea * scroll;
     QMutex sql,updatelocker;
index c58890300e2f94214f167bc7e139870ba181f362..ea0efeb16ce74adc89f495f2e718a413c915a1bd 100644 (file)
--- a/sax2.cpp
+++ b/sax2.cpp
@@ -5,4 +5,10 @@ sax2::sax2(QObject *parent) :
 {
     reader.setContentHandler(&handler);
     reader.setErrorHandler(&handler);
+
+}
+sax2::parse(const QXmlInputSource *input){
+    source = new QXmlInputSource(input);
+
+
 }
diff --git a/sax2.h b/sax2.h
index d73a8116bfccab367d4bb9c9003ae300d2c38ebe..1522bea5efb1af5448b64774fb9f89428959f84d 100644 (file)
--- a/sax2.h
+++ b/sax2.h
@@ -6,13 +6,15 @@
 class sax2 : public QXmlSimpleReader
 {
     Q_OBJECT
-
+    //QByteArray data;
     QXmlSimpleReader reader;
+    QXmlDefaultHandler handler;
+    QXmlInputSource source;
 
 
 public:
     explicit sax2(QObject *parent = 0);
-
+    int parse(const QXmlInputSource *input);
 signals:
 
 public slots: