skeletonatthefeast
Programmer
Hi all,
I have just started programming in C# and hope to store relational db data in XML files.
When trying to load a file of xml data which adheres to the schema already loaded into my dataset, I get an exception that says "Data at the root level is invalid. Line 1, position 1876.". This occurs on the line dsCamTypeData.ReadXml(myReader, System.Data.XmlReadMode.ReadSchema);
from the code below. The schema appears to load in ok as I can add data to the xml file without a problem. The schema was created in visual studio 2005 visually as two tables.
I have only just started programming in c# and know very little about XML so I am hoping that the problem is something obvious that I am missing.
Thanks in anticipation!
if (File.Exists(fileName))
{
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
XmlTextReader myReader = new XmlTextReader(fs);
dsCamTypeData.Reset();
dsCamTypeData.ReadXml(myReader, System.Data.XmlReadMode.ReadSchema);
myReader.Close();
MessageBox.Show("File: " + fileName + ", was opened successfully");
I have just started programming in C# and hope to store relational db data in XML files.
When trying to load a file of xml data which adheres to the schema already loaded into my dataset, I get an exception that says "Data at the root level is invalid. Line 1, position 1876.". This occurs on the line dsCamTypeData.ReadXml(myReader, System.Data.XmlReadMode.ReadSchema);
from the code below. The schema appears to load in ok as I can add data to the xml file without a problem. The schema was created in visual studio 2005 visually as two tables.
I have only just started programming in c# and know very little about XML so I am hoping that the problem is something obvious that I am missing.
Thanks in anticipation!
if (File.Exists(fileName))
{
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
XmlTextReader myReader = new XmlTextReader(fs);
dsCamTypeData.Reset();
dsCamTypeData.ReadXml(myReader, System.Data.XmlReadMode.ReadSchema);
myReader.Close();
MessageBox.Show("File: " + fileName + ", was opened successfully");