Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In a web application project, I used the following code to load an xml file:
C#
string url = "http://localhost:48677/Service1.svc/GetDataSet";
 var webClient = new System.Net.WebClient();
 string ReadData = webClient.DownloadString(url);

The xml file posted in the URL is sourced a dataset. It consists of 2 parts: The 1st part is the schema part, like that:
<xs:schema xmlns=...>
  ...
</xs:element>

The 2nd part displays the data values, like that below:
<diffgr:difffram ...>
  <NewDataSet xmlns="">
    <MyData diffgr:id=...>
      <ID>1</ID>
    </MyDataSet>
    .....
  </NewDataSet>
</diffgr:diffgram>

I have tried different approaches to try to convert/parse the ReadData into a DataSet, but not successful. Please advise me how to implement this conversion if you know. Thanks.
Posted
Updated 9-Sep-13 10:00am
v3

The simplest way to do this is by using xsd.exe[^]

You could then use something like cs-script[^] to execute the generated code at runtime.

Best regards
Espen Harlinn
 
Share this answer
 
 
Share this answer
 
To Ridoy: Using the approach in Reading XML through C#, I can retrieve the records well. Thanks.
To Espen Harlinn: Thanks for your resonse.
 
Share this answer
 
Comments
ridoy 10-Sep-13 12:08pm    
you should use it as a comment,not a solution.Use Have a Question or Comment? button to do a comment.Glad to help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900