This operation would create an incorrectly structured document

Patchie

New Member
I am new to \[code\]XML\[/code\] i tried some thing like as follows but getting an exception can some one help me\[code\]string strPath = Server.MapPath("sample.xml"); XDocument doc; if (!System.IO.File.Exists(strPath)) { doc = new XDocument( new XElement("Employees", new XElement("Employee", new XAttribute("id", 1), new XElement("EmpName", "XYZ"))),new XElement("Departments", new XElement("Department", new XAttribute("id", 1), new XElement("DeptName", "CS")))); doc.Save(strPath); }\[/code\]Exception \[code\]This operation would create an incorrectly structured document\[/code\]
 
Back
Top