简体   繁体   English

为什么我无法在此页面的此xpath中获取所有文本?

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

here is the url and xpath . 这是url和xpath。 url : http://product.dangdang.com/product.aspx?product_id=21026883&ref=book-01-E1 xpath: //span[@class='detail_all'] 网址: 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 ! doc.SelectSingleNode(xpath).innertext不能使用此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. 您不能使用SelectSingleNode ,因为它只会在需要时返回第一个span或节点。

You have to iterate over doc.SelectNodes and concatenate your results. 您必须遍历doc.SelectNodes并连接结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM