开发者

XPath Help - Code for getting data before "<br>" Tag

So here is what I want to do to start off here is a simple sample HTML code

<html>
<body>
  <b>This a test <br>ABCD</b>
</body>
</html>

So now how can I get only the text "This a test" I tried to do something like thi开发者_运维技巧s "/html/body/b" but I get "ABCD" as the output? What can I do to get "This is a test"?


The XPath expression could be:-

/html/body/b[1]

This may provide you the string "This a test".

Hope it helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜