System.Xml.Xsl.XmlQueryTypeFactory.Type C# (CSharp) Method

Type() public static method

Create an XmlQueryType from an Xsd simple type (where variety can be Atomic, List, or Union).
public static Type ( XmlSchemaSimpleType schemaType, bool isStrict ) : XmlQueryType
schemaType System.Xml.Schema.XmlSchemaSimpleType the simple Xsd schema type of the atomic value
isStrict bool true if the dynamic type is guaranteed to match the static type exactly
return XmlQueryType
        public static XmlQueryType Type(XmlSchemaSimpleType schemaType, bool isStrict) {
            if (schemaType.Datatype.Variety == XmlSchemaDatatypeVariety.Atomic) {
                if (schemaType == DatatypeImplementation.AnySimpleType)
                    return AnyAtomicTypeS;

                return ItemType.Create(schemaType, isStrict);
            }

            // Skip restrictions. It is safe to do that because this is a list or union, so it's not a build in type
            while (schemaType.DerivedBy == XmlSchemaDerivationMethod.Restriction)
                schemaType = (XmlSchemaSimpleType) schemaType.BaseXmlSchemaType;

            // Convert Xsd list
            if (schemaType.DerivedBy == XmlSchemaDerivationMethod.List)
                return PrimeProduct(Type(((XmlSchemaSimpleTypeList) schemaType.Content).BaseItemType, isStrict), XmlQueryCardinality.ZeroOrMore);

            // Convert Xsd union
            Debug.Assert(schemaType.DerivedBy == XmlSchemaDerivationMethod.Union);
            XmlSchemaSimpleType[] baseMemberTypes = ((XmlSchemaSimpleTypeUnion) schemaType.Content).BaseMemberTypes;
            XmlQueryType[] queryMemberTypes = new XmlQueryType[baseMemberTypes.Length];

            for (int i = 0; i < baseMemberTypes.Length; i++)
                queryMemberTypes[i] = Type(baseMemberTypes[i], isStrict);

            return Choice(queryMemberTypes);
        }

Same methods

XmlQueryTypeFactory::Type ( XPathNodeType kind, XmlQualifiedNameTest nameTest, XmlSchemaType contentType, bool isNillable ) : XmlQueryType
XmlQueryTypeFactory::Type ( XmlTypeCode code, XmlQualifiedNameTest nameTest, XmlSchemaType contentType, bool isNillable ) : XmlQueryType
XmlQueryTypeFactory::Type ( XmlTypeCode code, XmlQualifiedNameTest nameTest, XmlSchemaType contentType, bool isNillable, XmlQueryCardinality card ) : XmlQueryType
XmlQueryTypeFactory::Type ( XmlTypeCode code, XmlQueryCardinality card ) : XmlQueryType
XmlQueryTypeFactory::Type ( XmlTypeCode code, bool isStrict ) : XmlQueryType