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


C# XmlMembersMapping.CheckShallow方法代碼示例

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


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

示例1: ExportMembersMapping

 /// <include file='doc\SoapCodeExporter.uex' path='docs/doc[@for="SoapCodeExporter.ExportMembersMapping"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping) {
     xmlMembersMapping.CheckShallow();
     CheckScope(xmlMembersMapping.Scope);
     for (int i = 0; i < xmlMembersMapping.Count; i++) {
         ExportElement((ElementAccessor)xmlMembersMapping[i].Accessor);
     }
 }
開發者ID:uQr,項目名稱:referencesource,代碼行數:11,代碼來源:SoapCodeExporter.cs

示例2: ExportMembersMapping

 /// <include file='doc\XmlSchemaExporter.uex' path='docs/doc[@for="XmlSchemaExporter.ExportMembersMapping1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping, bool exportEnclosingType) {
     xmlMembersMapping.CheckShallow();
     MembersMapping mapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping;
     CheckScope(xmlMembersMapping.Scope);
     if (mapping.HasWrapperElement && exportEnclosingType) {
         ExportElement(xmlMembersMapping.Accessor);
     }
     else {
         foreach (MemberMapping member in mapping.Members) {
             if (member.Attribute != null) 
                 throw new InvalidOperationException(Res.GetString(Res.XmlBareAttributeMember, member.Attribute.Name));
             else if (member.Text != null) 
                 throw new InvalidOperationException(Res.GetString(Res.XmlBareTextMember, member.Text.Name));
             else if (member.Elements == null || member.Elements.Length == 0)
                 continue;
             
             if (member.TypeDesc.IsArrayLike && !(member.Elements[0].Mapping is ArrayMapping)) 
                 throw new InvalidOperationException(Res.GetString(Res.XmlIllegalArrayElement, member.Elements[0].Name));
             
             if (exportEnclosingType) {
                 ExportElement(member.Elements[0]);
             }
             else {
                 ExportMapping(member.Elements[0].Mapping, member.Elements[0].Namespace, member.Elements[0].Any);
             }
         }
     }
     ExportRootIfNecessary(xmlMembersMapping.Scope);
 }
開發者ID:uQr,項目名稱:referencesource,代碼行數:33,代碼來源:XmlSchemaExporter.cs

示例3: ExportMembersMapping

        /// <include file='doc\XmlCodeExporter.uex' path='docs/doc[@for="XmlCodeExporter.ExportMembersMapping"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping)
        {
            xmlMembersMapping.CheckShallow();
            CheckScope(xmlMembersMapping.Scope);

            for (int i = 0; i < xmlMembersMapping.Count; i++)
            {
                AccessorMapping mapping = xmlMembersMapping[i].Mapping;
                if (mapping.Xmlns == null)
                {
                    if (mapping.Attribute != null)
                    {
                        ExportType(mapping.Attribute.Mapping, Accessor.UnescapeName(mapping.Attribute.Name), mapping.Attribute.Namespace, null, false);
                    }
                    if (mapping.Elements != null)
                    {
                        for (int j = 0; j < mapping.Elements.Length; j++)
                        {
                            ElementAccessor element = mapping.Elements[j];
                            ExportType(element.Mapping, Accessor.UnescapeName(element.Name), element.Namespace, null, false);
                        }
                    }
                    if (mapping.Text != null)
                    {
                        ExportType(mapping.Text.Mapping, Accessor.UnescapeName(mapping.Text.Name), mapping.Text.Namespace, null, false);
                    }
                }
            }
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:33,代碼來源:XmlCodeExporter.cs

示例4: ExportTypeMapping

 /// <include file='doc\XmlSchemaExporter.uex' path='docs/doc[@for="XmlSchemaExporter.ExportTypeMapping1"]/*' />
 public XmlQualifiedName ExportTypeMapping(XmlMembersMapping xmlMembersMapping) {
     xmlMembersMapping.CheckShallow();
     CheckScope(xmlMembersMapping.Scope);
     MembersMapping mapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping;
     if (mapping.Members.Length == 1 && mapping.Members[0].Elements[0].Mapping is SpecialMapping) {
         SpecialMapping special = (SpecialMapping)mapping.Members[0].Elements[0].Mapping;
         XmlSchemaType type = ExportSpecialMapping(special, xmlMembersMapping.Accessor.Namespace, false, null);
         if (type != null && type.Name != null && type.Name.Length > 0) {
             type.Name = xmlMembersMapping.Accessor.Name;
             AddSchemaItem(type, xmlMembersMapping.Accessor.Namespace, null);
         }
         ExportRootIfNecessary(xmlMembersMapping.Scope);
         return (new XmlQualifiedName(xmlMembersMapping.Accessor.Name, xmlMembersMapping.Accessor.Namespace));
     }
     return null;
 }
開發者ID:uQr,項目名稱:referencesource,代碼行數:17,代碼來源:XmlSchemaExporter.cs

示例5: ExportMembersMapping

 public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping, bool exportEnclosingType)
 {
     xmlMembersMapping.CheckShallow();
     MembersMapping mapping = (MembersMapping) xmlMembersMapping.Accessor.Mapping;
     this.CheckScope(xmlMembersMapping.Scope);
     if (mapping.HasWrapperElement && exportEnclosingType)
     {
         this.ExportElement(xmlMembersMapping.Accessor);
     }
     else
     {
         foreach (MemberMapping mapping2 in mapping.Members)
         {
             if (mapping2.Attribute != null)
             {
                 throw new InvalidOperationException(Res.GetString("XmlBareAttributeMember", new object[] { mapping2.Attribute.Name }));
             }
             if (mapping2.Text != null)
             {
                 throw new InvalidOperationException(Res.GetString("XmlBareTextMember", new object[] { mapping2.Text.Name }));
             }
             if ((mapping2.Elements != null) && (mapping2.Elements.Length != 0))
             {
                 if (mapping2.TypeDesc.IsArrayLike && !(mapping2.Elements[0].Mapping is ArrayMapping))
                 {
                     throw new InvalidOperationException(Res.GetString("XmlIllegalArrayElement", new object[] { mapping2.Elements[0].Name }));
                 }
                 if (exportEnclosingType)
                 {
                     this.ExportElement(mapping2.Elements[0]);
                 }
                 else
                 {
                     this.ExportMapping(mapping2.Elements[0].Mapping, mapping2.Elements[0].Namespace, mapping2.Elements[0].Any);
                 }
             }
         }
     }
     this.ExportRootIfNecessary(xmlMembersMapping.Scope);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:40,代碼來源:XmlSchemaExporter.cs

示例6: ExportTypeMapping

 public XmlQualifiedName ExportTypeMapping(XmlMembersMapping xmlMembersMapping)
 {
     xmlMembersMapping.CheckShallow();
     this.CheckScope(xmlMembersMapping.Scope);
     MembersMapping mapping = (MembersMapping) xmlMembersMapping.Accessor.Mapping;
     if ((mapping.Members.Length != 1) || !(mapping.Members[0].Elements[0].Mapping is SpecialMapping))
     {
         return null;
     }
     SpecialMapping mapping2 = (SpecialMapping) mapping.Members[0].Elements[0].Mapping;
     XmlSchemaType item = this.ExportSpecialMapping(mapping2, xmlMembersMapping.Accessor.Namespace, false, null);
     if (((item != null) && (item.Name != null)) && (item.Name.Length > 0))
     {
         item.Name = xmlMembersMapping.Accessor.Name;
         this.AddSchemaItem(item, xmlMembersMapping.Accessor.Namespace, null);
     }
     this.ExportRootIfNecessary(xmlMembersMapping.Scope);
     return new XmlQualifiedName(xmlMembersMapping.Accessor.Name, xmlMembersMapping.Accessor.Namespace);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:19,代碼來源:XmlSchemaExporter.cs


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