我试图根据包含某个单词的树中较高的强标记来获取以下li
类文本,在这种情况下:"餐馆":
<p class="">The location, where the condo is situated,
offers a good choice of <strong>restaurants</strong>.
Some of them are listed below:</p>
<ul class="">
<li class="">Restaurant 1</li>
<li class="">Restaurant 2</li>
<li class="">Restaurant 3</li>
<li class="">Restaurant 4</li>
<li class="">Restaurant 5</li>
</ul>
我尝试了以下的许多变体,假设我需要使用&#34;祖先&#34;
来更高的树。//ul/li[contains(ancestor-or-self::@strong[contains(text(),'Restaurants')])
答案 0 :(得分:0)
这个XPath,
//p[strong = 'restaurants']/following-sibling::ul[1]/li
将选择包含li
元素的ul
元素的兄弟之后的第一个p
元素的所有strong
个元素,其中"restaurants"
元素的字符串值为POST / api / Msg HTTP / 1.1
Accept: application / json
Authorization: Basic K9ykc3QyOmlmZWlnb2hjaGFpZ2hpZWxpaH53
User-Agent: RestSharp / 105.2.3.0
Content-Type: application / json
Host: xxx.xxx.xxx.xxx
Content-Length: 80
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
{"Name": "Bear", "LastName": "Lukas", "time": 797, "option": 1}
。