private static void Verify (KnownTypeCollection knownTypes, Type type, string name, string Namespace, XmlReader reader)
{
QName graph_qname = new QName (reader.LocalName, reader.NamespaceURI);
if (graph_qname.Name == name && graph_qname.Namespace == Namespace)
return;
// <BClass .. i:type="EClass" >..</BClass>
// Expecting type EClass : allowed
// See test Serialize1b, and Serialize1c (for
// negative cases)
// Run through inheritance heirarchy ..
for (Type baseType = type; baseType != null; baseType = baseType.BaseType)
if (knownTypes.GetQName (baseType) == graph_qname)
return;
QName typeQName = knownTypes.GetQName (type);
throw new SerializationException (String.Format (
"Expecting element '{0}' from namespace '{1}'. Encountered 'Element' with name '{2}', namespace '{3}'",
typeQName.Name, typeQName.Namespace, graph_qname.Name, graph_qname.Namespace));
}