- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
需要使用 Xidel 从 json 数据中获取多个元素值。单元素查询,如:
xidel - -e 'jn:members(json($raw))("client_name")'
和
xidel - -e 'jn:members(json($raw))("amount")'
工作正常但谷歌搜索了很长时间,无法找到如何构造多元素提取的表达式。以下尝试失败:
xidel - -e 'jn:members(json($raw))("client_name","amount")'
xidel - -e 'jn:members(json($raw))("client_name,amount")'
xidel - -e 'jn:members(json($raw))("client_name")("amount")'
xidel - -e 'jn:members(json($raw))[("client_name")("amount")]'
最佳答案
一些 Xidel 特定的东西(>=0.8 版本):
您不再需要 json($raw)
,$json
就足够了
它有自己的 JSON 读取语法,比 JSONiq 更像 XPath:
xidel - -e 'jn:members($json) / (client_name, amount)'
或如其他评论中所问:
xidel - -e 'string-join($json / (id, your_name, total), ",")'
而在普通的 JSONiq 中,可以使用库函数:
declare namespace libjn= "http://jsoniq.org/function-library";
string-join(libjn:values(libjn:project($json, ("id", "your_name", "total"))), ",")
关于json - Xidel json xpath - 如何获取多个元素的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25470100/
背景:我们正在汇总一些网站的内容(经许可),用于另一个应用程序的补充搜索功能。一个例子是https://centenary.bahai.us 的新闻部分。 .为此,我们考虑使用 xidel,因为模板文
我使用以下命令通过 xidel -e 提取两个值。 '//input[@name="qid"]/@value[1]' "//span[@id='trueFinalResultCount']" 但我想将
我有我的批处理文件来使用 xidel 获取链接,输出 html 不包含换行符来将每个链接与另一个链接分开 @echo off for /f "delims=" %%a in ('wmic OS Get
很高兴成为 StackOverflow 的成员,在这里潜伏了很长时间。 我需要解析两个标签之间的文本,到目前为止我找到了一个很棒的工具,叫做 Xidel 我需要解析中间的文本 Text. Also
需要使用 Xidel 从 json 数据中获取多个元素值。单元素查询,如: xidel - -e 'jn:members(json($raw))("client_name")' 和 xidel - -
请原谅我的英语,我不是母语人士 我是新手所以不太了解 我正在尝试使用 xidel 在 Windows cmd 中使用以下命令从 json 文件中提取一些值,但它不起作用 xidel MyFile.js
如果您已经使用过 Xidel,您将经常需要定位具有特定类别的节点。为了更简单地做到这一点,我想创建 has-class("class") 函数作为表达式的别名: contains(concat("",
我是一名优秀的程序员,十分优秀!