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


C# XmlSchemaSimpleType.SetDatatype方法代码示例

本文整理汇总了C#中System.Xml.Schema.XmlSchemaSimpleType.SetDatatype方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaSimpleType.SetDatatype方法的具体用法?C# XmlSchemaSimpleType.SetDatatype怎么用?C# XmlSchemaSimpleType.SetDatatype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Schema.XmlSchemaSimpleType的用法示例。


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

示例1: StartBuiltinType

        /// <summary>
        /// Begin the creation of an XmlSchemaSimpleType object that will be used to represent a static built-in type.
        /// Once StartBuiltinType has been called for all built-in types, FinishBuiltinType should be called in order
        /// to create links between the types.
        /// </summary>
        internal static XmlSchemaSimpleType StartBuiltinType(XmlQualifiedName qname, XmlSchemaDatatype dataType) {
            XmlSchemaSimpleType simpleType;
            Debug.Assert(qname != null && dataType != null);

            simpleType = new XmlSchemaSimpleType();
            simpleType.SetQualifiedName(qname);
            simpleType.SetDatatype(dataType);
            simpleType.ElementDecl = new SchemaElementDecl(dataType);
            simpleType.ElementDecl.SchemaType = simpleType;

            return simpleType;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:17,代码来源:DataTypeImplementation.cs

示例2: CompileSimpleType

 private void CompileSimpleType(XmlSchemaSimpleType simpleType)
 {
     if (simpleType.IsProcessing)
     {
         throw new XmlSchemaException("Sch_TypeCircularRef", simpleType);
     }
     if (simpleType.ElementDecl == null)
     {
         simpleType.IsProcessing = true;
         try
         {
             if (simpleType.Content is XmlSchemaSimpleTypeList)
             {
                 XmlSchemaDatatype datatype;
                 XmlSchemaSimpleTypeList content = (XmlSchemaSimpleTypeList) simpleType.Content;
                 simpleType.SetBaseSchemaType(DatatypeImplementation.AnySimpleType);
                 if (content.ItemTypeName.IsEmpty)
                 {
                     this.CompileSimpleType(content.ItemType);
                     content.BaseItemType = content.ItemType;
                     datatype = content.ItemType.Datatype;
                 }
                 else
                 {
                     XmlSchemaSimpleType type = this.GetSimpleType(content.ItemTypeName);
                     if (type == null)
                     {
                         throw new XmlSchemaException("Sch_UndeclaredSimpleType", content.ItemTypeName.ToString(), simpleType);
                     }
                     if ((type.FinalResolved & XmlSchemaDerivationMethod.List) != XmlSchemaDerivationMethod.Empty)
                     {
                         base.SendValidationEvent("Sch_BaseFinalList", simpleType);
                     }
                     content.BaseItemType = type;
                     datatype = type.Datatype;
                 }
                 simpleType.SetDatatype(datatype.DeriveByList(simpleType));
                 simpleType.SetDerivedBy(XmlSchemaDerivationMethod.List);
             }
             else if (simpleType.Content is XmlSchemaSimpleTypeRestriction)
             {
                 XmlSchemaDatatype datatype2;
                 XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) simpleType.Content;
                 if (restriction.BaseTypeName.IsEmpty)
                 {
                     this.CompileSimpleType(restriction.BaseType);
                     simpleType.SetBaseSchemaType(restriction.BaseType);
                     datatype2 = restriction.BaseType.Datatype;
                 }
                 else if ((simpleType.Redefined != null) && (restriction.BaseTypeName == simpleType.Redefined.QualifiedName))
                 {
                     this.CompileSimpleType((XmlSchemaSimpleType) simpleType.Redefined);
                     simpleType.SetBaseSchemaType(simpleType.Redefined.BaseXmlSchemaType);
                     datatype2 = simpleType.Redefined.Datatype;
                 }
                 else
                 {
                     if (restriction.BaseTypeName.Equals(DatatypeImplementation.QnAnySimpleType))
                     {
                         throw new XmlSchemaException("Sch_InvalidSimpleTypeRestriction", restriction.BaseTypeName.ToString(), simpleType);
                     }
                     XmlSchemaSimpleType type2 = this.GetSimpleType(restriction.BaseTypeName);
                     if (type2 == null)
                     {
                         throw new XmlSchemaException("Sch_UndeclaredSimpleType", restriction.BaseTypeName.ToString(), simpleType);
                     }
                     if ((type2.FinalResolved & XmlSchemaDerivationMethod.Restriction) != XmlSchemaDerivationMethod.Empty)
                     {
                         base.SendValidationEvent("Sch_BaseFinalRestriction", simpleType);
                     }
                     simpleType.SetBaseSchemaType(type2);
                     datatype2 = type2.Datatype;
                 }
                 simpleType.SetDatatype(datatype2.DeriveByRestriction(restriction.Facets, base.NameTable, simpleType));
                 simpleType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
             }
             else
             {
                 XmlSchemaSimpleType[] types = this.CompileBaseMemberTypes(simpleType);
                 simpleType.SetBaseSchemaType(DatatypeImplementation.AnySimpleType);
                 simpleType.SetDatatype(XmlSchemaDatatype.DeriveByUnion(types, simpleType));
                 simpleType.SetDerivedBy(XmlSchemaDerivationMethod.Union);
             }
         }
         catch (XmlSchemaException exception)
         {
             if (exception.SourceSchemaObject == null)
             {
                 exception.SetSource(simpleType);
             }
             base.SendValidationEvent(exception);
             simpleType.SetDatatype(DatatypeImplementation.AnySimpleType.Datatype);
         }
         finally
         {
             SchemaElementDecl decl = new SchemaElementDecl {
                 ContentValidator = ContentValidator.TextOnly,
                 SchemaType = simpleType,
                 Datatype = simpleType.Datatype
             };
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:SchemaCollectionCompiler.cs

示例3: CompileSimpleType

 private void CompileSimpleType(XmlSchemaSimpleType simpleType) {
     if (simpleType.IsProcessing) {
         throw new XmlSchemaException(Res.Sch_TypeCircularRef, simpleType);
     }
     if (simpleType.ElementDecl != null) { // already compiled
         return;
     }
     simpleType.IsProcessing = true;
     try {
         if (simpleType.Content is XmlSchemaSimpleTypeList) {
             XmlSchemaSimpleTypeList list = (XmlSchemaSimpleTypeList)simpleType.Content;
             XmlSchemaDatatype datatype;
             simpleType.SetBaseSchemaType(DatatypeImplementation.AnySimpleType); 
             if (list.ItemTypeName.IsEmpty) {
                 CompileSimpleType(list.ItemType);
                 list.BaseItemType = list.ItemType;
                 datatype = list.ItemType.Datatype;
             }
             else {
                 XmlSchemaSimpleType type = GetSimpleType(list.ItemTypeName);
                 if (type != null) {
                     if ((type.FinalResolved & XmlSchemaDerivationMethod.List) != 0) {
                         SendValidationEvent(Res.Sch_BaseFinalList, simpleType);
                     }
                     list.BaseItemType = type;
                     datatype = type.Datatype;
                 }
                 else {
                     throw new XmlSchemaException(Res.Sch_UndeclaredSimpleType, list.ItemTypeName.ToString(), list);   
                 }
             }
             simpleType.SetDatatype(datatype.DeriveByList(simpleType));
             simpleType.SetDerivedBy(XmlSchemaDerivationMethod.List);
         }
         else if (simpleType.Content is XmlSchemaSimpleTypeRestriction) {
             XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction)simpleType.Content;
             XmlSchemaDatatype datatype;
             if (restriction.BaseTypeName.IsEmpty) {
                 CompileSimpleType(restriction.BaseType);
                 simpleType.SetBaseSchemaType(restriction.BaseType);
                 datatype = restriction.BaseType.Datatype;
             }
             else if (simpleType.Redefined != null && restriction.BaseTypeName == simpleType.Redefined.QualifiedName) {
                 CompileSimpleType((XmlSchemaSimpleType)simpleType.Redefined);
                 simpleType.SetBaseSchemaType(simpleType.Redefined.BaseXmlSchemaType);
                 datatype = simpleType.Redefined.Datatype;
             }
             else {
                 if (restriction.BaseTypeName.Equals(DatatypeImplementation.QnAnySimpleType)) {
                     XmlSchema parentSchema = Preprocessor.GetParentSchema(simpleType);
                     if (parentSchema.TargetNamespace != XmlSchema.Namespace) { //If it is not SForS, then error
                         throw new XmlSchemaException(Res.Sch_InvalidSimpleTypeRestriction, restriction.BaseTypeName.ToString(), simpleType);   
                     }
                 }
                 XmlSchemaSimpleType type = GetSimpleType(restriction.BaseTypeName);
                 if (type != null) {
                     if ((type.FinalResolved & XmlSchemaDerivationMethod.Restriction) != 0) {
                         SendValidationEvent(Res.Sch_BaseFinalRestriction, simpleType);
                     }
                     simpleType.SetBaseSchemaType(type);
                     datatype = type.Datatype;
                 }
                 else {
                     throw new XmlSchemaException(Res.Sch_UndeclaredSimpleType, restriction.BaseTypeName.ToString(), restriction);   
                 }
             }
             simpleType.SetDatatype(datatype.DeriveByRestriction(restriction.Facets, NameTable, simpleType));
             simpleType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
         }
         else { //simpleType.Content is XmlSchemaSimpleTypeUnion
             XmlSchemaSimpleType[] baseTypes = CompileBaseMemberTypes(simpleType);
             simpleType.SetBaseSchemaType(DatatypeImplementation.AnySimpleType);
             simpleType.SetDatatype(XmlSchemaDatatype.DeriveByUnion(baseTypes, simpleType));
             simpleType.SetDerivedBy(XmlSchemaDerivationMethod.Union);
         }
     } 
     catch (XmlSchemaException e) {
         if (e.SourceSchemaObject == null) {
             e.SetSource(simpleType);
         }
         SendValidationEvent(e);
         simpleType.SetDatatype(DatatypeImplementation.AnySimpleType.Datatype);
     } 
     finally {
         SchemaElementDecl decl = new SchemaElementDecl();
         decl.ContentValidator = ContentValidator.TextOnly;
         decl.SchemaType = simpleType;
         decl.Datatype = simpleType.Datatype;
         simpleType.ElementDecl = decl;
         simpleType.IsProcessing = false;
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:92,代码来源:SchemaSetCompiler.cs

示例4: GetTokenTypeV1Compat

 internal static XmlSchemaSimpleType GetTokenTypeV1Compat() {
     if (tokenTypeV1Compat == null) {
         XmlSchemaSimpleType correctType = GetSimpleTypeFromTypeCode(XmlTypeCode.Token);
         tokenTypeV1Compat = correctType.Clone() as XmlSchemaSimpleType;
         tokenTypeV1Compat.SetDatatype(c_tokenV1Compat);
         tokenTypeV1Compat.ElementDecl = new SchemaElementDecl(c_tokenV1Compat);
         tokenTypeV1Compat.ElementDecl.SchemaType = tokenTypeV1Compat;
     }
     return tokenTypeV1Compat;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:10,代码来源:datatypeimplementation.cs

示例5: GetNormalizedStringTypeV1Compat

 internal static XmlSchemaSimpleType GetNormalizedStringTypeV1Compat() {
     if (normalizedStringTypeV1Compat == null) {
         XmlSchemaSimpleType correctType = GetSimpleTypeFromTypeCode(XmlTypeCode.NormalizedString);
         normalizedStringTypeV1Compat = correctType.Clone() as XmlSchemaSimpleType;
         normalizedStringTypeV1Compat.SetDatatype(c_normalizedStringV1Compat);
         normalizedStringTypeV1Compat.ElementDecl = new SchemaElementDecl(c_normalizedStringV1Compat);
         normalizedStringTypeV1Compat.ElementDecl.SchemaType = normalizedStringTypeV1Compat;
     }
     return normalizedStringTypeV1Compat;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:10,代码来源:datatypeimplementation.cs

示例6: CompileSimpleType

 private void CompileSimpleType(XmlSchemaSimpleType simpleType) {
     if (simpleType.Validating) {
         throw new XmlSchemaException(Res.Sch_TypeCircularRef, simpleType);
     }
     if (simpleType.ElementDecl != null) { // already compiled
         return;
     }
     simpleType.Validating = true;
     try {
         if (simpleType.Content is XmlSchemaSimpleTypeList) {
             XmlSchemaSimpleTypeList list = (XmlSchemaSimpleTypeList)simpleType.Content;
             XmlSchemaDatatype datatype;
             if (list.ItemTypeName.IsEmpty) {
                 CompileSimpleType(list.ItemType);
                 simpleType.SetBaseSchemaType(list.ItemType);
                 datatype = list.ItemType.Datatype;
             }
             else {
                 datatype = GetDatatype(list.ItemTypeName);
                 if (datatype != null) {
                     simpleType.SetBaseSchemaType(datatype);
                 }
                 else {
                     XmlSchemaSimpleType type = GetSimpleType(list.ItemTypeName);
                     if (type != null) {
                         if ((type.FinalResolved & XmlSchemaDerivationMethod.List) != 0) {
                             SendValidationEvent(Res.Sch_BaseFinalList, simpleType);
                         }
                         simpleType.SetBaseSchemaType(type);
                         datatype = type.Datatype;
                     }
                     else {
                         throw new XmlSchemaException(Res.Sch_UndeclaredSimpleType, list.ItemTypeName.ToString(), simpleType);   
                     }
                 }
             }
             simpleType.SetDatatype(datatype.DeriveByList());
             simpleType.SetDerivedBy(XmlSchemaDerivationMethod.List);
         }
         else if (simpleType.Content is XmlSchemaSimpleTypeRestriction) {
             XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction)simpleType.Content;
             XmlSchemaDatatype datatype;
             if (restriction.BaseTypeName.IsEmpty) {
                 CompileSimpleType(restriction.BaseType);
                 simpleType.SetBaseSchemaType(restriction.BaseType);
                 datatype = restriction.BaseType.Datatype;
             }
             else if (simpleType.Redefined != null && restriction.BaseTypeName == simpleType.Redefined.QualifiedName) {
                 CompileSimpleType((XmlSchemaSimpleType)simpleType.Redefined);
                 simpleType.SetBaseSchemaType(simpleType.Redefined.BaseSchemaType);
                 datatype = simpleType.Redefined.Datatype;
             }
             else {
                 datatype = GetDatatype(restriction.BaseTypeName);
                 if (datatype != null) {
                     simpleType.SetBaseSchemaType(datatype);
                 }
                 else {
                     XmlSchemaSimpleType type = GetSimpleType(restriction.BaseTypeName);
                     if (type != null) {
                         if ((type.FinalResolved & XmlSchemaDerivationMethod.Restriction) != 0) {
                             SendValidationEvent(Res.Sch_BaseFinalRestriction, simpleType);
                         }
                         simpleType.SetBaseSchemaType(type);
                         datatype = type.Datatype;
                     }
                     else {
                         throw new XmlSchemaException(Res.Sch_UndeclaredSimpleType, restriction.BaseTypeName.ToString(), simpleType);   
                     }
                 }
             }
             simpleType.SetDatatype(datatype.DeriveByRestriction(restriction.Facets, this.nameTable));
             simpleType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
         }
         else { //simpleType.Content is XmlSchemaSimpleTypeUnion
             XmlSchemaSimpleTypeUnion union1 = (XmlSchemaSimpleTypeUnion)simpleType.Content;
             int baseTypeCount = union1.BaseTypes.Count;
             if (union1.MemberTypes != null) {
                 baseTypeCount += union1.MemberTypes.Length;
             }
             object[] baseTypes = new object[baseTypeCount];
             XmlSchemaDatatype[] baseDatatypes = new XmlSchemaDatatype[baseTypeCount];
             int idx = 0;
             if (union1.MemberTypes != null) {
                 foreach (XmlQualifiedName qname in union1.MemberTypes) {
                     XmlSchemaDatatype datatype = GetDatatype(qname);
                     if (datatype != null) {
                         baseTypes[idx] = datatype;
                         baseDatatypes[idx ++] = datatype;
                     }
                     else {
                         XmlSchemaSimpleType type = GetSimpleType(qname);
                         if (type != null) {
                             if ((type.FinalResolved & XmlSchemaDerivationMethod.Union) != 0) {
                                 SendValidationEvent(Res.Sch_BaseFinalUnion, simpleType);
                             }
                             baseTypes[idx] = type;
                             baseDatatypes[idx ++] = type.Datatype;
                         }
                         else {
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:compiler.cs

示例7: StartBuiltinType

 internal static XmlSchemaSimpleType StartBuiltinType(XmlQualifiedName qname, XmlSchemaDatatype dataType)
 {
     XmlSchemaSimpleType type = new XmlSchemaSimpleType();
     type.SetQualifiedName(qname);
     type.SetDatatype(dataType);
     type.ElementDecl = new SchemaElementDecl(dataType);
     type.ElementDecl.SchemaType = type;
     return type;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:DatatypeImplementation.cs


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