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


C# XmlSchemaComplexType.ContainsIdAttribute方法代码示例

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


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

示例1: CompileComplexType

 private void CompileComplexType(XmlSchemaComplexType complexType) {
     if (complexType.ElementDecl != null) { //already compiled
         return;
     }
     if (complexType.IsProcessing) {
         SendValidationEvent(Res.Sch_TypeCircularRef, complexType);
         return;
     }
     complexType.IsProcessing = true;
     try {
         if (complexType.ContentModel != null) { //simpleContent or complexContent
             if (complexType.ContentModel is XmlSchemaSimpleContent) {
                 XmlSchemaSimpleContent simpleContent = (XmlSchemaSimpleContent)complexType.ContentModel;
                 complexType.SetContentType(XmlSchemaContentType.TextOnly);
                 if (simpleContent.Content is XmlSchemaSimpleContentExtension) {
                     CompileSimpleContentExtension(complexType, (XmlSchemaSimpleContentExtension)simpleContent.Content);
                 }
                 else { //simpleContent.Content is XmlSchemaSimpleContentRestriction
                     CompileSimpleContentRestriction(complexType, (XmlSchemaSimpleContentRestriction)simpleContent.Content);
                 }
             }
             else { // complexType.ContentModel is XmlSchemaComplexContent
                 XmlSchemaComplexContent complexContent = (XmlSchemaComplexContent)complexType.ContentModel;
                 if (complexContent.Content is XmlSchemaComplexContentExtension) {
                     CompileComplexContentExtension(complexType, complexContent, (XmlSchemaComplexContentExtension)complexContent.Content);
                 }
                 else { // complexContent.Content is XmlSchemaComplexContentRestriction
                     CompileComplexContentRestriction(complexType, complexContent, (XmlSchemaComplexContentRestriction)complexContent.Content);
                 }
             }
         }
         else { //equals XmlSchemaComplexContent with baseType is anyType
                 complexType.SetBaseSchemaType(XmlSchemaComplexType.AnyType);
                 CompileLocalAttributes(XmlSchemaComplexType.AnyType, complexType, complexType.Attributes, complexType.AnyAttribute, XmlSchemaDerivationMethod.Restriction);
                 complexType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
                 complexType.SetContentTypeParticle(CompileContentTypeParticle(complexType.Particle));
                 complexType.SetContentType(GetSchemaContentType(complexType, null, complexType.ContentTypeParticle));
         }
         if (complexType.ContainsIdAttribute(true)) {
             SendValidationEvent(Res.Sch_TwoIdAttrUses, complexType);
         }
         SchemaElementDecl decl = new SchemaElementDecl();
         decl.ContentValidator = CompileComplexContent(complexType);
         decl.SchemaType = complexType;
         decl.IsAbstract = complexType.IsAbstract;
         decl.Datatype = complexType.Datatype;
         decl.Block = complexType.BlockResolved;
         decl.AnyAttribute = complexType.AttributeWildcard;
         foreach(XmlSchemaAttribute attribute in complexType.AttributeUses.Values) {
             if (attribute.Use == XmlSchemaUse.Prohibited) {
                 if (!decl.ProhibitedAttributes.ContainsKey(attribute.QualifiedName)) {
                     decl.ProhibitedAttributes.Add(attribute.QualifiedName, attribute.QualifiedName);
                 }
             }
             else {
                 if (!decl.AttDefs.ContainsKey(attribute.QualifiedName) && attribute.AttDef != null && attribute.AttDef.Name != XmlQualifiedName.Empty && attribute.AttDef != SchemaAttDef.Empty) {
                     decl.AddAttDef(attribute.AttDef);
                 }
             }
         }
         complexType.ElementDecl = decl;
     }
     finally {
         complexType.IsProcessing = false;
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:66,代码来源:SchemaSetCompiler.cs

示例2: CompileComplexType

 private void CompileComplexType(XmlSchemaComplexType complexType)
 {
     if (complexType.ElementDecl == null)
     {
         if (complexType.IsProcessing)
         {
             base.SendValidationEvent("Sch_TypeCircularRef", complexType);
         }
         else
         {
             complexType.IsProcessing = true;
             try
             {
                 if (complexType.ContentModel != null)
                 {
                     if (complexType.ContentModel is XmlSchemaSimpleContent)
                     {
                         XmlSchemaSimpleContent contentModel = (XmlSchemaSimpleContent) complexType.ContentModel;
                         complexType.SetContentType(XmlSchemaContentType.TextOnly);
                         if (contentModel.Content is XmlSchemaSimpleContentExtension)
                         {
                             this.CompileSimpleContentExtension(complexType, (XmlSchemaSimpleContentExtension) contentModel.Content);
                         }
                         else
                         {
                             this.CompileSimpleContentRestriction(complexType, (XmlSchemaSimpleContentRestriction) contentModel.Content);
                         }
                     }
                     else
                     {
                         XmlSchemaComplexContent complexContent = (XmlSchemaComplexContent) complexType.ContentModel;
                         if (complexContent.Content is XmlSchemaComplexContentExtension)
                         {
                             this.CompileComplexContentExtension(complexType, complexContent, (XmlSchemaComplexContentExtension) complexContent.Content);
                         }
                         else
                         {
                             this.CompileComplexContentRestriction(complexType, complexContent, (XmlSchemaComplexContentRestriction) complexContent.Content);
                         }
                     }
                 }
                 else
                 {
                     complexType.SetBaseSchemaType(XmlSchemaComplexType.AnyType);
                     this.CompileLocalAttributes(XmlSchemaComplexType.AnyType, complexType, complexType.Attributes, complexType.AnyAttribute, XmlSchemaDerivationMethod.Restriction);
                     complexType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
                     complexType.SetContentTypeParticle(this.CompileContentTypeParticle(complexType.Particle));
                     complexType.SetContentType(this.GetSchemaContentType(complexType, null, complexType.ContentTypeParticle));
                 }
                 if (complexType.ContainsIdAttribute(true))
                 {
                     base.SendValidationEvent("Sch_TwoIdAttrUses", complexType);
                 }
                 SchemaElementDecl decl = new SchemaElementDecl {
                     ContentValidator = this.CompileComplexContent(complexType),
                     SchemaType = complexType,
                     IsAbstract = complexType.IsAbstract,
                     Datatype = complexType.Datatype,
                     Block = complexType.BlockResolved,
                     AnyAttribute = complexType.AttributeWildcard
                 };
                 foreach (XmlSchemaAttribute attribute in complexType.AttributeUses.Values)
                 {
                     if (attribute.Use == XmlSchemaUse.Prohibited)
                     {
                         if (!decl.ProhibitedAttributes.ContainsKey(attribute.QualifiedName))
                         {
                             decl.ProhibitedAttributes.Add(attribute.QualifiedName, attribute.QualifiedName);
                         }
                     }
                     else if ((!decl.AttDefs.ContainsKey(attribute.QualifiedName) && (attribute.AttDef != null)) && ((attribute.AttDef.Name != XmlQualifiedName.Empty) && (attribute.AttDef != SchemaAttDef.Empty)))
                     {
                         decl.AddAttDef(attribute.AttDef);
                     }
                 }
                 complexType.ElementDecl = decl;
             }
             finally
             {
                 complexType.IsProcessing = false;
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:84,代码来源:Compiler.cs


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