【发布时间】:2018-06-24 22:49:06
【问题描述】:
我正在阅读这个 XPath 示例:https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx,我想知道这两个表达式之间的区别:
author
All <author> elements within the current context.
//author
All <author> elements in the document.
这两种情况有什么区别?如果“当前上下文”是根节点,这是否会使两者等价?
对于这个简单的 XML 文件:
<root>
<author>
<first-name></first-name>
</author>
</root>
我在这个网站上试过https://www.freeformatter.com/xpath-tester.html
为什么author 没有像我预期的那样返回任何东西(但//author 有效)?
【问题讨论】:
标签: xpath