internal static void FinishBuiltinType(XmlSchemaSimpleType derivedType, XmlSchemaSimpleType baseType)
{
Debug.Assert(derivedType != null && baseType != null);
// Create link from the derived type to the base type
derivedType.SetBaseSchemaType(baseType);
derivedType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
if (derivedType.Datatype.Variety == XmlSchemaDatatypeVariety.Atomic)
{ //Content is restriction
XmlSchemaSimpleTypeRestriction restContent = new XmlSchemaSimpleTypeRestriction();
restContent.BaseTypeName = baseType.QualifiedName;
derivedType.Content = restContent;
}
// Create link from a list type to its member type
if (derivedType.Datatype.Variety == XmlSchemaDatatypeVariety.List)
{
XmlSchemaSimpleTypeList listContent = new XmlSchemaSimpleTypeList();
derivedType.SetDerivedBy(XmlSchemaDerivationMethod.List);
switch (derivedType.Datatype.TypeCode)
{
case XmlTypeCode.NmToken:
listContent.ItemType = listContent.BaseItemType = s_enumToTypeCode[(int)XmlTypeCode.NmToken];
break;
case XmlTypeCode.Entity:
listContent.ItemType = listContent.BaseItemType = s_enumToTypeCode[(int)XmlTypeCode.Entity];
break;
case XmlTypeCode.Idref:
listContent.ItemType = listContent.BaseItemType = s_enumToTypeCode[(int)XmlTypeCode.Idref];
break;
}
derivedType.Content = listContent;
}
}