How to add xml?
Solved
General and Desktop
-
I am trying to build a simple xml reader using qt's stream reader. But I am running into trouble when I try to use xml
I get
C:\CPP\XmlTest\XmlTest\xmlreader.cpp:17: error: C2065: 'xml': undeclared identifier
below is the .cpp
#include "xmlreader.h" #include <qxmlstream.h> #include <qfile.h> XmlReader::XmlReader( const QString filename ) { this->filename_ = filename; } void XmlReader::Read() { QFile xmlfile(this->filename_); xmlfile.open( QIODevice::ReadOnly ); xml.setDevice( &xmlfile ); // ERROR HERE }
I added this to the application's .pro
QT += xml
What else do I need to do to use xml. Is there another library I need to include?
-
I am trying to build a simple xml reader using qt's stream reader. But I am running into trouble when I try to use xml
I get
C:\CPP\XmlTest\XmlTest\xmlreader.cpp:17: error: C2065: 'xml': undeclared identifier
below is the .cpp
#include "xmlreader.h" #include <qxmlstream.h> #include <qfile.h> XmlReader::XmlReader( const QString filename ) { this->filename_ = filename; } void XmlReader::Read() { QFile xmlfile(this->filename_); xmlfile.open( QIODevice::ReadOnly ); xml.setDevice( &xmlfile ); // ERROR HERE }
I added this to the application's .pro
QT += xml
What else do I need to do to use xml. Is there another library I need to include?
-
you can also use Qtextstream to read