From 5572c9bd70d7c7d4f17ec809c02d49ddf0406c50 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Wed, 30 Apr 2014 23:48:21 +0200 Subject: [PATCH] try to work with sax2 !!! --- mainwindow.cpp | 6 ++++-- mainwindow.h | 3 ++- sax2.cpp | 6 ++++++ sax2.h | 6 ++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 016da8d..c025bd5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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 : "<exec() : "<exec()<<" lastError()="<lastError(); - }; + };*/ + bool ok = sax2.parse(in); + if (!ok)qDebug() << "Parsing failed.\n"; db.commit(); flush(); emit datafilled(); diff --git a/mainwindow.h b/mainwindow.h index 4ab06c0..b04c9bc 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -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; diff --git a/sax2.cpp b/sax2.cpp index c588903..ea0efeb 100644 --- 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 d73a811..1522bea 100644 --- 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: -- 2.45.1