I\'m loading an XML document in my C# application with the following:
XDocument xd1 = new XDocument(); xd1 = XDocument.Load(myfile);
but be
It's probably just worth catching the specific exception if you want to show a message to the user:
try { XDocument xd1 = new XDocument(); xd1 = XDocument.Load(myfile); } catch (XmlException exception) { ShowMessage("Your XML was probably bad..."); }