[Qt-interest] Problems with XML and XQuery
Esdras Beleza
listas at esdrasbeleza.com
Sat Jul 17 19:31:37 CEST 2010
Hi folks,
I'm trying to parse a XML tree in the format of a QString. It's the response
of a query to Last.fm web service described in
http://www.lastfm.com.br/api/show?service=267 .
The reply is in the variable replyString.
My code snippet is:
---- 8< cut here ----
QXmlQuery query;
query.bindVariable("data", QXmlItem(replyString));
query.setQuery("doc($data)//artist/name");
QBuffer outb;
outb.open(QIODevice::ReadWrite);
QXmlSerializer s(query, &outb);
query.evaluateTo(&s);
qDebug() << "buffer" << outb.data();
QStringList *result = new QStringList();
query.evaluateTo(result);
qDebug("num: " + QString::number(result->count()).toUtf8());
---- 8< cut here ----
I don't know if my XQuery code is right, but I'm getting this error:
Error FODC0005 in file:///home/esdras/dev/player/Player, at line 1, column
1: <?xml version="1.0" encoding="utf-8"?>
<lfm status="ok">
<artist>
(...) Long XML code (...)
</artist></lfm>
is not a valid value of type xs:anyURI.
Please, does anyone know what I'm doing wrong? I can't find any
documentation about parsing XML strings using Qt.
Regards,
Esdras
--
http://www.esdrasbeleza.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100717/31cdff67/attachment.html
More information about the Qt-interest-old
mailing list