0

I have called to a web service which returns plain text of xml web service. 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.

  • Could you give an example of the xml and the result you want to display? – Jamby Nov 09 '15 at 10:04
  • this code returns a string as I said. it has xml tags.but it is a plain text. no I want to put that return plain text into a dataset and then to a table.please help me with this –  Nov 09 '15 at 10:10

1 Answers1

0

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);
        }
    }
}
jdweng
  • 33,250
  • 2
  • 15
  • 20
  • i want to display the result in view, do you have any idea how to do that. –  Nov 09 '15 at 10:48
  • I like using a treeview. See answer in following posting : http://stackoverflow.com/questions/28976601/recursion-parsing-xml-file-with-attributes-into-treeview-c-sharp – jdweng Nov 09 '15 at 11:37