Folks,
A bit of a newbie question I'm hoping someone may be able to answer. We are using a system that writes job values into a JDF file (basically an XML file). We then need to read the data out of this file at gateways using XPaths.
The problem is that the XML is written (by the application) in a bit of a weird way. Instead of having unique tags, the tags repeat. Example -
Code:
<od:XMPBlob>
<od:XMPItem>
<od:XMPItemName>ItemA</od:XMPItemName>
<od:XMPItemValue>ValueA</od:XMPItemValue>
</od:XMPItem>
<od:XMPItem>
<od:XMPItemName>ItemB</od:XMPItemName>
<od:XMPItemValue>ValueB</od:XMPItemValue>
</od:XMPItem>
</od:XMPBlob>
Firstly, is this normal? As in having common tag names?
So the problem comes when trying to reference data from this XML using XPaths. The only way I have got it to work is like this -
//od:XMPBlob/od:XMPItem[1]/od:XMPItemValue
This will get the value of the 1st item in the list. The problem is, the items are never in exactly the same order. I need to know how to reference the items via an XPath based on the XMPItemName.
That is, I want to get the value of XMPItemName:ItemA. Does anyone know how to do this using XPaths?
Any pointers no matter how general are much appreciated!!
Regards
HP