This:
doc.LoadXml(HttpContext.Current.Server.MapPath("officeList.xml"));
should be:
doc.Load(HttpContext.Current.Server.MapPath("officeList.xml"));
LoadXml()
is for loading an XML string, not a file name.
More Related Contents:
- Generate C# class from XML
- Read XML Attribute using XmlDocument
- How to serialize/deserialize to `Dictionary` from custom XML not using XElement?
- How would you compare two XML Documents?
- Why does C# XmlDocument.LoadXml(string) fail when an XML header is included?
- Format a date in XML via XSLT
- Escape invalid XML characters in C#
- Query an XDocument for elements by name at any depth
- How to deal with XML in C#
- How to read attribute value from XmlNode in C#?
- how to use XPath with XDocument?
- How to decode string to XML string in C#
- get line number for XElement here
- XmlSerializer – There was an error reflecting type
- Entity Framework with XML Files [closed]
- How to serialize/deserialize simple classes to XML and back
- Fastest way to add new node to end of an xml?
- XML Parsing – Read a Simple XML File and Retrieve Values
- How to write a comment to an XML file when using the XmlSerializer?
- Error Deserializing Xml to Object – xmlns=” was not expected
- XmlTextReader vs. XDocument
- Deserializing XML File with multiple element attributes – attributes are not deserializing
- Removing nodes from an XmlDocument
- Generating XML file using XSD file
- Use the XmlInclude or SoapInclude attribute to specify types that are not known statically
- XmlSerializer Performance Issue when Specifying XmlRootAttribute
- Finding element in XDocument?
- How can I remove empty xmlns attribute from node created by XElement
- How do I return XML from a Stored Procedure?
- Reading XML with an “&” into C# XMLDocument Object