如何读取发布到url的xml数据 [英] how to read xml data posted to a url

查看:69
本文介绍了如何读取发布到url的xml数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在3.5 .net框架中有一个asp.net Web应用程序。

一些XML数据发布到我们的Web应用程序的URL中。

如何从网址读取这些xml数据?



提前致谢,

George nt。

Hi All,
I have a asp.net web application in 3.5 .net framework.
Some XML data is posted to a url in our web application.
How to read those xml data from url?

Thanks in advance,
George n t .

推荐答案

尝试此解决方案



http://stackoverflow.com/questions/5102865/asp-net-load-xml-file-from-url [ ^ ]
Try this solution

http://stackoverflow.com/questions/5102865/asp-net-load-xml-file-from-url[^]


试试这些链接。第一个是好的。

解析XML文件 [ ^ ]

实施XML RPC服务 [ ^ ]
Try these links. The first one is a good one.
Parse an XML file[^]
Implementing XML RPC services[^]


//This method will return the XMLdocument fetched from the provided URL
public XmlDocument GetXmlFromUrl(string url)
{
    //requesting the URL 
    var httpRequest = (HttpWebRequest)WebRequest.Create(url);
 
    //response from the request url is fetched
    var response = (HttpWebResponse)httpRequest.GetResponse();
 
    //Store the contents of the response in the stream(there are also other options)
    var receivedDataStream = response.GetResponseStream();
 
    //New XMLdocument
    var xmlFetchedData = new XmlDocument();
 
    //load the file from the stream
    xmlFetchedData.Load(receivedDataStream);
 
    //close the stream
    receivedDataStream.Close();
 
    return xmlFetchedData;
}





注意:您必须包含必要的库



如需进一步阅读: http://support.microsoft.com/kb/307643 [ ^ ]



http://nishantwork.wordpress.com/2012 / 10/10 / how-to-get-xml-data-from-url-in-c / [ ^ ]


这篇关于如何读取发布到url的xml数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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