开发者

why can't i get All text within this xpath in this page?

开发者 https://www.devze.com 2023-02-18 15:37 出处:网络
here is the url and xpath . url : http://product.dangdang.com/product.aspx?product_id=21026883&ref=book-01-E1

here is the url and xpath . url : http://product.dangdang.com/product.aspx?product_id=21026883&ref=book-01-E1 xpath: //span[@class='detail_all']

doc.SelectSingleNode(xpath).innertext just can't get ALL innertext with this xpath !

why ?

how开发者_运维问答 can i fix this ?

thx !


You cannot use SelectSingleNode, as it will only return the first span or node if you want.

You have to iterate over doc.SelectNodes and concatenate your results.

0

精彩评论

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