开发者

Retrieving the text parts of a xpath node() value

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜