I tried three of the DataSet's overloaded ReadXml Methods (stream,string, and XmlTextReader). They all failed to populate my DataSet. Try it yourself and let me know if it works for you. I have attached the code below. Thanks!
private void mnuFile_Load_Click(object sender, System.EventArgs e)
{
try
{
if (cdOpenFile.ShowDialog() == DialogResult.OK)
{
/*XmlTextReader objXmlRdr = new XmlTextReader(cdOpenFile.OpenFile());
while(objXmlRdr.Read())
{
MessageBox.Show(objXmlRdr.Value);
}
*/
//objDs.ReadXml(new XmlTextReader(cdOpenFile.OpenFile()),XmlReadMode.IgnoreSchema);
//objDs.ReadXml(cdOpenFile.OpenFile(),XmlReadMode.IgnoreSchema);
objDs.ReadXml("C:\\xml\\inbox.xml",XmlReadMode.IgnoreSchema);
MessageBox.Show(objDs.GetXml());
/*DataTable myDt = objDs.Tables[0];
foreach (DataRow r in myDt.Rows)
MessageBox.Show(r[0].ToString());
*/
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void mnuFile_Load_Click(object sender, System.EventArgs e)
{
try
{
if (cdOpenFile.ShowDialog() == DialogResult.OK)
{
/*XmlTextReader objXmlRdr = new XmlTextReader(cdOpenFile.OpenFile());
while(objXmlRdr.Read())
{
MessageBox.Show(objXmlRdr.Value);
}
*/
//objDs.ReadXml(new XmlTextReader(cdOpenFile.OpenFile()),XmlReadMode.IgnoreSchema);
//objDs.ReadXml(cdOpenFile.OpenFile(),XmlReadMode.IgnoreSchema);
objDs.ReadXml("C:\\xml\\inbox.xml",XmlReadMode.IgnoreSchema);
MessageBox.Show(objDs.GetXml());
/*DataTable myDt = objDs.Tables[0];
foreach (DataRow r in myDt.Rows)
MessageBox.Show(r[0].ToString());
*/
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}