GetSimpleTypeFromTypeCode() static private méthode

static private GetSimpleTypeFromTypeCode ( XmlTypeCode typeCode ) : XmlSchemaSimpleType
typeCode XmlTypeCode
Résultat XmlSchemaSimpleType
Exemple #1
0
 public FacetsCompiler(DatatypeImplementation baseDatatype, RestrictionFacets restriction)
 {
     this.firstPattern          = true;
     this.regStr                = null;
     this.pattern_facet         = null;
     this.datatype              = baseDatatype;
     this.derivedRestriction    = restriction;
     this.baseFlags             = (this.datatype.Restriction != null) ? this.datatype.Restriction.Flags : ((RestrictionFlags)0);
     this.baseFixedFlags        = (this.datatype.Restriction != null) ? this.datatype.Restriction.FixedFlags : ((RestrictionFlags)0);
     this.validRestrictionFlags = this.datatype.ValidRestrictionFlags;
     this.nonNegativeInt        = DatatypeImplementation.GetSimpleTypeFromTypeCode(XmlTypeCode.NonNegativeInteger).Datatype;
     this.builtInEnum           = (!(this.datatype is Datatype_union) && !(this.datatype is Datatype_List)) ? this.datatype.TypeCode : XmlTypeCode.None;
     this.builtInType           = (this.builtInEnum > XmlTypeCode.None) ? DatatypeImplementation.GetSimpleTypeFromTypeCode(this.builtInEnum).Datatype : this.datatype;
 }
Exemple #2
0
            internal void CompileTotalDigitsFacet(XmlSchemaFacet facet)
            {
                this.CheckProhibitedFlag(facet, RestrictionFlags.TotalDigits, "Sch_TotalDigitsFacetProhibited");
                this.CheckDupFlag(facet, RestrictionFlags.TotalDigits, "Sch_DupTotalDigitsFacet");
                XmlSchemaDatatype datatype = DatatypeImplementation.GetSimpleTypeFromTypeCode(XmlTypeCode.PositiveInteger).Datatype;

                this.derivedRestriction.TotalDigits = XmlBaseConverter.DecimalToInt32((decimal)this.ParseFacetValue(datatype, facet, "Sch_TotalDigitsFacetInvalid", null, null));
                if (((this.baseFixedFlags & RestrictionFlags.TotalDigits) != 0) && !this.datatype.IsEqual(this.datatype.Restriction.TotalDigits, this.derivedRestriction.TotalDigits))
                {
                    throw new XmlSchemaException("Sch_FacetBaseFixed", facet);
                }
                if (((this.baseFlags & RestrictionFlags.TotalDigits) != 0) && (this.derivedRestriction.TotalDigits > this.datatype.Restriction.TotalDigits))
                {
                    throw new XmlSchemaException("Sch_TotalDigitsMismatch", string.Empty);
                }
                this.SetFlag(facet, RestrictionFlags.TotalDigits);
            }
        internal override XmlValueConverter CreateValueConverter(XmlSchemaType schemaType)
        {
            XmlSchemaType        baseItemType = null;
            XmlSchemaSimpleType  baseXmlSchemaType;
            XmlSchemaComplexType type3 = schemaType as XmlSchemaComplexType;

            if (type3 != null)
            {
                do
                {
                    baseXmlSchemaType = type3.BaseXmlSchemaType as XmlSchemaSimpleType;
                    if (baseXmlSchemaType != null)
                    {
                        break;
                    }
                    type3 = type3.BaseXmlSchemaType as XmlSchemaComplexType;
                    if (type3 == null)
                    {
                        break;
                    }
                }while (type3 != XmlSchemaComplexType.AnyType);
            }
            else
            {
                baseXmlSchemaType = schemaType as XmlSchemaSimpleType;
            }
            if (baseXmlSchemaType != null)
            {
                do
                {
                    XmlSchemaSimpleTypeList content = baseXmlSchemaType.Content as XmlSchemaSimpleTypeList;
                    if (content != null)
                    {
                        baseItemType = content.BaseItemType;
                        break;
                    }
                    baseXmlSchemaType = baseXmlSchemaType.BaseXmlSchemaType as XmlSchemaSimpleType;
                }while ((baseXmlSchemaType != null) && (baseXmlSchemaType != DatatypeImplementation.AnySimpleType));
            }
            if (baseItemType == null)
            {
                baseItemType = DatatypeImplementation.GetSimpleTypeFromTypeCode(schemaType.Datatype.TypeCode);
            }
            return(XmlListConverter.Create(baseItemType.ValueConverter));
        }
Exemple #4
0
 /// <include file='doc\XmlSchemaType.uex' path='docs/doc[@for="XmlSchemaType.GetXsdSimpleType"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public static XmlSchemaSimpleType GetBuiltInSimpleType(XmlTypeCode typeCode)
 {
     return(DatatypeImplementation.GetSimpleTypeFromTypeCode(typeCode));
 }