public static DataSet GetDataSetFromXml(string xmlValue)
{
XmlDocument xmlData = new XmlDocument();
xmlData.LoadXml(xmlValue);
XmlTextReader reader = new XmlTextReader(new StringReader(xmlData.OuterXml));
DataSet ds = new DataSet();
ds.ReadXml(reader);
return ds;
}
public static DataTable GetDataTableFromXml(string xmlValue)
{
DataSet ds = GetDataSetFromXml(xmlValue);
return ds.Tables[0];
}
public static string GetXmlFromDataSet(DataSet ds)
{
if (ds == null || ds.Tables.Count <= 0)
{
return String.Empty;
}
else
{
return ds.GetXml();
}
}
public static string GetXmlFromDataTable(DataTable dt)
{
return GetXmlFromDataSet(dt.DataSet);
}