hi there,
I have problem when querying a .xspf playlist in a Qt programm with Xqueries

What i want is get locations of all files listed in an xspf playlist

What i do is the following xquery:

Qt Code:
  1. for $x in doc("/home/max/tmp/test.xspf")/playlist/trackList/track
  2. return data($x/location)
To copy to clipboard, switch view to plain text mode 
I test this xquery with BaseX and it works


in the Qt programm
Qt Code:
  1. QXmlQuery query(QXmlQuery::XQuery10);
  2. QStringList list_of_locations("");
  3. qDebug()<<"is playlist file open?"<<PLAYLIST_FILE->isOpen();
  4. query.setQuery(*XSPF_QUERY_ALL_TRACK);
  5. query.bindVariable("inputDocument", PLAYLIST_FILE); //this affect PLAYLIST_FILE the variable name "inputDocument" inside the Xquery
  6. qDebug()<<"The xquery track is"<<*XSPF_QUERY_ALL_TRACK;
  7. if (query.isValid()){
  8. qDebug()<<"The xquery is valid";
  9.  
  10. if (!query.evaluateTo(&list_of_locations)){
  11. qDebug()<<"The xquery is evaluated as false (problems occured when querying the playlist)";
  12. qDebug()<<"List of locations"<<list_of_locations;
  13. return false;
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 
XSPF_QUERY_ALL_TRACK is of type QString*
PLAYLIST_FILE os of type QFile*
output is
Qt Code:
  1. is playlist file open? true
  2. The xquery track is "for $x in doc("/home/max/tmp/test.xspf")/playlist/trackList/track
  3. return data($x/location)
  4. "
  5. The xquery is valid
  6. The xquery is evaluated as false (problems occured when querying the playlist)
  7. List of locations ("")
  8. enter define new path
To copy to clipboard, switch view to plain text mode 
Finally the test.xspf file looks like that
Qt Code:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <playlist>
  3. <trackList>
  4. <track>
  5. <location>../Music/Autre/Enrique_Iglesias/Enrique_Iglesias_-_Tonight_%28I%27m_F__kin_You%29_%5Bfeat_Ludacris_and_DJ_Frank_E%5D.mp3</location>
  6. <identifier>amarok-sqltrackuid://7f0b933f9d18196eb4a3548c94c3a512</identifier>
  7. <title>Tonight (I'm F**kin' You) feat Ludacris and DJ Frank E</title>
  8. <creator>Enrique Iglesias</creator>
  9. <album>Tonight [feat Ludacris &amp; DJ Frank E] - Single</album>
  10. <trackNum>1</trackNum>
  11. <duration>231000</duration>
  12. </track>
  13. </trackList>
  14. <extension application="http://amarok.kde.org">
  15. <queue/>
  16. </extension>
  17. </playlist>
To copy to clipboard, switch view to plain text mode 
anyone anything?

Best regards