2017-07-25 36 views
0

基本Xpath问题:我正在使用桌面应用程序在路径下的span标记中找到数字美元金额的网页。Xpath:最终节点上的标准化空间

//div[contains(@class,'ProductDetailInfoBlock-pricing-amount')]/span 

$ 35.12(只有范围内的东西)回来包围各种空白空间和9个换行符。如何将normalize-space()应用于在span中找到的结果?

的应用程序不允许:

normalize-space(//div[contains(@class,'ProductDetailInfoBlock-pricing-amount')]/span) 

如何其私下作出─把它应用到/ SPAN?谢谢!

回答

0

试试这个:

normalize-space(//div[contains(@class,'ProductDetailInfoBlock-pricing-amount')]/span/text()) 

只是添加/text()到底,因为你正试图正常化它,而不是节点)

+0

感谢澄清!诀窍;) – Lindsey