[Qt-interest] Problems with XML and XQuery
Jason H
scorp1us at yahoo.com
Sat Jul 17 19:41:37 CEST 2010
lfm/artist/name
But you're getting a namespace error. hrm.
________________________________
From: Esdras Beleza <listas at esdrasbeleza.com>
To: qt-interest at trolltech.com
Sent: Sat, July 17, 2010 1:31:37 PM
Subject: [Qt-interest] Problems with XML and XQuery
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.fmweb 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/63e961d0/attachment.html
More information about the Qt-interest-old
mailing list