xpath to get all the childrens text

前端 未结 2 1473
有刺的猬
有刺的猬 2020-12-29 22:36

Is there any way to get all the childrens node values within the ul tag.

Input:

  • Industry
  • <
相关标签:
2条回答
  • 2020-12-29 23:00

    You can use XPath axis. An axis represents a relationship to the context node, and is used to locate nodes relative to that node on the tree. As of today there are 13 axes. You can use descendant for all of the children (including nested) of the context node or descendant-or-self axis which indicates the context node and all of its descendants. For example:

    //ul/descendant::*/text()
    //ul/descendant-or-self::*/text()
    
    0 讨论(0)
  • 2020-12-29 23:10

    This will retrieve all text elements with a parent ul element.

    //ul/descendant::*/text()
    
    0 讨论(0)
提交回复
热议问题