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


C# XdrBuilder.SetAttributePresence方法代碼示例

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


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

示例1: XDR_EndAttributeType

        private static void XDR_EndAttributeType(XdrBuilder builder)
        {
            string code = null;
            if (builder._AttributeDef._HasDataType && builder._AttributeDef._AttDef.Datatype != null)
            {
                XmlTokenizedType ttype = builder._AttributeDef._AttDef.Datatype.TokenizedType;

                if (ttype == XmlTokenizedType.ENUMERATION && !builder._AttributeDef._EnumerationRequired)
                {
                    code = SR.Sch_MissDtvaluesAttribute;
                    goto cleanup;
                }

                if (ttype != XmlTokenizedType.ENUMERATION && builder._AttributeDef._EnumerationRequired)
                {
                    code = SR.Sch_RequireEnumeration;
                    goto cleanup;
                }

                // a attributes of type id is not supposed to have a default value
                if (builder._AttributeDef._Default != null && ttype == XmlTokenizedType.ID)
                {
                    code = SR.Sch_DefaultIdValue;
                    goto cleanup;
                }
            }
            else
            {
                builder._AttributeDef._AttDef.Datatype = XmlSchemaDatatype.FromXmlTokenizedType(XmlTokenizedType.CDATA);
            }

            //
            // constraints
            //
            CompareMinMaxLength(builder._AttributeDef._MinLength, builder._AttributeDef._MaxLength, builder);
            builder._AttributeDef._AttDef.MaxLength = builder._AttributeDef._MaxLength;
            builder._AttributeDef._AttDef.MinLength = builder._AttributeDef._MinLength;

            //
            // checkAttributeType 
            //
            if (builder._AttributeDef._Default != null)
            {
                builder._AttributeDef._AttDef.DefaultValueRaw = builder._AttributeDef._AttDef.DefaultValueExpanded = (string)builder._AttributeDef._Default;
                builder.CheckDefaultAttValue(builder._AttributeDef._AttDef);
            }

            builder.SetAttributePresence(builder._AttributeDef._AttDef, builder._AttributeDef._Required);

        cleanup:
            if (code != null)
            {
                builder.SendValidationEvent(code);
            }
        }
開發者ID:dotnet,項目名稱:corefx,代碼行數:55,代碼來源:XdrBuilder.cs

示例2: XDR_EndAttributeType

 private static void XDR_EndAttributeType(XdrBuilder builder)
 {
     string code = null;
     if (builder._AttributeDef._HasDataType && (builder._AttributeDef._AttDef.Datatype != null))
     {
         XmlTokenizedType tokenizedType = builder._AttributeDef._AttDef.Datatype.TokenizedType;
         if ((tokenizedType == XmlTokenizedType.ENUMERATION) && !builder._AttributeDef._EnumerationRequired)
         {
             code = "Sch_MissDtvaluesAttribute";
         }
         else if ((tokenizedType != XmlTokenizedType.ENUMERATION) && builder._AttributeDef._EnumerationRequired)
         {
             code = "Sch_RequireEnumeration";
         }
         else
         {
             if ((builder._AttributeDef._Default == null) || (tokenizedType != XmlTokenizedType.ID))
             {
                 goto Label_00A3;
             }
             code = "Sch_DefaultIdValue";
         }
         goto Label_0164;
     }
     builder._AttributeDef._AttDef.Datatype = XmlSchemaDatatype.FromXmlTokenizedType(XmlTokenizedType.CDATA);
 Label_00A3:
     CompareMinMaxLength(builder._AttributeDef._MinLength, builder._AttributeDef._MaxLength, builder);
     builder._AttributeDef._AttDef.MaxLength = builder._AttributeDef._MaxLength;
     builder._AttributeDef._AttDef.MinLength = builder._AttributeDef._MinLength;
     if (builder._AttributeDef._Default != null)
     {
         builder._AttributeDef._AttDef.DefaultValueRaw = builder._AttributeDef._AttDef.DefaultValueExpanded = (string) builder._AttributeDef._Default;
         builder.CheckDefaultAttValue(builder._AttributeDef._AttDef);
     }
     builder.SetAttributePresence(builder._AttributeDef._AttDef, builder._AttributeDef._Required);
 Label_0164:
     if (code != null)
     {
         builder.SendValidationEvent(code);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:41,代碼來源:XdrBuilder.cs


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