Getting an error while reading xml document using readxml
Some existing code for reference
XmlDocument doc1 = new XmlDocument();
doc1.LoadXml("abc.xml");
DataSet ds = new DataSet();
DataTable dt = new DataTable();
ds.ReadXml(doc1);
dt = ds.Tables[0];
GridView1.DataSource = dt;
GridView1.DataBind();
It gives error that readxml does not have valid argument
Firstly,
doc1.LoadXml("abc.xml")is going to fail; that should be.Load("abc.xml")instead (the string"abc.xml"is not xml – it is a path).ReadXmlhas a lot of overloads, but none for taking anXmlDocument. Perhaps give it a node-reader instead. Or simpler, perhaps just give it the stream or string:no
XmlDocumentneeded…