[Qt-qml] XmlListModel and request

Surik Sayadyan ssyrik at gmail.com
Thu Oct 7 22:49:41 CEST 2010


XmlListModel {
       id: albumXmlModel
       source: ""
       query: "/lfm/topalbums/album"

       XmlRole {name: "album"; query: "name/string()" }
       XmlRole {name: "image"; query: "image[3]/string()"}

function searchAlbum(artist)
       {
           if(artist.trim() == "") return;
           albumXmlModel.source =
"http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist="
                   + artist + "&api_key=" + container.lastfmkey
       }
}

I have a problem with XmlListModel. In application I work whith
Last.Fm API. Function 'searchAlbum' searches albums of artist
'artist'. If the artist's name contains a character '&', that it must
be replaced by '%26'. I wrote:

function searchAlbum(artist)
       {
           artist = artist.replace("&","%26")
           albumXmlModel.source =
"http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist="
                   + artist + "&api_key=" + container.lastfmkey
       }

But in Wireshark I looked this:

GET /2.0/?method=artist.search&artist=abc26abc&api_key=22789788517XXXXXXXe6d7b4a975c220
HTTP/1.1

In request all characters '%' are removed from the line. This is a
bug? How to solve this problem?




More information about the Qt-qml mailing list