void CheckForDuplicateType(string newTypeName, string newNamespace){
XmlSchema schema = schemas[newNamespace];
if (schema != null){
foreach (XmlSchemaObject o in schema.Items) {
XmlSchemaType type = o as XmlSchemaType;
if ( type != null && type.Name == newTypeName)
throw new InvalidOperationException(Res.GetString(Res.XmlDuplicateTypeName, newTypeName, newNamespace));
}
}
}