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


C# XmlSchemaComplexType.SetDatatype方法代碼示例

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


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

示例1: CompileSimpleContentRestriction

 private void CompileSimpleContentRestriction(XmlSchemaComplexType complexType, XmlSchemaSimpleContentRestriction simpleRestriction)
 {
     XmlSchemaComplexType redefined = null;
     XmlSchemaDatatype datatype = null;
     if ((complexType.Redefined != null) && (simpleRestriction.BaseTypeName == complexType.Redefined.QualifiedName))
     {
         redefined = (XmlSchemaComplexType) complexType.Redefined;
         this.CompileComplexType(redefined);
         datatype = redefined.Datatype;
     }
     else
     {
         redefined = this.GetComplexType(simpleRestriction.BaseTypeName);
         if (redefined == null)
         {
             base.SendValidationEvent("Sch_UndefBaseRestriction", simpleRestriction.BaseTypeName.ToString(), simpleRestriction);
             return;
         }
         if (redefined.ContentType == XmlSchemaContentType.TextOnly)
         {
             if (simpleRestriction.BaseType == null)
             {
                 datatype = redefined.Datatype;
             }
             else
             {
                 this.CompileSimpleType(simpleRestriction.BaseType);
                 if (!XmlSchemaType.IsDerivedFromDatatype(simpleRestriction.BaseType.Datatype, redefined.Datatype, XmlSchemaDerivationMethod.None))
                 {
                     base.SendValidationEvent("Sch_DerivedNotFromBase", simpleRestriction);
                 }
                 datatype = simpleRestriction.BaseType.Datatype;
             }
         }
         else if ((redefined.ContentType == XmlSchemaContentType.Mixed) && redefined.ElementDecl.ContentValidator.IsEmptiable)
         {
             if (simpleRestriction.BaseType != null)
             {
                 this.CompileSimpleType(simpleRestriction.BaseType);
                 complexType.SetBaseSchemaType(simpleRestriction.BaseType);
                 datatype = simpleRestriction.BaseType.Datatype;
             }
             else
             {
                 base.SendValidationEvent("Sch_NeedSimpleTypeChild", simpleRestriction);
             }
         }
         else
         {
             base.SendValidationEvent("Sch_NotSimpleContent", complexType);
         }
     }
     if (((redefined != null) && (redefined.ElementDecl != null)) && ((redefined.FinalResolved & XmlSchemaDerivationMethod.Restriction) != XmlSchemaDerivationMethod.Empty))
     {
         base.SendValidationEvent("Sch_BaseFinalRestriction", complexType);
     }
     if (redefined != null)
     {
         complexType.SetBaseSchemaType(redefined);
     }
     if (datatype != null)
     {
         try
         {
             complexType.SetDatatype(datatype.DeriveByRestriction(simpleRestriction.Facets, base.NameTable, complexType));
         }
         catch (XmlSchemaException exception)
         {
             if (exception.SourceSchemaObject == null)
             {
                 exception.SetSource(complexType);
             }
             base.SendValidationEvent(exception);
             complexType.SetDatatype(DatatypeImplementation.AnySimpleType.Datatype);
         }
     }
     complexType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
     this.CompileLocalAttributes(redefined, complexType, simpleRestriction.Attributes, simpleRestriction.AnyAttribute, XmlSchemaDerivationMethod.Restriction);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:79,代碼來源:SchemaCollectionCompiler.cs

示例2: CompileSimpleContentExtension

 private void CompileSimpleContentExtension(XmlSchemaComplexType complexType, XmlSchemaSimpleContentExtension simpleExtension)
 {
     XmlSchemaComplexType redefined = null;
     if ((complexType.Redefined != null) && (simpleExtension.BaseTypeName == complexType.Redefined.QualifiedName))
     {
         redefined = (XmlSchemaComplexType) complexType.Redefined;
         this.CompileComplexType(redefined);
         complexType.SetBaseSchemaType(redefined);
         complexType.SetDatatype(redefined.Datatype);
     }
     else
     {
         XmlSchemaType anySchemaType = this.GetAnySchemaType(simpleExtension.BaseTypeName);
         if (anySchemaType == null)
         {
             base.SendValidationEvent("Sch_UndeclaredType", simpleExtension.BaseTypeName.ToString(), complexType);
         }
         else
         {
             complexType.SetBaseSchemaType(anySchemaType);
             complexType.SetDatatype(anySchemaType.Datatype);
         }
         redefined = anySchemaType as XmlSchemaComplexType;
     }
     if (redefined != null)
     {
         if ((redefined.FinalResolved & XmlSchemaDerivationMethod.Extension) != XmlSchemaDerivationMethod.Empty)
         {
             base.SendValidationEvent("Sch_BaseFinalExtension", complexType);
         }
         if (redefined.ContentType != XmlSchemaContentType.TextOnly)
         {
             base.SendValidationEvent("Sch_NotSimpleContent", complexType);
         }
     }
     complexType.SetDerivedBy(XmlSchemaDerivationMethod.Extension);
     this.CompileLocalAttributes(redefined, complexType, simpleExtension.Attributes, simpleExtension.AnyAttribute, XmlSchemaDerivationMethod.Extension);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:38,代碼來源:SchemaCollectionCompiler.cs

示例3: CompileComplexContentExtension

        private void CompileComplexContentExtension(XmlSchemaComplexType complexType, XmlSchemaComplexContent complexContent, XmlSchemaComplexContentExtension complexExtension) {
            XmlSchemaComplexType baseType = null;
            if (complexType.Redefined != null && complexExtension.BaseTypeName == complexType.Redefined.QualifiedName) {
                baseType = (XmlSchemaComplexType)complexType.Redefined;
                CompileComplexType(baseType);
            }
            else {
                baseType = GetComplexType(complexExtension.BaseTypeName);
                if (baseType == null) {
                    SendValidationEvent(Res.Sch_UndefBaseExtension, complexExtension.BaseTypeName.ToString(), complexExtension);   
                    return;
                }
            }
            if ((baseType.FinalResolved & XmlSchemaDerivationMethod.Extension) != 0) {
                SendValidationEvent(Res.Sch_BaseFinalExtension, complexType);
            }
            CompileLocalAttributes(baseType, complexType, complexExtension.Attributes, complexExtension.AnyAttribute, XmlSchemaDerivationMethod.Extension);

            XmlSchemaParticle baseParticle = baseType.ContentTypeParticle;
            XmlSchemaParticle extendedParticle = CannonicalizeParticle(complexExtension.Particle, true);
            if (baseParticle != XmlSchemaParticle.Empty) {
                if (extendedParticle != XmlSchemaParticle.Empty) {
                    XmlSchemaSequence compiledParticle = new XmlSchemaSequence();
                    compiledParticle.Items.Add(baseParticle);
                    compiledParticle.Items.Add(extendedParticle);
                    complexType.SetContentTypeParticle(CompileContentTypeParticle(compiledParticle));
                }
                else {
                    complexType.SetContentTypeParticle(baseParticle);
                }
            }
            else {
                complexType.SetContentTypeParticle(extendedParticle);
            }
            XmlSchemaContentType contentType = GetSchemaContentType(complexType, complexContent, extendedParticle);
            if (contentType == XmlSchemaContentType.Empty) { //Derived content type is empty, Get ContentType from base
                contentType = baseType.ContentType;
                // In case of a simple base type (content type is TextOnly) the derived type
                //   will be the same as the base type. So set the same content type and then also
                //   set the same data type.
                if (contentType == XmlSchemaContentType.TextOnly) {
                    complexType.SetDatatype(baseType.Datatype);
                }
            }
            complexType.SetContentType(contentType);

            if (baseType.ContentType != XmlSchemaContentType.Empty && complexType.ContentType != baseType.ContentType) { //If base is empty, do not check
                SendValidationEvent(Res.Sch_DifContentType, complexType);
                return;
            }
            complexType.SetBaseSchemaType(baseType);
            complexType.SetDerivedBy(XmlSchemaDerivationMethod.Extension);
        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:53,代碼來源:SchemaSetCompiler.cs

示例4: CompileSimpleContentRestriction

 private void CompileSimpleContentRestriction(XmlSchemaComplexType complexType, XmlSchemaSimpleContentRestriction simpleRestriction) {
     XmlSchemaComplexType baseType = null;
     XmlSchemaDatatype datatype = null;
     if (complexType.Redefined != null && simpleRestriction.BaseTypeName == complexType.Redefined.QualifiedName) {
         baseType = (XmlSchemaComplexType)complexType.Redefined;
         CompileComplexType(baseType);
         datatype = baseType.Datatype;
     }
     else {
         baseType = GetComplexType(simpleRestriction.BaseTypeName);
         if (baseType == null) {
             SendValidationEvent(Res.Sch_UndefBaseRestriction, simpleRestriction.BaseTypeName.ToString(), simpleRestriction);
             return;
         }
         if (baseType.ContentType == XmlSchemaContentType.TextOnly) {
             if (simpleRestriction.BaseType == null) { 
                 datatype = baseType.Datatype; 
                 //There is a bug here. Need to check if simpleRestriction has facets.
                 //If yes, Need tp apply these facets as well. 
             }
             else {
                 CompileSimpleType(simpleRestriction.BaseType);
                 if(!XmlSchemaType.IsDerivedFromDatatype(simpleRestriction.BaseType.Datatype, baseType.Datatype, XmlSchemaDerivationMethod.None)) {
                    SendValidationEvent(Res.Sch_DerivedNotFromBase, simpleRestriction);
                 }
                 datatype = simpleRestriction.BaseType.Datatype;
             }
         }
         else if (baseType.ContentType == XmlSchemaContentType.Mixed && baseType.ElementDecl.ContentValidator.IsEmptiable) {
             if (simpleRestriction.BaseType != null) {
                 CompileSimpleType(simpleRestriction.BaseType);
                 complexType.SetBaseSchemaType(simpleRestriction.BaseType);
                 datatype = simpleRestriction.BaseType.Datatype;
             }
             else {
                 SendValidationEvent(Res.Sch_NeedSimpleTypeChild, simpleRestriction);
             }
         }
         else {
             SendValidationEvent(Res.Sch_NotSimpleContent, complexType);
         }
     }
     if (baseType != null && baseType.ElementDecl != null) {
         if ((baseType.FinalResolved & XmlSchemaDerivationMethod.Restriction) != 0) {
             SendValidationEvent(Res.Sch_BaseFinalRestriction, complexType);
         }
     }
     if (baseType != null) {
         complexType.SetBaseSchemaType(baseType);
     }
     if (datatype != null) {
         try {
             complexType.SetDatatype(datatype.DeriveByRestriction(simpleRestriction.Facets, NameTable, complexType));
         }
         catch (XmlSchemaException e) {
             if (e.SourceSchemaObject == null) {
                 e.SetSource(complexType);
             }
             SendValidationEvent(e);
             complexType.SetDatatype(DatatypeImplementation.AnySimpleType.Datatype);
         } 
     }
     complexType.SetDerivedBy(XmlSchemaDerivationMethod.Restriction);
     CompileLocalAttributes(baseType, complexType, simpleRestriction.Attributes, simpleRestriction.AnyAttribute, XmlSchemaDerivationMethod.Restriction);
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:65,代碼來源:SchemaSetCompiler.cs

示例5: CompileSimpleContentExtension

 private void CompileSimpleContentExtension(XmlSchemaComplexType complexType, XmlSchemaSimpleContentExtension simpleExtension) {
     XmlSchemaComplexType baseType = null;
     if (complexType.Redefined != null && simpleExtension.BaseTypeName == complexType.Redefined.QualifiedName) {
         baseType = (XmlSchemaComplexType)complexType.Redefined;
         CompileComplexType(baseType);
         complexType.SetBaseSchemaType(baseType);
         complexType.SetDatatype(baseType.Datatype);
     }
     else {
         XmlSchemaType bto = GetAnySchemaType(simpleExtension.BaseTypeName);
         if (bto == null) {
             SendValidationEvent(Res.Sch_UndeclaredType, simpleExtension.BaseTypeName.ToString(), simpleExtension);   
         } 
         else {
             complexType.SetBaseSchemaType(bto);
             complexType.SetDatatype(bto.Datatype);
         }
         baseType = bto as XmlSchemaComplexType;
     }
     if (baseType != null) {
         if ((baseType.FinalResolved & XmlSchemaDerivationMethod.Extension) != 0) {
             SendValidationEvent(Res.Sch_BaseFinalExtension, complexType);
         }
         if (baseType.ContentType != XmlSchemaContentType.TextOnly) {
             SendValidationEvent(Res.Sch_NotSimpleContent, complexType);
         }
     } 
     complexType.SetDerivedBy(XmlSchemaDerivationMethod.Extension);
     CompileLocalAttributes(baseType, complexType, simpleExtension.Attributes, simpleExtension.AnyAttribute, XmlSchemaDerivationMethod.Extension);
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:30,代碼來源:SchemaSetCompiler.cs

示例6: CompileComplexContentExtension

 private void CompileComplexContentExtension(XmlSchemaComplexType complexType, XmlSchemaComplexContent complexContent, XmlSchemaComplexContentExtension complexExtension)
 {
     XmlSchemaComplexType redefined = null;
     if ((complexType.Redefined != null) && (complexExtension.BaseTypeName == complexType.Redefined.QualifiedName))
     {
         redefined = (XmlSchemaComplexType) complexType.Redefined;
         this.CompileComplexType(redefined);
     }
     else
     {
         redefined = this.GetComplexType(complexExtension.BaseTypeName);
         if (redefined == null)
         {
             base.SendValidationEvent("Sch_UndefBaseExtension", complexExtension.BaseTypeName.ToString(), complexExtension);
             return;
         }
     }
     if ((redefined.FinalResolved & XmlSchemaDerivationMethod.Extension) != XmlSchemaDerivationMethod.Empty)
     {
         base.SendValidationEvent("Sch_BaseFinalExtension", complexType);
     }
     this.CompileLocalAttributes(redefined, complexType, complexExtension.Attributes, complexExtension.AnyAttribute, XmlSchemaDerivationMethod.Extension);
     XmlSchemaParticle contentTypeParticle = redefined.ContentTypeParticle;
     XmlSchemaParticle item = this.CannonicalizeParticle(complexExtension.Particle, true);
     if (contentTypeParticle != XmlSchemaParticle.Empty)
     {
         if (item != XmlSchemaParticle.Empty)
         {
             XmlSchemaSequence particle = new XmlSchemaSequence();
             particle.Items.Add(contentTypeParticle);
             particle.Items.Add(item);
             complexType.SetContentTypeParticle(this.CompileContentTypeParticle(particle));
         }
         else
         {
             complexType.SetContentTypeParticle(contentTypeParticle);
         }
     }
     else
     {
         complexType.SetContentTypeParticle(item);
     }
     XmlSchemaContentType contentType = this.GetSchemaContentType(complexType, complexContent, item);
     if (contentType == XmlSchemaContentType.Empty)
     {
         contentType = redefined.ContentType;
         if (contentType == XmlSchemaContentType.TextOnly)
         {
             complexType.SetDatatype(redefined.Datatype);
         }
     }
     complexType.SetContentType(contentType);
     if ((redefined.ContentType != XmlSchemaContentType.Empty) && (complexType.ContentType != redefined.ContentType))
     {
         base.SendValidationEvent("Sch_DifContentType", complexType);
     }
     else
     {
         complexType.SetBaseSchemaType(redefined);
         complexType.SetDerivedBy(XmlSchemaDerivationMethod.Extension);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:62,代碼來源:Compiler.cs


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