internal override int Validate(ValidationEventHandler h, XmlSchema schema) { if (IsValidated(schema.ValidationId)) { return(errorCount); } // ListItemType XmlSchemaSimpleType type = itemType; if (type == null) { type = schema.FindSchemaType(itemTypeName) as XmlSchemaSimpleType; } if (type != null) { errorCount += type.Validate(h, schema); validatedListItemType = type; } else if (itemTypeName == XmlSchemaComplexType.AnyTypeName) { validatedListItemType = XmlSchemaSimpleType.AnySimpleType; } else if (XmlSchemaUtil.IsBuiltInDatatypeName(itemTypeName)) { validatedListItemType = XmlSchemaDatatype.FromName(itemTypeName); if (validatedListItemType == null) { error(h, "Invalid schema type name was specified: " + itemTypeName); } } // otherwise, it might be missing sub components. else if (!schema.IsNamespaceAbsent(itemTypeName.Namespace)) { error(h, "Referenced base list item schema type " + itemTypeName + " was not found."); } #if NET_2_0 XmlSchemaSimpleType st = validatedListItemType as XmlSchemaSimpleType; if (st == null && validatedListItemType != null) { st = XmlSchemaType.GetBuiltInSimpleType(((XmlSchemaDatatype)validatedListItemType).TypeCode); } validatedListItemSchemaType = st; #endif ValidationId = schema.ValidationId; return(errorCount); }
internal override int Validate(ValidationEventHandler h, XmlSchema schema) { if (IsValidated(schema.ValidationId)) { return(errorCount); } if (baseType != null) { baseType.Validate(h, schema); actualBaseSchemaType = baseType; } else if (baseTypeName != XmlQualifiedName.Empty) { XmlSchemaType st = schema.FindSchemaType(baseTypeName); if (st != null) { st.Validate(h, schema); actualBaseSchemaType = st; } else if (baseTypeName == XmlSchemaComplexType.AnyTypeName) { actualBaseSchemaType = XmlSchemaComplexType.AnyType; } else if (XmlSchemaUtil.IsBuiltInDatatypeName(baseTypeName)) { actualBaseSchemaType = XmlSchemaDatatype.FromName(baseTypeName); if (actualBaseSchemaType == null) { error(h, "Invalid schema datatype name is specified."); } } // otherwise, it might be missing sub components. else if (!schema.IsNamespaceAbsent(baseTypeName.Namespace)) { error(h, "Referenced base schema type " + baseTypeName + " was not found in the corresponding schema."); } } ValidationId = schema.ValidationId; return(errorCount); }