static ItemType() {
#if DEBUG
Array arrEnum = Enum.GetValues(typeof(XmlTypeCode));
Debug.Assert((XmlTypeCode) arrEnum.GetValue(arrEnum.Length - 1) == XmlTypeCode.DayTimeDuration,
"DayTimeDuration is no longer the last item in XmlTypeCode. This code expects it to be.");
#endif
int typeCount = (int) XmlTypeCode.DayTimeDuration + 1;
BuiltInItemTypes = new XmlQueryType[typeCount];
BuiltInItemTypesStrict = new XmlQueryType[typeCount];
for (int i = 0; i < typeCount; i++) {
XmlTypeCode typeCode = (XmlTypeCode)i;
switch ((XmlTypeCode) i) {
case XmlTypeCode.None:
BuiltInItemTypes[i] = ChoiceType.None;
BuiltInItemTypesStrict[i] = ChoiceType.None;
continue;
case XmlTypeCode.Item:
case XmlTypeCode.Node:
BuiltInItemTypes[i] = new ItemType(typeCode, XmlQualifiedNameTest.Wildcard, XmlSchemaComplexType.AnyType, false, false, false);
BuiltInItemTypesStrict[i] = BuiltInItemTypes[i];
break;
case XmlTypeCode.Document:
case XmlTypeCode.Element:
case XmlTypeCode.Namespace:
case XmlTypeCode.ProcessingInstruction:
case XmlTypeCode.Comment:
case XmlTypeCode.Text:
BuiltInItemTypes[i] = new ItemType(typeCode, XmlQualifiedNameTest.Wildcard, XmlSchemaComplexType.AnyType, false, false, true);
BuiltInItemTypesStrict[i] = BuiltInItemTypes[i];
break;
case XmlTypeCode.Attribute:
BuiltInItemTypes[i] = new ItemType(typeCode, XmlQualifiedNameTest.Wildcard, DatatypeImplementation.AnySimpleType, false, false, true);
BuiltInItemTypesStrict[i] = BuiltInItemTypes[i];
break;
case XmlTypeCode.AnyAtomicType:
BuiltInItemTypes[i] = new ItemType(typeCode, XmlQualifiedNameTest.Wildcard, DatatypeImplementation.AnyAtomicType, false, false, true);
BuiltInItemTypesStrict[i] = BuiltInItemTypes[i];
break;
case XmlTypeCode.UntypedAtomic:
// xdt:untypedAtomic is sealed, and therefore always strict
BuiltInItemTypes[i] = new ItemType(typeCode, XmlQualifiedNameTest.Wildcard, DatatypeImplementation.UntypedAtomicType, false, true, true);
BuiltInItemTypesStrict[i] = BuiltInItemTypes[i];
break;
default:
XmlSchemaType builtInType = XmlSchemaType.GetBuiltInSimpleType(typeCode);
BuiltInItemTypes[i] = new ItemType(typeCode, XmlQualifiedNameTest.Wildcard, builtInType, false, false, true);
BuiltInItemTypesStrict[i] = new ItemType(typeCode, XmlQualifiedNameTest.Wildcard, builtInType, false, true, true);
break;
}
}
UntypedDocument = new ItemType(XmlTypeCode.Document, XmlQualifiedNameTest.Wildcard, XmlSchemaComplexType.UntypedAnyType, false, false, true);
UntypedElement = new ItemType(XmlTypeCode.Element, XmlQualifiedNameTest.Wildcard, XmlSchemaComplexType.UntypedAnyType, false, false, true);
UntypedAttribute = new ItemType(XmlTypeCode.Attribute, XmlQualifiedNameTest.Wildcard, DatatypeImplementation.UntypedAtomicType, false, false, true);
NodeNotRtf = new ItemType(XmlTypeCode.Node, XmlQualifiedNameTest.Wildcard, XmlSchemaComplexType.AnyType, false, false, true);
NodeDod = new ItemType(XmlTypeCode.Node, XmlQualifiedNameTest.Wildcard, XmlSchemaComplexType.AnyType, false, false, true);
}