当前位置: 首页>>代码示例>>C#>>正文


C# XmlTypeCode类代码示例

本文整理汇总了C#中XmlTypeCode的典型用法代码示例。如果您正苦于以下问题:C# XmlTypeCode类的具体用法?C# XmlTypeCode怎么用?C# XmlTypeCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlTypeCode类属于命名空间,在下文中一共展示了XmlTypeCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateGetBuiltInSimpleType

 internal static CodeExpression CreateGetBuiltInSimpleType(XmlTypeCode typeCode)  {
     return CodeDomHelper.CreateMethodCall(
             new CodeTypeReferenceExpression("XmlSchemaType"),
             Constants.GetBuiltInSimpleType,
             CodeDomHelper.CreateFieldReference(Constants.XmlTypeCode, typeCode.ToString()));
             
 }
开发者ID:o2platform,项目名称:O2.Platform.Projects,代码行数:7,代码来源:SimpleTypeCodeDomHelper.cs

示例2: IsDataTypeAttributeAllowed

 private static bool? IsDataTypeAttributeAllowed(XmlTypeCode typeCode, GeneratorConfiguration configuration)
 {
     bool? result;
     switch (typeCode)
     {
         case XmlTypeCode.AnyAtomicType:
             // union
             result = false;
             break;
         case XmlTypeCode.Integer:
         case XmlTypeCode.NegativeInteger:
         case XmlTypeCode.NonNegativeInteger:
         case XmlTypeCode.NonPositiveInteger:
         case XmlTypeCode.PositiveInteger:
             if (configuration.IntegerDataType != null && configuration.IntegerDataType != typeof(string))
                 result = false;
             else
                 result = null;
             break;
         case XmlTypeCode.Base64Binary:
         case XmlTypeCode.HexBinary:
             result = true;
             break;
         default:
             result = null;
             break;
     }
     return result;
 }
开发者ID:imileusnic,项目名称:XmlSchemaClassGenerator,代码行数:29,代码来源:CodeUtilities.cs

示例3: Init

		private void Init (DateTime value, XmlSchemaType xmlType)
		{
			if (xmlType == null)
				throw new ArgumentNullException ("xmlType");
			xmlTypeCode = XmlTypeCode.DateTime;
			this.dateTimeValue = value;
			schemaType = xmlType;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:8,代码来源:XmlAtomicValue.cs

示例4: GetBuiltInComplexType

 public static XmlSchemaComplexType GetBuiltInComplexType(XmlTypeCode typeCode)
 {
     if (typeCode == XmlTypeCode.Item)
     {
         return XmlSchemaComplexType.AnyType;
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XmlSchemaType.cs

示例5: Init

		private void Init (byte [] value, XmlSchemaType xmlType)
		{
			if (xmlType == null)
				throw new ArgumentNullException ("xmlType");
			xmlTypeCode = XmlTypeCode.Base64Binary;
			this.bytesValue = value;
			schemaType = xmlType;
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:XmlAtomicValue.cs

示例6: GetFacetsChecker

        internal static FacetsChecker GetFacetsChecker(XmlTypeCode typeCode)
        {
            if (FacetsCheckerMapping == null)
            {
                InitMapping();
            }

            return FacetsCheckerMapping[typeCode];
            
        }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:10,代码来源:FacetChecker.cs

示例7: FacetsCompiler

 public FacetsCompiler(DatatypeImplementation baseDatatype, RestrictionFacets restriction) {
     firstPattern = true;
     regStr = null;
     pattern_facet = null;
     datatype = baseDatatype;
     derivedRestriction = restriction;
     baseFlags = datatype.Restriction != null ? datatype.Restriction.Flags : 0;
     baseFixedFlags = datatype.Restriction != null ? datatype.Restriction.FixedFlags : 0;
     validRestrictionFlags = datatype.ValidRestrictionFlags;
     nonNegativeInt = DatatypeImplementation.GetSimpleTypeFromTypeCode(XmlTypeCode.NonNegativeInteger).Datatype;
     builtInEnum = !(datatype is Datatype_union || datatype is Datatype_List) ? datatype.TypeCode : 0;
     builtInType = (int)builtInEnum > 0 ? DatatypeImplementation.GetSimpleTypeFromTypeCode(builtInEnum).Datatype : datatype;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:13,代码来源:FacetChecker.cs

示例8: FacetsCompiler

 public FacetsCompiler(DatatypeImplementation baseDatatype, RestrictionFacets restriction)
 {
     _firstPattern = true;
     _regStr = null;
     _pattern_facet = null;
     _datatype = baseDatatype;
     _derivedRestriction = restriction;
     _baseFlags = _datatype.Restriction != null ? _datatype.Restriction.Flags : 0;
     _baseFixedFlags = _datatype.Restriction != null ? _datatype.Restriction.FixedFlags : 0;
     _validRestrictionFlags = _datatype.ValidRestrictionFlags;
     _nonNegativeInt = DatatypeImplementation.GetSimpleTypeFromTypeCode(XmlTypeCode.NonNegativeInteger).Datatype;
     _builtInEnum = !(_datatype is Datatype_union || _datatype is Datatype_List) ? _datatype.TypeCode : 0;
     _builtInType = (int)_builtInEnum > 0 ? DatatypeImplementation.GetSimpleTypeFromTypeCode(_builtInEnum).Datatype : _datatype;
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:14,代码来源:FacetChecker.cs

示例9: CheckBuiltInFacets

        private Exception CheckBuiltInFacets(string s, XmlTypeCode typeCode, bool verifyUri)
        {
            Exception exception = null;
            switch (typeCode)
            {
                case XmlTypeCode.AnyUri:
                    if (verifyUri)
                    {
                        Uri uri;
                        exception = XmlConvert.TryToUri(s, out uri);
                    }
                    return exception;

                case XmlTypeCode.QName:
                case XmlTypeCode.Notation:
                    return exception;

                case XmlTypeCode.NormalizedString:
                    return XmlConvert.TryVerifyNormalizedString(s);

                case XmlTypeCode.Token:
                    return XmlConvert.TryVerifyTOKEN(s);

                case XmlTypeCode.Language:
                    if ((s != null) && (s.Length != 0))
                    {
                        if (!LanguagePattern.IsMatch(s))
                        {
                            return new XmlSchemaException("Sch_InvalidLanguageId", string.Empty);
                        }
                        return exception;
                    }
                    return new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty);

                case XmlTypeCode.NmToken:
                    return XmlConvert.TryVerifyNMTOKEN(s);

                case XmlTypeCode.Name:
                    return XmlConvert.TryVerifyName(s);

                case XmlTypeCode.NCName:
                case XmlTypeCode.Id:
                case XmlTypeCode.Idref:
                case XmlTypeCode.Entity:
                    return XmlConvert.TryVerifyNCName(s);
            }
            return exception;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:48,代码来源:StringFacetsChecker.cs

示例10: GetFallbackType

		public static XmlTypeCode GetFallbackType (XmlTypeCode type)
		{
			switch (type) {
			case XmlTypeCode.AnyAtomicType:
				return XmlTypeCode.Item;
			case XmlTypeCode.UntypedAtomic:
				return XmlTypeCode.String;
			case XmlTypeCode.Notation:
				return XmlTypeCode.QName;
			case XmlTypeCode.NormalizedString:
			case XmlTypeCode.Token:
			case XmlTypeCode.Language:
			case XmlTypeCode.NmToken:
			case XmlTypeCode.Name:
			case XmlTypeCode.NCName:
			case XmlTypeCode.Id:
			case XmlTypeCode.Idref:
			case XmlTypeCode.Entity:
				return XmlTypeCode.String;
			case XmlTypeCode.NonPositiveInteger:
				return XmlTypeCode.Decimal;
			case XmlTypeCode.NegativeInteger:
				return XmlTypeCode.NonPositiveInteger;
			case XmlTypeCode.Long:
				return XmlTypeCode.Integer;
			case XmlTypeCode.Short:
				return XmlTypeCode.Int;
			case XmlTypeCode.Byte:
				return XmlTypeCode.Int;
			case XmlTypeCode.NonNegativeInteger:
				return XmlTypeCode.Decimal;
			case XmlTypeCode.UnsignedLong:
				return XmlTypeCode.NonNegativeInteger;
			case XmlTypeCode.UnsignedInt:
				return XmlTypeCode.Integer;
			case XmlTypeCode.UnsignedShort:
				return XmlTypeCode.Int;
			case XmlTypeCode.UnsignedByte:
				return XmlTypeCode.UnsignedShort;
			case XmlTypeCode.PositiveInteger:
				return XmlTypeCode.NonNegativeInteger;
			default:
				return XmlTypeCode.None;
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:45,代码来源:XQueryConvert.cs

示例11: GetEffectiveType

 private static Type GetEffectiveType(XmlTypeCode typeCode, XmlSchemaDatatypeVariety variety, GeneratorConfiguration configuration)
 {
     Type result;
     switch (typeCode)
     {
         case XmlTypeCode.AnyAtomicType:
             // union
             result = typeof(string);
             break;
         case XmlTypeCode.AnyUri:
         case XmlTypeCode.Duration:
         case XmlTypeCode.GDay:
         case XmlTypeCode.GMonth:
         case XmlTypeCode.GMonthDay:
         case XmlTypeCode.GYear:
         case XmlTypeCode.GYearMonth:
         case XmlTypeCode.Time:
             result = variety == XmlSchemaDatatypeVariety.List ? typeof(string[]) : typeof(string);
             break;
         case XmlTypeCode.Integer:
         case XmlTypeCode.NegativeInteger:
         case XmlTypeCode.NonNegativeInteger:
         case XmlTypeCode.NonPositiveInteger:
         case XmlTypeCode.PositiveInteger:
             if (configuration.IntegerDataType == null || configuration.IntegerDataType == typeof(string))
                 result = typeof(string);
             else
             {
                 result = configuration.IntegerDataType;
             }
             break;
         default:
             result = null;
             break;
     }
     return result;
 }
开发者ID:imileusnic,项目名称:XmlSchemaClassGenerator,代码行数:37,代码来源:CodeUtilities.cs

示例12: CheckBuiltInFacets

        private Exception CheckBuiltInFacets(string s, XmlTypeCode typeCode, bool verifyUri) {
            Exception exception = null;

            switch (typeCode) {

                case XmlTypeCode.AnyUri:
                    if (verifyUri) {
                        Uri uri;
                        exception = XmlConvert.TryToUri(s, out uri);
                    }
                    break;

                case XmlTypeCode.NormalizedString:
                    exception = XmlConvert.TryVerifyNormalizedString(s);
                    break;

                case XmlTypeCode.Token:
                    exception = XmlConvert.TryVerifyTOKEN(s);
                    break;

                case XmlTypeCode.Language:
                    if (s == null || s.Length == 0) {
                        return new XmlSchemaException(Res.Sch_EmptyAttributeValue, string.Empty);
                    }
                    if (!LanguagePattern.IsMatch(s)) {
                        return new XmlSchemaException(Res.Sch_InvalidLanguageId, string.Empty);
                    }
                    break;

                case XmlTypeCode.NmToken:
                    exception = XmlConvert.TryVerifyNMTOKEN(s);
                    break;

                case XmlTypeCode.Name:
                    exception = XmlConvert.TryVerifyName(s);
                    break;

                case XmlTypeCode.NCName:
                case XmlTypeCode.Id:
                case XmlTypeCode.Idref:
                case XmlTypeCode.Entity:
                    exception = XmlConvert.TryVerifyNCName(s);
                    break;
                default:
                    break;
            }
            return exception;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:48,代码来源:FacetChecker.cs

示例13: ConvertToType

 public QilNode ConvertToType(XmlTypeCode requiredType, QilNode n) {
     switch (requiredType) {
     case XmlTypeCode.String     : return ConvertToString(n);
     case XmlTypeCode.Double     : return ConvertToNumber(n);
     case XmlTypeCode.Boolean    : return ConvertToBoolean(n);
     case XmlTypeCode.Node       : return EnsureNodeSet(n);
     case XmlTypeCode.Item       : return n;
     default                     : Debug.Fail("Unexpected XmlTypeCode: " + requiredType); return null;
     }
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:10,代码来源:xpathqilfactory.cs

示例14: GetPrimitiveTypeCode

 internal static XmlTypeCode GetPrimitiveTypeCode(XmlTypeCode typeCode) {
     XmlSchemaSimpleType currentType = enumToTypeCode[(int)typeCode];
     while (currentType.BaseXmlSchemaType != DatatypeImplementation.AnySimpleType) {
         currentType = currentType.BaseXmlSchemaType as XmlSchemaSimpleType;
         Debug.Assert(currentType != null);
     }
     return currentType.TypeCode;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:DataTypeImplementation.cs

示例15: GetSimpleTypeFromTypeCode

 internal static XmlSchemaSimpleType GetSimpleTypeFromTypeCode(XmlTypeCode typeCode) {
     return enumToTypeCode[(int) typeCode];
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:3,代码来源:DataTypeImplementation.cs


注:本文中的XmlTypeCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。