I have a code snippet :
XmlDocument doc = new XmlDocument(); try { doc.LoadXml(xmlPath); } catch (Exception ex) { string exMessage = ex.Message; }
does xmlPath contains the whole xml or a path to a file that contains it? The LoadXml method expects the actual XML, not a path to a file. If you want to load the xml using a path, using the Load method.