[Qt-interest] XmlPatterns fustration

Jason H scorp1us at yahoo.com
Mon Dec 27 21:28:34 CET 2010


Ah, the opposite of the QtSQL order :-/

Thanks.



________________________________
From: Hildebrando Trannin <htrannin at gmail.com>
To: Jason H <scorp1us at yahoo.com>
Cc: qt-interest at trolltech.com
Sent: Mon, December 27, 2010 3:08:09 PM
Subject: Re: [Qt-interest] XmlPatterns fustration

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/bac75b19/attachment.html 


More information about the Qt-interest-old mailing list