Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ XPath查询找到的QXmlQuery更改节点_C++_Qt_Xpath - Fatal编程技术网

C++ XPath查询找到的QXmlQuery更改节点

C++ XPath查询找到的QXmlQuery更改节点,c++,qt,xpath,C++,Qt,Xpath,我有一个html树,希望更改QXmlQuery找到的所有节点的一些属性,例如style 我的代码如下所示: QXmlQuery query; query.setFocus(data); query.setQuery(xpathSelector); QXmlResultItems result; if (query.isValid()) { query.evaluateTo(&result); QXmlItem item(result.next()); while

我有一个html树,希望更改QXmlQuery找到的所有节点的一些属性,例如
style

我的代码如下所示:

QXmlQuery query;
query.setFocus(data);
query.setQuery(xpathSelector);
QXmlResultItems result;
if (query.isValid()) {
    query.evaluateTo(&result);
    QXmlItem item(result.next());
    while (!item.isNull()) {
        if (item.isNode()) {
            // alter the node here <--
        }
        item = result.next();
    }

    if (result.hasError()) {
        /* Runtime error! */
    }
}
QXmlQuery;
query.setFocus(数据);
setQuery(xpathSelector);
QXmlResultItems结果;
if(query.isValid()){
查询、评估和结果;
QXmlItem项(result.next());
而(!item.isNull()){
if(item.isNode()){
//在这里更改节点