如何获取XML格式的数据-使用Web服务? [英] How to get data in XML format - Working with web Service?

查看:61
本文介绍了如何获取XML格式的数据-使用Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好专家...

以我的身份开始...请帮助找到解决方案----我正在使用Web服务api,它将以XML共振峰的形式返回数据.

我将在WebService/API中传递IP地址.这将返回此数据....

Hello Experts ...

As I am begienner... Kindly help in finding the solution ---- i am using a webservice, api which will return data in XML formant.

I will pass IP Address in WebService/API. This will return this data ....

<Locations>
 <Location id="0">
    <Ip>74.125.45.100</Ip>
    <Status>OK</Status>
    <CountryCode>US</CountryCode>
    <CountryName>United States</CountryName>
    <RegionCode>06</RegionCode>
    <RegionName>California</RegionName>
    <City>Mountain View</City>
    <ZipPostalCode>94043</ZipPostalCode>
    <Latitude>37.4192</Latitude>
    <Longitude>-122.057</Longitude>
 </Location>
</Locations>


问题是我想在Label中显示数据CITY,COUNTRY,STATE.

请告诉我逻辑-如何从此XML格式读取数据?如何搭配?
请提供代码,因为该XML是由API生成的?
非常感谢


Problem is I want to show data CITY,COUNTRY,STATE in Label.

Kindly tell me the logic - how to read data from this XML Format? How to match them?
Kindly provide me the code, as this XML is generated by API?
Thanks a lot

推荐答案

您可以在此处 [ ^ ],以了解有关XPath的更多信息,您需要访问XPath的适当元素在XML片段中.

由于您没有说明在何处或如何使用Web服务,Win app,ASP.NET,PHP,JavaScript,因此很难给出更具体的答案.
You can look here[^] to learn more about XPath, which what you will need to access the appropriate elements in the XML fragment.

Since you didn''t say where or how you were using the web service, Win app, ASP.NET, PHP, JavaScript, it would be difficult to give a more specific answer.


这篇关于如何获取XML格式的数据-使用Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆