简体   繁体   English

如何将XML Web Service中的返回纯文本添加到C#,MVC中的数据表中

[英]How to add return plain text from xml web service into data table in c#, mvc

I have called to a web service which returns plain text of xml web service. 我已经调用了一个返回xml Web服务纯文本的Web服务。 What I want is to get that plain text (string) into data table.how can I do that. 我想要的是将纯文本(字符串)放入数据表。我该怎么做。 this is my code. 这是我的代码。

           WebClient client = new WebClient();
           string url =  string.Format("https://www.someurl/products.ashx");
           string response = client.DownloadString(url);

this code retruns the string(plain text) of web service. 此代码重新运行Web服务的字符串(纯文本)。

Try following : 尝试以下操作:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Xml;

namespace ConsoleApplication56
{
    class Program
    {
        static void Main(string[] args)
        {
            string response = "";
            XmlReader reader = XmlReader.Create(response);
            DataSet ds = new DataSet();
            ds.ReadXml(reader);
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM