Reputation: 23
In the following XML file, I would like to extract the value 300.
<Cube>
<Cube time="Test">
<data name="value">300</data>
</Cube>
</Cube>
I tried the following code but it doesn't seem to be working.
xidel 1.xml -e "css('Cube[time=Test] data[name=value]')/@value"
How would I extract the value?
Upvotes: 0
Views: 1435
Reputation: 89305
You don't need the trailing /@value
, omit it and your command should return the value 300
fine :
xidel 1.xml -e "css('Cube[time=Test] data[name=value]')"
or using equivalent XPath expression :
xidel 1.xml -e "/Cube/Cube[@time='Test']/data[@name='value']"
Upvotes: 1