如何通过xpath获取重复标签的价值,就像键值对 [英] How to get value through xpath for repeating tags,it's like key value pair
本文介绍了如何通过xpath获取重复标签的价值,就像键值对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发非常动态的应用程序.我有下面的xml作为输入请求.我通过xpath在下面查询.例如,我必须得到UpdateTime的特定值.如何编写xpath来获取该字段的值.问题是AdditionalData的顺序标签可以更改.
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>Part</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
这篇关于如何通过xpath获取重复标签的价值,就像键值对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文