【问题标题】:how to find the following node (siblings and preceding) using xpath如何使用 xpath 查找以下节点(兄弟姐妹和前面的节点)
【发布时间】:2016-02-25 05:45:23
【问题描述】:
 <months>
  <month name="January"></month>
  <month name="February"></month>
  <month name="March"></month>
  <month name="April"></month>

  ...[etc]

</months>

如何从上面的代码中获取兄弟姐妹我想要 2 月之后节点的 xpath

我想要一个 XPath 表达式,这样如果给定编程问题站点,它将在 2 月之后给出一个月

【问题讨论】:

标签: xpath


【解决方案1】:

你可以有一个像这样的 XPath:

//months/month[@name='February']/following-sibling::month

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-13
    • 1970-01-01
    • 1970-01-01
    • 2012-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多