我无法根据第一个属性获得第二个属性的值。
我尝试获取内容属性的值。即 4,450
在以下 XML 之外:
<meta itemprop="price" content=" 4,450" />
尝试使用此 XPath:
//meta[@itemprop=\"price\"][@content]
但我得到的输出类似于输入 XML。
最佳答案
您需要在 content
前加一个斜线属性:
//meta[@itemprop='price']/@content
关于xpath - 无法使用 xpath 访问属性值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24423442/