1
我有以下xml,並希望在xpath的幫助下獲取屬性(identifier='id')
和id
510的屬性(identifier='content')
值。Xpath獲取當前節點的值
<product id='1'>
<row='1'>
<attribute identifier='id'>510</attribute>
<attribute identifier='content'>Test 1</attribute>
</row>
<row='2'>
<attribute identifier='id'>100</attribute>
<attribute identifier='content'>Test 2</attribute>
</row>
...
</product>
我試了一下:
product[@id='1']/row/attribute[@identifier='id' and text()='510']
但正如我已經知道這個只返回與identifier='id'
的屬性的內容。 如何獲得identifier='content'
的值其中標識符'id'= 510
?
感謝您的任何幫助。
這不是XML,你的''元素有些錯誤。 –