XML string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have an XML string from which I would like to create a DataSet. This is
probably a stupid question, but how do I do this? - The XMLReader objects
always expect a stream or file as a parameter, but how do I parse XML from a
string that is getting passed in to me?

Thanks in advance!
Yuri
 
YuriL said:
I have an XML string from which I would like to create a DataSet. This is
probably a stupid question, but how do I do this? - The XMLReader objects
always expect a stream or file as a parameter, but how do I parse XML from a
string that is getting passed in to me?

You can use StreamReader to create a TextReader from the string, then
pass that into DataSet.ReadXml.
 
Hello YuriL,

[C#]
string s = "<someXml @foo='bar'/>";
XmlReader reader = new XmlTextReader(new StringReader(s));
 
Back
Top