Loading XML formatted string into DataSet
Hi all,
i have a problem loading a XML formated string into a DataSet. Actually i can not find a way to do that except maybe writing a string into a file and then reading from it and populating the dataset, but that can be resource consumption.
String is:
MSG><ROW><NAME>xxxx</NAME><SURENAME>xxxx</SURENAME></ROW>
<ROW><NAME>yyyyy</NAME><SURENAME>yyyyyy</SURENAME></ROW></MSG>
Any help? Thanks in advance.
Regards
Igor
Re: Loading XML formatted string into DataSet
Load the string into a stream and feed it to the DataSet
Code:
DataSet ds = new DataSet();
StringReader sr = new StringReader(@"<MSG><ROW><NAME>xxxx</NAME><SURENAME>xxxx</SURENAME></ROW><ROW><NAME>yyyyy</NAME><SURENAME>yyyyyy</SURENAME></ROW></MSG>");
ds.ReadXml(sr);
Re: Loading XML formatted string into DataSet