XML ASMX 服务有 1 个返回值 - 不是 XDocument 那么如何解析?
我试图从我没有创建的“XML Web 服务”返回一个值。它是一个 ASMX 服务,具有以下返回值:
<?xml version="1.0"?>
123
其中值“123”根据我提供给服务的参数而变化。我的问题是,在 C# (Silverlight) 中,我如何解析这个值?
var webClient = new WebClient();
webClient.DownloadStringCompleted += webClient_DownloadStringCompleted;
webClient.DownloadStringAsync(service);
我没有看到一个简单的方法来获得这个值。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 John Saunders 所说,这不是 XML,因此您无法将其解析为 XML。
如果格式总是这么简单,只需获取第二行并使用它即可。
编辑:
如果您只想获得第二行,您可以使用类似以下内容的内容:
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:
这不是 XML,因此无法将其解析为 XML。
That's not XML, so there's no way to parse it as XML.