[Qt-interest] XmlPatterns fustration

Hildebrando Trannin htrannin at gmail.com
Mon Dec 27 21:08:09 CET 2010


Jason,

you have to call *bindVariable* before *setQuery* method.

Hildebrando

On Fri, Dec 24, 2010 at 5:07 PM, Jason H <scorp1us at yahoo.com> wrote:

>
> 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?
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101227/a209606f/attachment.html 


More information about the Qt-interest-old mailing list