Oracles

Oraclize RSS 查詢中的 XPath

  • July 31, 2017

我正在嘗試使用 Oraclize,使用他們的測試查詢服務測試一些範例查詢。我無法讓 XML 解析器與 XPath 一起工作。該文件缺少 XML 範例。

考慮這個簡單的提要

以下查詢Dictionary.com Word of the Day按預期返回 :

xml(http://www.dictionary.com/wordoftheday/wotd.rss).rss.channel.title

以下使用 XPath 的語義等效查詢不返回任何內容:

xml(http://www.dictionary.com/wordoftheday/wotd.rss).xpath(./rss/channel/title/text())

如何使用 Oraclize 查詢 RSS 提要並根據條件過濾結果(例如,<user>欄位等於 的項目Alice等)?

這是有效的 - 在 XPath 中指定絕對路徑而不是相對路徑:

xml(http://www.dictionary.com/wordoftheday/wotd.rss).xpath(/rss/channel/title/text())

引用自:https://ethereum.stackexchange.com/questions/23330