【发布时间】:2014-04-07 19:53:09
【问题描述】:
我对 XPath 表达式的类型有点困惑:
我有 XPath 表达式
/*/text()? What is its type?
count(/*/text()) what is its type?
这两种类型有什么区别。
【问题讨论】:
我对 XPath 表达式的类型有点困惑:
我有 XPath 表达式
/*/text()? What is its type?
count(/*/text()) what is its type?
这两种类型有什么区别。
【问题讨论】:
表达式/*/text() 返回一个节点集 (XPath 1.0) 或节点序列 (XPath 2.0),其中包含作为文档元素的直接子节点的所有文本节点。它不包括作为其他元素子元素的文本节点,即给定一个文档
<root>foo<child>bar</child>baz</root>
/*/text() 将是一组 两个 文本节点,一个包含文本 foo,另一个包含 baz。
count 函数返回节点集 (XPath 1.0) 中的节点数/序列中的项目数 (XPath 2.0)。在 XPath 1.0 中,所有数字都被视为双精度浮点数,在 XPath 2.0 中 count has the more specific return type of xs:integer。
【讨论】: