Allow .NET WebApi to disregard DOCTYPE declaration
问题 I am trying to deserialize XML to an object through a WebApi Method. I have the following class: [XmlRoot(IsNullable = false)] public class MyObject { [XmlElement("Name")] public string Name {get;set;} } And the following Method in a WebApi Controller. [HttpPost] public HttpResponseMessage UpdateMyObject(MyObject model) { //do something with the model } I am using the XmlSerializer by setting the following in the startup of the Web Project: config.Formatters.XmlFormatter.UseXmlSerializer =