Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QXmlQuery, fail to open local xml file



  • QXmlQuery, fail to open local xml file
    Hi i need to open a local xml file and retrieve information,

    But i dont can´t.
    this is my code:

    void xmlFileRead::fileQuery(QString filename)
    			{
    				QStringList  strList;
    				QFileInfo fi(filename);
    				qDebug()<< "absPath:"<< fi.absoluteFilePath();
    				QXmlQuery query;
    				QString q=QString("doc('%1')/systems/string()").arg(fi.absoluteFilePath());
    				query.setQuery(q);
    				if (query.isValid())
    				{
    					qDebug()<< "isValid()==true:";
    					query.evaluateTo(&strList);
    				}
    
    				qDebug()<< "strList:"<< strList.count() ;
    
    			}
    

    and this mi outpup:
    absPath: "D:/shapes/98092902.xml"
    isValid()==true:
    Error FODC0002 in d:/shapes/98092902.xml: Protocol "d" is unknown,
    d is the hard drive not a protocol,
    I know that is a beginner question, but
    Why there are so few samples of QXmlQuery?


Log in to reply