Hi all,

I am experiencing a strange behaviour when i am trying to read an xml file.
I just want to print a message when the startofdocument is found.

the header file:
Qt Code:
  1. #ifndef KENTRIKO_H
  2. #define KENTRIKO_H
  3. #include <QtGui>
  4. #include <QApplication>
  5. #include <QtCore>
  6. #include "ui_kentriko.h"
  7.  
  8. class kentriko : public QMainWindow
  9. {
  10. Q_OBJECT
  11.  
  12. public:
  13. kentriko(QWidget *parent = 0);
  14. ~kentriko();
  15. public slots:
  16. void anigma_arxiou();
  17. void diabase();
  18.  
  19. private:
  20. Ui::kentrikoClass ui;
  21. QXmlStreamReader ena;
  22. };
  23.  
  24. #endif // KENTRIKO_H
To copy to clipboard, switch view to plain text mode 

the implementation
Qt Code:
  1. kentriko::kentriko(QWidget *parent)
  2. : QMainWindow(parent)
  3. {
  4. ui.setupUi(this);
  5. connect(ui.anigma,SIGNAL(clicked()),this,SLOT(anigma_arxiou()));
  6. connect(ui.diabase,SIGNAL(clicked()),this,SLOT(diabase()));
  7. }
  8.  
  9. kentriko::~kentriko()
  10. {
  11.  
  12. }
  13. void kentriko::anigma_arxiou(){
  14. QString fileName =
  15. QFileDialog::getOpenFileName(this, tr("anigma arxiou"),
  16. QDir::currentPath(),tr("arxia tipou (*.xml)"));
  17. if (fileName.isEmpty())
  18. return;
  19. QFile file(fileName);
  20. ui.textBrowser->append(fileName);
  21. file.open(QFile::ReadOnly | QFile::Text);
  22. ena.setDevice(&file);
  23. }
  24.  
  25. void kentriko::diabase(){
  26. ena.readNext();
  27. if (ena.isStartDocument()){
  28. ui.textBrowser->append("start of document found");
  29. };
  30. //ena.readNext();
  31.  
  32. }
To copy to clipboard, switch view to plain text mode 
:

and the xml that I am trying to read:

Qt Code:
  1. <adbook>
  2. <contact email="kal@goteborg.se" phone="+46(0)31 123 4567" name="Kal" />
  3. <contact email="ada@goteborg.se" phone="+46(0)31 765 1234" name="Ada" />
  4. </adbook>
To copy to clipboard, switch view to plain text mode 

when the diabase function is called my program crashes.

Any idea what might causing this?

Many thanks in advance.