How to get value through xpath for repeating tags,it's like key value pair
I am developing very dynamic application. I have the below xml as input request.I am querying below through xpath.For example ,I have to get the perticular value of UpdateTime.how can i write the xpath to get the value of this field.The problem is the order of AdditionalData tag can be change.
What can i put the logic here...?
<InputData>
<AdditionalData>
<Name>TransmissionDatetime</Name>
<Value>20101130121706</Value>
</AdditionalData>
<AdditionalData>
<Name>UpdateDate</Name>
<Value>20101130121604</Value>
</AdditionalData>
<AdditionalData>
<Name>TimeofArrival</Name>
<Value>20101130161705</Value>
</AdditionalData>
<AdditionalData>
<Name>P开发者_如何学运维art</Name>
<Value>20101130161236</Value>
</AdditionalData>
<AdditionalData>
<Name>SiteID</Name>
<Value>1520537</Value>
</AdditionalData>
</InputData>
Can any one help me and give some idea.....???
You haven't made the requirement very clear, but I suspect you are looking for
/InputData/AdditionalData[Name='UpdateDate']/Value
try this: /InputData/AdditionalData[Name='UpdateDate']
?
have a look at: http://www.w3schools.com/XPath/xpath_syntax.asp
For a xpath test and development tool try XPathVisualizer...
Free. Windows only, uses .NET
精彩评论