你好,我得到了这段 html,我想从中获取文本元素
<span id="product_description" itemprop="description" class="">
<h1>Toltec Lighting 216-BRZ-508 Leaf Collection Traditional Potrack With Italian Marble Glass In Bronze</h1>
<br class="">
<span style="font-weight: bold;" class="">MANUFACTURE: </span>
Toltec Lighting
<br class=" xh-highlight">
<span style="font-weight: bold;" class="">COLLECTION: </span>
Leaf
<br class=" xh-highlight">
</span>
我想获取值列表。在本例中,它将是“Toltec Lighting”和“Leaf”
你可以试试这个:
//span[@id='product_description']/text()
或者如果您还需要确保没有选择空文本节点:
//span[@id='product_description']/text()[normalize-space()]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)