I am having real trouble trying to deserialize some XML and was hoping someone can offer some assistance. I have read a lot of similar posts but I am unable to resolve this.
I found doing the following fixed this for me
if (elem.Attribute(XNamespace.Xmlns + "xsi") == null) {
elem.Add(new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"));
}
if (elem.Attribute(XNamespace.Xmlns + "xsd") == null) {
elem.Add(new XAttribute(XNamespace.Xmlns + "xsd", "http://www.w3.org/2001/XMLSchema"));
}