Here is a function that will enable you to pass a valid XML Node and have the system return you a DataSet object that you can use to manipulate further. Good bye nasty XML!
namespace FieldOfSheep
{
public static class NodeXmlExtension
{
public static DataSet ConvertToDataSet(this XmlNode node)
{
//declaring data set object
DataSet dataset = null;
if (node != null)
{
XmlTextReader xtr = new XmlTextReader(node.OuterXml, XmlNodeType.Element, null);
dataset = new DataSet();
dataset.ReadXml(xtr);
}
return dataset;
}
}
}
This class above is intended for use as an extension method to be used like so.
using FieldOfSheep;
public static void Main(String[] args)
{
XmlNode node;
DataSet ds = node.ConvertToDataSet();
}