Reputation: 121
I am getting xml stream from client application how to parse that stream directly and how to load it to dataset?
[WebInvoke(UriTemplate = "UpdateFile/{id}", Method = "POST")]
public bool UpdateTestXMLFile(string id, Stream createdText)
{
string filenamewithpath = System.Web.HttpContext.Current.Server.MapPath(@"~/files/" + id+".xml");
System.IO.File.WriteAllBytes(filenamewithpath, Util.ReadFully(createdText));
}
Please tell me ..
Upvotes: 1
Views: 526
Reputation: 148120
You can use DataSet.ReadXml(Stream stream), overloaded method of data set, it takes stream in parameter.
[WebInvoke(UriTemplate = "UpdateFile/{id}", Method = "POST")]
public bool UpdateTestXMLFile(string id, Stream createdText)
{
DataSet ds = new DataSet();
ds.ReadXml(createdText)
string filenamewithpath = System.Web.HttpContext.Current.Server.MapPath(@"~/files/" + id+".xml");
ds.WriteXml(filenamewithpath);
}
Upvotes: 1