[Qt-interest] XmlPatterns fustration
Jason H
scorp1us at yahoo.com
Fri Dec 24 20:07:11 CET 2010
I have a simple document:
<a><div class="x"></div></a>
Want to find "x" so I use /a/div/@class/string()
But my query does not work:
QBuffer device;
device.setData(sourceDoc.toUtf8());
device.open(QIODevice::ReadOnly);
QXmlQuery query;
query.setQuery("declare variable $inputDocument external;\r\n"
"doc($inputDocument)"+ path);
query.bindVariable("inputDocument", &device);
QString result;
query.evaluateTo(&result);
The above setQuery line gives me the error:
"No value is available for the external variable with name inputDocument."
When I change it to:
query.setQuery("doc($inputDocument)"+ path);
I get:
No variable with name inputDocument exists
So what am I oing wrong?
More information about the Qt-interest-old
mailing list