【问题标题】:How to get count of childnodes in XML file using XQuery如何使用 XQuery 获取 XML 文件中的子节点数
【发布时间】:2013-06-18 03:18:09
【问题描述】:

我想使用 XQUERY 获取或返回 xml 文件中的项目数(<recROw></recROw>)。在 XQuery 中有没有简单的方法来做到这一点?

这是我的示例 XML 数据:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<DailyRecord>
  <recROw>
    <id>1</id>
    <name>John Smith</name>
    <gender>male</gender>
    <status>active</status>
  </recROw>
  <recROw>
    <id>2</id>
    <name>James Bond</name>
    <gender>male</gender>
    <status>active</status>
  </recROw>
<DailyRecord>

任何帮助和想法将不胜感激。提前谢谢!

【问题讨论】:

  • What have you tried? 我的意思是除了问我们。
  • 你是nodes的平均数?
  • 是项目中的节点数()

标签: java xml xquery


【解决方案1】:

试试

count(/DailyRecord/recROw)

【讨论】:

  • 好的。抱歉,我只是 XQuery 和 Java 的初学者。感谢您的失败!
  • 赞成这个问题,感谢您以准确的方式发布您的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-17
  • 1970-01-01
相关资源
最近更新 更多