首页| 论坛| 消息

标题:QT中XPath 语法怎么用,大佬们帮帮忙
作者:dafei2015
日期:2019-06-17 16:06
内容:

//@value比如选取名为value的所有属性在QT中怎么使用Xpath语法?哪位大佬写两句看看网上例子好少


#1 [toby520 06-17 17:54]
import QtQuick 2.0
import QtQuick.XmlListModel 2.0
XmlListModel {
id: xmlModel
source: "http://www.mysite.com/feed.xml"
query: "/rss/channel/item"
XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "pubDate"; query: "pubDate/string()" }
}

qml里面比较方便 qt里面 好像只有qxmlquery
#2 [toby520 06-17 18:04]
看下楼的内容
#3 [toby520 06-17 18:05]
#include "xqueryratereader.h"

#include
#include
#include
#include

#include "currency.h"

// Notes: my biggest issue with this design is that the different pieces of
//each rate are pulled out separately. I would prefer one query that
//pulled them out in sets.
void readRatesUsingXQuery(const QFileInfo file) {
const QString queryUrl = QString("doc('%1')//rate/%2/string()").arg(file.absoluteFilePath());

typedef QPair QueryPair;
QList queries;
QStringList from, to, conversion;
queries
#4 回 toby520 的帖子 [dafei2015 06-17 21:27]
toby520:#include "xqueryratereader.h"

#include
#include
#include
....... (2019-06-17 18:05) 
谢谢 有用我研究研究
#5 [fsu0413 06-17 21:54]
艾特我了。。。不过我不懂,不好意思
瞥了一眼,楼上用了QtXmlPatterns,这玩意被Qt弃用了。。。。

<< 1 2 >> (1/2)

回复 发表
主题 版块