public static bool ValidateComplexType( XmlSchemaComplexType complexType, object testSubject,
SchemaValidationResult parentValidationResult)
{
bool isValid = true;
var result = new SchemaValidationResult( testSubject.GetType().Name, testSubject );
var xmlSchemaObjects = new Dictionary<string, XmlSchemaObject>();
XmlSchemaContentModel contentModel = complexType.ContentModel;
ExtractSequenceItems( complexType, xmlSchemaObjects );
parentValidationResult.AddResult( result );
if (contentModel != null)
ExtractContentItems( contentModel, xmlSchemaObjects );
ExtractAttributes( complexType, xmlSchemaObjects );
PropertyInfo[] props = testSubject.GetType().GetProperties();
foreach (PropertyInfo propertyInfo in props)
{
try
{
isValid &= ProcessPropertyInfo( testSubject, result, propertyInfo, xmlSchemaObjects, isValid );
}
catch (Exception e)
{
int i = 0;
}
}
return result.HasErrors();
}