當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlSchemaComplexType.SetBlockResolved方法代碼示例

本文整理匯總了C#中System.Xml.Schema.XmlSchemaComplexType.SetBlockResolved方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSchemaComplexType.SetBlockResolved方法的具體用法?C# XmlSchemaComplexType.SetBlockResolved怎麽用?C# XmlSchemaComplexType.SetBlockResolved使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.Schema.XmlSchemaComplexType的用法示例。


在下文中一共展示了XmlSchemaComplexType.SetBlockResolved方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PreprocessComplexType

 private void PreprocessComplexType(XmlSchemaComplexType complexType, bool local)
 {
     if (local)
     {
         if (complexType.Name != null)
         {
             base.SendValidationEvent("Sch_ForbiddenAttribute", "name", complexType);
         }
     }
     else
     {
         if (complexType.Name != null)
         {
             this.ValidateNameAttribute(complexType);
             complexType.SetQualifiedName(new XmlQualifiedName(complexType.Name, this.targetNamespace));
         }
         else
         {
             base.SendValidationEvent("Sch_MissRequiredAttribute", "name", complexType);
         }
         if (complexType.Block == XmlSchemaDerivationMethod.All)
         {
             complexType.SetBlockResolved(XmlSchemaDerivationMethod.All);
         }
         else if (complexType.Block == XmlSchemaDerivationMethod.None)
         {
             complexType.SetBlockResolved(this.blockDefault & (XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Extension));
         }
         else
         {
             if ((complexType.Block & ~(XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Extension)) != XmlSchemaDerivationMethod.Empty)
             {
                 base.SendValidationEvent("Sch_InvalidComplexTypeBlockValue", complexType);
             }
             complexType.SetBlockResolved(complexType.Block & (XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Extension));
         }
         if (complexType.Final == XmlSchemaDerivationMethod.All)
         {
             complexType.SetFinalResolved(XmlSchemaDerivationMethod.All);
         }
         else if (complexType.Final == XmlSchemaDerivationMethod.None)
         {
             if (this.finalDefault == XmlSchemaDerivationMethod.All)
             {
                 complexType.SetFinalResolved(XmlSchemaDerivationMethod.All);
             }
             else
             {
                 complexType.SetFinalResolved(this.finalDefault & (XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Extension));
             }
         }
         else
         {
             if ((complexType.Final & ~(XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Extension)) != XmlSchemaDerivationMethod.Empty)
             {
                 base.SendValidationEvent("Sch_InvalidComplexTypeFinalValue", complexType);
             }
             complexType.SetFinalResolved(complexType.Final & (XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Extension));
         }
     }
     if (complexType.ContentModel != null)
     {
         this.SetParent(complexType.ContentModel, complexType);
         this.PreprocessAnnotation(complexType.ContentModel);
         if (complexType.Particle == null)
         {
             XmlSchemaObjectCollection attributes = complexType.Attributes;
         }
         if (complexType.ContentModel is XmlSchemaSimpleContent)
         {
             XmlSchemaSimpleContent contentModel = (XmlSchemaSimpleContent) complexType.ContentModel;
             if (contentModel.Content == null)
             {
                 if (complexType.QualifiedName == XmlQualifiedName.Empty)
                 {
                     base.SendValidationEvent("Sch_NoRestOrExt", complexType);
                 }
                 else
                 {
                     base.SendValidationEvent("Sch_NoRestOrExtQName", complexType.QualifiedName.Name, complexType.QualifiedName.Namespace, complexType);
                 }
             }
             else
             {
                 this.SetParent(contentModel.Content, contentModel);
                 this.PreprocessAnnotation(contentModel.Content);
                 if (contentModel.Content is XmlSchemaSimpleContentExtension)
                 {
                     XmlSchemaSimpleContentExtension content = (XmlSchemaSimpleContentExtension) contentModel.Content;
                     if (content.BaseTypeName.IsEmpty)
                     {
                         base.SendValidationEvent("Sch_MissAttribute", "base", content);
                     }
                     else
                     {
                         this.ValidateQNameAttribute(content, "base", content.BaseTypeName);
                     }
                     this.PreprocessAttributes(content.Attributes, content.AnyAttribute, content);
                     this.ValidateIdAttribute(content);
                 }
//.........這裏部分代碼省略.........
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:101,代碼來源:Preprocessor.cs

示例2: PreprocessComplexType

        private void PreprocessComplexType(XmlSchemaComplexType complexType, bool local) {
            if (local) {
                if (complexType.Name != null) {
                    SendValidationEvent(Res.Sch_ForbiddenAttribute, "name", complexType);
                }
            }
            else {
                if (complexType.Name != null) {
                    ValidateNameAttribute(complexType);
                    complexType.SetQualifiedName(new XmlQualifiedName(complexType.Name, this.targetNamespace));
                }
                else {
                    SendValidationEvent(Res.Sch_MissRequiredAttribute, "name", complexType);
                }
                if (complexType.Block == XmlSchemaDerivationMethod.All) {
                    complexType.SetBlockResolved(XmlSchemaDerivationMethod.All);
                }
                else if (complexType.Block == XmlSchemaDerivationMethod.None) {
                    complexType.SetBlockResolved(this.blockDefault & complexTypeBlockAllowed);
                }
                else {
                    if ((complexType.Block & ~complexTypeBlockAllowed) != 0) {
                        SendValidationEvent(Res.Sch_InvalidComplexTypeBlockValue, complexType);
                    }
                    complexType.SetBlockResolved(complexType.Block & complexTypeBlockAllowed);
                }
                if (complexType.Final == XmlSchemaDerivationMethod.All) {
                    complexType.SetFinalResolved(XmlSchemaDerivationMethod.All);
                }
                else if (complexType.Final == XmlSchemaDerivationMethod.None) {
                    if (this.finalDefault == XmlSchemaDerivationMethod.All) {
                        complexType.SetFinalResolved(XmlSchemaDerivationMethod.All);
                    }
                    else {
                        complexType.SetFinalResolved(this.finalDefault & complexTypeFinalAllowed);
                    }
                }
                else {
                    if ((complexType.Final & ~complexTypeFinalAllowed) != 0) {
                        SendValidationEvent(Res.Sch_InvalidComplexTypeFinalValue, complexType);
                    }
                    complexType.SetFinalResolved(complexType.Final & complexTypeFinalAllowed);
                }

            }

            if (complexType.ContentModel != null) {
                SetParent(complexType.ContentModel, complexType); //SimpleContent / complexCotent
                PreprocessAnnotation(complexType.ContentModel);

                if (complexType.Particle != null || complexType.Attributes != null) {
                    // this is illigal
                }
                if (complexType.ContentModel is XmlSchemaSimpleContent) {
                    XmlSchemaSimpleContent content = (XmlSchemaSimpleContent)complexType.ContentModel;
                    if (content.Content == null) {
                        if (complexType.QualifiedName == XmlQualifiedName.Empty) {
                            SendValidationEvent(Res.Sch_NoRestOrExt, complexType);
                        }
                        else {
                            SendValidationEvent(Res.Sch_NoRestOrExtQName, complexType.QualifiedName.Name, complexType.QualifiedName.Namespace, complexType);
                        }
                    } 
                    else {
                        SetParent(content.Content, content);   //simplecontent extension / restriction
                        PreprocessAnnotation(content.Content); //annotation child of simple extension / restriction

                        if (content.Content is XmlSchemaSimpleContentExtension) {
                            XmlSchemaSimpleContentExtension contentExtension = (XmlSchemaSimpleContentExtension)content.Content;
                            if (contentExtension.BaseTypeName.IsEmpty) {
                                SendValidationEvent(Res.Sch_MissAttribute, "base", contentExtension);
                            }
                            else {
                                ValidateQNameAttribute(contentExtension, "base", contentExtension.BaseTypeName);
                            }
                            PreprocessAttributes(contentExtension.Attributes, contentExtension.AnyAttribute, contentExtension);
                            ValidateIdAttribute(contentExtension);
                        } 
                        else { //XmlSchemaSimpleContentRestriction
                            XmlSchemaSimpleContentRestriction contentRestriction = (XmlSchemaSimpleContentRestriction)content.Content;
                            if (contentRestriction.BaseTypeName.IsEmpty) {
                                SendValidationEvent(Res.Sch_MissAttribute, "base", contentRestriction);
                            }
                            else {
                                ValidateQNameAttribute(contentRestriction, "base", contentRestriction.BaseTypeName);
                            }
                            if (contentRestriction.BaseType != null) {
                                SetParent(contentRestriction.BaseType, contentRestriction);
                                PreprocessSimpleType(contentRestriction.BaseType, true);
                            } 
                            PreprocessAttributes(contentRestriction.Attributes, contentRestriction.AnyAttribute, contentRestriction);
                            ValidateIdAttribute(contentRestriction);
                        }
                    }
                    ValidateIdAttribute(content);
                } 
                else { // XmlSchemaComplexContent
                    XmlSchemaComplexContent content = (XmlSchemaComplexContent)complexType.ContentModel;
                    if (content.Content == null) {
                        if (complexType.QualifiedName == XmlQualifiedName.Empty) {
//.........這裏部分代碼省略.........
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:101,代碼來源:Preprocessor.cs


注:本文中的System.Xml.Schema.XmlSchemaComplexType.SetBlockResolved方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。