I have this method
public object ReturnXML()
{
var path = @"C:\path\Stuff.xml";
//Option A
var contents = XElement.Load(path);
//Option B
var contents = File.ReadAllText(path);
return contents;
}
Option A works just fine, except when XML file is structurally wrong. I want XML to be returned even when it is structurally wrong. Option B works, but that is string. Is it possible to return structurally incorrect XML as XML?