G
Guest
Hi,
I have a button that, when clicked, saves all the info entered. It worked
fine until suddenly it didn't, and I have no idea why. I get the error
An unhandled exception of type 'System.Xml.XmlException' occurred in
system.xml.dll
Additional information: System error.
I found that this sometimes happens when there's some unrecognized
character, so I even started with a new xml file, but it still won't work.
It yells at me when I try to say XmlNode Catalog = xml.DocumentElement. Any
ideas on why this would suddenly stop working?
Thanks,
Mel
Here's some code:
string cat = @"C:\Catalog4.xml";
XmlDocument xml = new XmlDocument();
xml.Load(cat);
XmlNode Catalog = xml.DocumentElement; (green error arrow here)
XmlElement file = xml.CreateElement("File");
file.InnerText = number.ToString();
Catalog.AppendChild(file);
XmlElement eCust = xml.CreateElement("Cust");
eCust.InnerText = cust;
file.AppendChild(eCust);
xml.Save(cat);
I have a button that, when clicked, saves all the info entered. It worked
fine until suddenly it didn't, and I have no idea why. I get the error
An unhandled exception of type 'System.Xml.XmlException' occurred in
system.xml.dll
Additional information: System error.
I found that this sometimes happens when there's some unrecognized
character, so I even started with a new xml file, but it still won't work.
It yells at me when I try to say XmlNode Catalog = xml.DocumentElement. Any
ideas on why this would suddenly stop working?
Thanks,
Mel
Here's some code:
string cat = @"C:\Catalog4.xml";
XmlDocument xml = new XmlDocument();
xml.Load(cat);
XmlNode Catalog = xml.DocumentElement; (green error arrow here)
XmlElement file = xml.CreateElement("File");
file.InnerText = number.ToString();
Catalog.AppendChild(file);
XmlElement eCust = xml.CreateElement("Cust");
eCust.InnerText = cust;
file.AppendChild(eCust);
xml.Save(cat);