开发者

XML ASMX Service with 1 return value - not XDocument so How to Parse?

开发者 https://www.devze.com 2023-04-10 23:26 出处:网络
I am trying to return a value from an \"XML Web Service\" that I did not create.It is an ASMX service with the following return:

I am trying to return a value from an "XML Web Service" that I did not create. It is an ASMX service with the following return:

<?xml version="1.0"?> 
123

Where the value "123" varies depending on the parameters I feed the开发者_开发知识库 service. My question is, in C# (Silverlight), how can I parse this value?

var webClient = new WebClient();
webClient.DownloadStringCompleted += webClient_DownloadStringCompleted;
webClient.DownloadStringAsync(service);

I do not see an easy way to get to the value.


As John Saunders said, this is not XML, so you can't parse it as one.

If the format is always this simple, just get the second line and use that.

EDIT:

If it's just the second line you want to get, you can use something like:

string result = downloaded.Split('\n')[1];


That's not XML, so there's no way to parse it as XML.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号