All,
I'm running QtCreator 2.2.1 on ubuntu 32-bit. Says I'm using 4.7.3 of Qt. So far so good. I needed to so some simple XML. Stole this example from this board which others claims works just fine.
#include <QtXml/QDomDocument>
#include <QtXml/QXmlSimpleReader>
#include <QDebug>
int main(){
QString xmlString
("<original> </original>");
doc.setContent(xmlString);
qDebug() << "Without QXmlSimpleReader \t- element contains" <<docElem.text() << "\tlength="<< docElem.text().length();
doc.clear();
source.setData(xmlString);
doc.setContent(&source, &reader);
docElem = doc.documentElement();
qDebug() << "With QXmlSimpleReader \t- element contains" <<docElem.text() << "\tlength="<< docElem.text().length();
}
#include <QtXml/QDomDocument>
#include <QtXml/QXmlSimpleReader>
#include <QDebug>
int main(){
QString xmlString("<original> </original>");
QDomDocument doc;
doc.setContent(xmlString);
QDomElement docElem = doc.documentElement();
qDebug() << "Without QXmlSimpleReader \t- element contains" <<docElem.text() << "\tlength="<< docElem.text().length();
doc.clear();
QXmlInputSource source;
source.setData(xmlString);
QXmlSimpleReader reader;
doc.setContent(&source, &reader);
docElem = doc.documentElement();
qDebug() << "With QXmlSimpleReader \t- element contains" <<docElem.text() << "\tlength="<< docElem.text().length();
}
To copy to clipboard, switch view to plain text mode
When I try to compile I get this error along with a rash of others.
(.text.startup+0x38):-1: error: undefined reference to `QDomDocument::QDomDocument()'
The header files are all there. What is missing from this installation? It's probably something simple, it's late and I'm tired.
Thanks,
Roland
Added after 14 minutes:
Never mind
I forgot to add +=xml in the pro file
stupid things happen when you get tired.
Bookmarks