The data source I'm using always sends over data with the same parent class (Models in the xml), with xsi:type to determine the actual type of the class. This has been working fine until they started adding a namespace to the xsi:type. Now it won't deserialize no matter what I try.
Here's the XML:
<ModelResource xmlns:ot="http://www.example.com/otSpace">
<Models xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xsi:type="ot:myChildClass">
Stuff here
</Models>
</ModelResource>
The root node
[XmlRoot("ModelResource")]
public class XmlRoot
{
[XmlElement("Models")]
public List<BaseObject> Bases { get; set; }
}
The parent class
[XmlInclude(typeof(MyChildClass))]
public abstract class BaseObject
{
}
The child class
[XmlType(TypeName = "myChildClass", Namespace = "http://www.example.com/otSpace")]
public class MyChildClass : BaseObject
{
}
When I deserialize this XML, I wind up with the error:
{"The specified type was not recognized: name='myChildClass', namespace='http://www.example.com/otSpace', at ."}
Thanks for your help.