[Qt-interest] How to access QDomNode's value?
Eeli Reilin
eeli.reilin at gmail.com
Wed Jul 21 17:50:46 CEST 2010
Hi,
I'm trying to get the QDomNode's value(the string between the tags), and
only getting an empty string.
Let's say that I have an XML data like this:
<root>
<foo>bar</foo>
</root>
I have tried to read the value like this:
QDomDocument doc;
QDomNode fooNode = doc.documentElement().firstChildElement("foo");
if(fooNode.isNull()) {
qDebug() << "Error: could not find Foo!";
return;
}
QString fooValue = fooNode.nodeValue();
I would obviously want fooValue to contain "bar", but all I get is an
empty string.
I'm totally lost on this, so please help me!
Best regards,
Eeli Reilin
More information about the Qt-interest-old
mailing list