开发者

Retrieving the text parts of a xpath node() value

开发者 https://www.devze.com 2022-12-09 14:24 出处:网络
I\'ve created an xpath expression as follows: /html/body/div[2]/div/ul[2]/li/a/node() It returns something like this:

I've created an xpath expression as follows:

/html/body/div[2]/div/ul[2]/li/a/node()

It returns something like this:

#01 <strong&开发者_如何转开发gt;value</strong> suffix

How do I extract the "#01" part and the "suffix" part in two different xpath expressions?


i think you'd get the 'strong' node then use previous-sibling and following-sibling axes

/html/body/div[2]/div/ul[2]/li/a/strong/previous-sibling::node()
/html/body/div[2]/div/ul[2]/li/a/strong/following-sibling::node()

Might not be absolutely right - bit rusty on xpath!

0

精彩评论

暂无评论...
验证码 换一张
取 消