internal static void CreateBuiltinTypes()
{
XmlQualifiedName qname;
//Build anySimpleType
SchemaDatatypeMap sdm = s_xsdTypes[anySimpleTypeIndex]; //anySimpleType
qname = new XmlQualifiedName(sdm.Name, XmlReservedNs.NsXs);
DatatypeImplementation dt = FromTypeName(qname.Name);
s__anySimpleType = StartBuiltinType(qname, dt);
dt._parentSchemaType = s__anySimpleType;
s_builtinTypes.Add(qname, s__anySimpleType);
// Start construction of each built-in Xsd type
XmlSchemaSimpleType simpleType;
for (int i = 0; i < s_xsdTypes.Length; i++)
{ //Create all types
if (i == anySimpleTypeIndex)
{ //anySimpleType
continue;
}
sdm = s_xsdTypes[i];
qname = new XmlQualifiedName(sdm.Name, XmlReservedNs.NsXs);
dt = FromTypeName(qname.Name);
simpleType = StartBuiltinType(qname, dt);
dt._parentSchemaType = simpleType;
s_builtinTypes.Add(qname, simpleType);
if (dt._variety == XmlSchemaDatatypeVariety.Atomic)
{
s_enumToTypeCode[(int)dt.TypeCode] = simpleType;
}
}
// Finish construction of each built-in Xsd type
for (int i = 0; i < s_xsdTypes.Length; i++)
{
if (i == anySimpleTypeIndex)
{ //anySimpleType
continue;
}
sdm = s_xsdTypes[i];
XmlSchemaSimpleType derivedType = (XmlSchemaSimpleType)s_builtinTypes[new XmlQualifiedName(sdm.Name, XmlReservedNs.NsXs)];
XmlSchemaSimpleType baseType;
if (sdm.ParentIndex == anySimpleTypeIndex)
{
FinishBuiltinType(derivedType, s__anySimpleType);
}
else
{ //derived types whose index > 0
baseType = (XmlSchemaSimpleType)s_builtinTypes[new XmlQualifiedName(((SchemaDatatypeMap)(s_xsdTypes[sdm.ParentIndex])).Name, XmlReservedNs.NsXs)];
FinishBuiltinType(derivedType, baseType);
}
}
// Construct xdt:anyAtomicType type (derived from xs:anySimpleType)
qname = new XmlQualifiedName("anyAtomicType", XmlReservedNs.NsXQueryDataType);
s__anyAtomicType = StartBuiltinType(qname, s_anyAtomicType);
s_anyAtomicType._parentSchemaType = s__anyAtomicType;
FinishBuiltinType(s__anyAtomicType, s__anySimpleType);
s_builtinTypes.Add(qname, s__anyAtomicType);
s_enumToTypeCode[(int)XmlTypeCode.AnyAtomicType] = s__anyAtomicType;
// Construct xdt:untypedAtomic type (derived from xdt:anyAtomicType)
qname = new XmlQualifiedName("untypedAtomic", XmlReservedNs.NsXQueryDataType);
s__untypedAtomicType = StartBuiltinType(qname, s_untypedAtomicType);
s_untypedAtomicType._parentSchemaType = s__untypedAtomicType;
FinishBuiltinType(s__untypedAtomicType, s__anyAtomicType);
s_builtinTypes.Add(qname, s__untypedAtomicType);
s_enumToTypeCode[(int)XmlTypeCode.UntypedAtomic] = s__untypedAtomicType;
// Construct xdt:yearMonthDuration type (derived from xs:duration)
qname = new XmlQualifiedName("yearMonthDuration", XmlReservedNs.NsXQueryDataType);
s_yearMonthDurationType = StartBuiltinType(qname, s_yearMonthDuration);
s_yearMonthDuration._parentSchemaType = s_yearMonthDurationType;
FinishBuiltinType(s_yearMonthDurationType, s_enumToTypeCode[(int)XmlTypeCode.Duration]);
s_builtinTypes.Add(qname, s_yearMonthDurationType);
s_enumToTypeCode[(int)XmlTypeCode.YearMonthDuration] = s_yearMonthDurationType;
// Construct xdt:dayTimeDuration type (derived from xs:duration)
qname = new XmlQualifiedName("dayTimeDuration", XmlReservedNs.NsXQueryDataType);
s_dayTimeDurationType = StartBuiltinType(qname, s_dayTimeDuration);
s_dayTimeDuration._parentSchemaType = s_dayTimeDurationType;
FinishBuiltinType(s_dayTimeDurationType, s_enumToTypeCode[(int)XmlTypeCode.Duration]);
s_builtinTypes.Add(qname, s_dayTimeDurationType);
s_enumToTypeCode[(int)XmlTypeCode.DayTimeDuration] = s_dayTimeDurationType;
}