• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Schema.XmlSchemaComplexContentExtension类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Schema.XmlSchemaComplexContentExtension的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaComplexContentExtension类的具体用法?C# XmlSchemaComplexContentExtension怎么用?C# XmlSchemaComplexContentExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlSchemaComplexContentExtension类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaComplexContentExtension类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Visit

        protected override void Visit(XmlSchemaComplexContentExtension extension)
        {
            var baseType = _schemaSetManager.SchemaSet.GlobalTypes[extension.BaseTypeName] as XmlSchemaComplexType;

            if (baseType != null)
            {
                if (baseType.ContentType == XmlSchemaContentType.ElementOnly ||
                    baseType.ContentType == XmlSchemaContentType.Mixed)
                {
                    if (extension.Particle == null)
                    {
                        Traverse(baseType);
                    }
                    else
                    {
                        PushNode(ChildType.Sequence, extension, null);
                        Traverse(baseType);
                        Traverse(extension.Particle);
                        PopNode();
                    }

                    return;
                }
            }

            if (extension.Particle != null)
                Traverse(extension.Particle);
        }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:28,代码来源:ChildrenFinder.cs


示例2: CreateProtoComplexType

        XObject[] CreateProtoComplexType(XmlSchemaComplexType complexType) {
            if (complexType.ContentModel != null) {
                if ((complexType.ContentModel as XmlSchemaSimpleContent) != null) {
                    return CreateProtoSimpleContent((complexType.ContentModel as XmlSchemaSimpleContent), complexType.BaseXmlSchemaType).ToArray();
                } else if ((complexType.ContentModel as XmlSchemaComplexContent) != null) {
                    return CreateProtoComplexContent((complexType.ContentModel as XmlSchemaComplexContent), complexType.BaseXmlSchemaType).ToArray();
                } else {
                    throw new Exception("not implemented");
                }
            } else {
                var complexContentExt = new XmlSchemaComplexContentExtension();
                if (complexType.BaseXmlSchemaType != null) {
                    complexContentExt.BaseTypeName = complexType.BaseXmlSchemaType.QualifiedName;
                } else {
                    complexContentExt.BaseTypeName = null;
                }

                if (complexType.Attributes != null) {
                    foreach (var i in complexType.Attributes) {
                        complexContentExt.Attributes.Add(i);
                    }
                }
                complexContentExt.Particle = complexType.Particle;
                var complexContent = new XmlSchemaComplexContent();
                complexContent.Content = complexContentExt;
                return CreateProtoComplexContent(complexContent, complexType.BaseXmlSchemaType).ToArray();
            }
        }
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:28,代码来源:XmlParser.cs


示例3: AssertCompiledComplexContentExtension

		public static void AssertCompiledComplexContentExtension (XmlSchemaComplexContentExtension xccx,
			int attributeCount, bool hasAnyAttribute, XmlQualifiedName baseTypeName)
		{
			Assert.IsNotNull (xccx);
			Assert.AreEqual (attributeCount, xccx.Attributes.Count);
			Assert.AreEqual (hasAnyAttribute, xccx.AnyAttribute != null);
			Assert.AreEqual (baseTypeName, xccx.BaseTypeName);
			Assert.IsNotNull (xccx.Particle);
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:XmlSchemaAssertion.cs


示例4: AssertCompiledComplexContentExtension

		protected void AssertCompiledComplexContentExtension (XmlSchemaComplexContentExtension xccx,
			int attributeCount, bool hasAnyAttribute, XmlQualifiedName baseTypeName)
		{
			AssertNotNull (xccx);
			AssertEquals (attributeCount, xccx.Attributes.Count);
			AssertEquals (hasAnyAttribute, xccx.AnyAttribute != null);
			AssertEquals (baseTypeName, xccx.BaseTypeName);
			AssertNotNull (xccx.Particle);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:XmlSchemaAssertion.cs


示例5: Write42_XmlSchemaComplexContentExtension

 void Write42_XmlSchemaComplexContentExtension(XmlSchemaComplexContentExtension o) {
     if ((object)o == null) return;
     WriteStartElement("extension");
     
     WriteAttribute(@"id", @"", ((System.String)[email protected]));
     WriteAttributes((XmlAttribute[])[email protected], o);
     if ([email protected]){
         WriteAttribute(@"base", @"", [email protected]);
     }
     Write5_XmlSchemaAnnotation((XmlSchemaAnnotation)[email protected]);
     if ([email protected] is XmlSchemaSequence) {
         Write54_XmlSchemaSequence((XmlSchemaSequence)[email protected]);
     }
     else if ([email protected] is XmlSchemaGroupRef) {
         Write55_XmlSchemaGroupRef((XmlSchemaGroupRef)[email protected]);
     }
     else if ([email protected] is XmlSchemaChoice) {
         Write52_XmlSchemaChoice((XmlSchemaChoice)[email protected]);
     }
     else if ([email protected] is XmlSchemaAll) {
         Write43_XmlSchemaAll((XmlSchemaAll)[email protected]);
     }
     WriteSortedItems(o.Attributes);
     Write33_XmlSchemaAnyAttribute((XmlSchemaAnyAttribute)[email protected]);
     WriteEndElement();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:SchemaObjectWriter.cs


示例6: ExportStructMapping

 private XmlQualifiedName ExportStructMapping(StructMapping mapping, string ns, XmlSchemaElement element)
 {
     if (mapping.TypeDesc.IsRoot)
     {
         this.needToExportRoot = true;
         return XmlQualifiedName.Empty;
     }
     if (mapping.IsAnonymousType)
     {
         if (this.references[mapping] != null)
         {
             throw new InvalidOperationException(Res.GetString("XmlCircularReference2", new object[] { mapping.TypeDesc.Name, "AnonymousType", "false" }));
         }
         this.references[mapping] = mapping;
     }
     XmlSchemaComplexType item = (XmlSchemaComplexType) this.types[mapping];
     if (item == null)
     {
         if (!mapping.IncludeInSchema)
         {
             throw new InvalidOperationException(Res.GetString("XmlCannotIncludeInSchema", new object[] { mapping.TypeDesc.Name }));
         }
         this.CheckForDuplicateType(mapping, mapping.Namespace);
         item = new XmlSchemaComplexType();
         if (!mapping.IsAnonymousType)
         {
             item.Name = mapping.TypeName;
             this.AddSchemaItem(item, mapping.Namespace, ns);
             this.types.Add(mapping, item);
         }
         item.IsAbstract = mapping.TypeDesc.IsAbstract;
         bool isOpenModel = mapping.IsOpenModel;
         if ((mapping.BaseMapping != null) && mapping.BaseMapping.IncludeInSchema)
         {
             if (mapping.BaseMapping.IsAnonymousType)
             {
                 throw new InvalidOperationException(Res.GetString("XmlAnonymousBaseType", new object[] { mapping.TypeDesc.Name, mapping.BaseMapping.TypeDesc.Name, "AnonymousType", "false" }));
             }
             if (mapping.HasSimpleContent)
             {
                 XmlSchemaSimpleContent content = new XmlSchemaSimpleContent();
                 XmlSchemaSimpleContentExtension extension = new XmlSchemaSimpleContentExtension {
                     BaseTypeName = this.ExportStructMapping(mapping.BaseMapping, mapping.Namespace, null)
                 };
                 content.Content = extension;
                 item.ContentModel = content;
             }
             else
             {
                 XmlSchemaComplexContentExtension extension2 = new XmlSchemaComplexContentExtension {
                     BaseTypeName = this.ExportStructMapping(mapping.BaseMapping, mapping.Namespace, null)
                 };
                 XmlSchemaComplexContent content2 = new XmlSchemaComplexContent {
                     Content = extension2,
                     IsMixed = XmlSchemaImporter.IsMixed((XmlSchemaComplexType) this.types[mapping.BaseMapping])
                 };
                 item.ContentModel = content2;
             }
             isOpenModel = false;
         }
         this.ExportTypeMembers(item, mapping.Members, mapping.TypeName, mapping.Namespace, mapping.HasSimpleContent, isOpenModel);
         this.ExportDerivedMappings(mapping);
         if (mapping.XmlnsMember != null)
         {
             this.AddXmlnsAnnotation(item, mapping.XmlnsMember.Name);
         }
     }
     else
     {
         this.AddSchemaImport(mapping.Namespace, ns);
     }
     if (mapping.IsAnonymousType)
     {
         this.references[mapping] = null;
         if (element != null)
         {
             element.SchemaType = item;
         }
         return XmlQualifiedName.Empty;
     }
     XmlQualifiedName name = new XmlQualifiedName(item.Name, mapping.Namespace);
     if (element != null)
     {
         element.SchemaTypeName = name;
     }
     return name;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:87,代码来源:XmlSchemaExporter.cs


示例7: GetAttributeCompletion

		XmlCompletionItemCollection GetAttributeCompletion(XmlSchemaComplexContentExtension extension, XmlNamespaceCollection namespacesInScope)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			completionItems.AddRange(GetAttributeCompletion(extension.Attributes, namespacesInScope));
			completionItems.AddRange(GetBaseComplexTypeAttributeCompletion(extension.BaseTypeName, namespacesInScope));
			
			return completionItems;
		}
开发者ID:Netring,项目名称:SharpDevelop,代码行数:9,代码来源:XmlSchemaCompletion.cs


示例8: FindAttribute

		XmlSchemaAttribute FindAttribute(XmlSchemaComplexContentExtension extension, string name)
		{
			return FindAttribute(extension.Attributes, name);
		}
开发者ID:Netring,项目名称:SharpDevelop,代码行数:4,代码来源:XmlSchemaCompletion.cs


示例9: CreateForEachElement

		/// <summary>
		/// Creates an element representing a conditional "ForEach" block, which recursively contains another type
		/// </summary>
		/// <param name="InnerType">The base type for the foreach block to contain</param>
		/// <returns>New schema element for the block</returns>
		static XmlSchemaElement CreateForEachElement(ScriptSchemaStandardType InnerType)
		{
			XmlSchemaComplexContentExtension Extension = new XmlSchemaComplexContentExtension();
			Extension.BaseTypeName = GetQualifiedTypeName(InnerType);
			Extension.Attributes.Add(CreateSchemaAttribute("Name", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Required));
			Extension.Attributes.Add(CreateSchemaAttribute("Values", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Required));
			Extension.Attributes.Add(CreateSchemaAttribute("If", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Optional));

			XmlSchemaComplexContent ContentModel = new XmlSchemaComplexContent();
			ContentModel.Content = Extension;

			XmlSchemaComplexType SchemaType = new XmlSchemaComplexType();
			SchemaType.ContentModel = ContentModel;

			XmlSchemaElement Element = new XmlSchemaElement();
			Element.Name = "ForEach";
			Element.SchemaType = SchemaType;
			return Element;
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:24,代码来源:Schema.cs


示例10: Visit

 protected override void Visit(XmlSchemaComplexContentExtension extension)
 {
     ProcessExtension(extension.BaseTypeName, extension.Attributes, extension.AnyAttribute);
 }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:4,代码来源:AttributeFinder.cs


示例11: GetAttributeCompletionData

		XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaComplexContentExtension extension)
		{
			XmlCompletionDataCollection data = new XmlCompletionDataCollection();
									
			data.AddRange(GetAttributeCompletionData(extension.Attributes));
			XmlSchemaComplexType baseComplexType = FindNamedType(schema, extension.BaseTypeName);
			if (baseComplexType != null) {
				data.AddRange(GetAttributeCompletionData(baseComplexType));
			}
			
			return data;
		}		
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:12,代码来源:XmlSchemaCompletionData.cs


示例12: WriteComplexSchemaType

                /// <summary>
                ///     Handle derivation by extension.
                ///     If type is null, it'll create a new complexType
                ///     with an XmlAny node in its sequence child node.
                /// </summary>
                public XmlSchemaType WriteComplexSchemaType (Type type)
                {
                        //
                        // Recursively generate schema for all parent types
                        //
                        if (type != null && type.BaseType == typeof (object))
                                return WriteSchemaType (type);

                        XmlSchemaComplexType complexType = new XmlSchemaComplexType ();
                        XmlSchemaSequence sequence;
                        XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension ();
                        XmlSchemaComplexContent content = new XmlSchemaComplexContent ();

                        complexType.ContentModel = content;
                        content.Content = extension;

                        XmlSchemaType baseSchemaType = WriteSchemaType (type.BaseType);

                        complexType.Name = type.Name;

                        FieldInfo [] fields = type.GetFields (flags);
                        PropertyInfo [] properties = type.GetProperties (flags);

                        try {
                                sequence = PopulateSequence (fields, properties);
                                if (attributes != null) {
                                        foreach (object o in attributes) {
                                                MemberInfo member = (MemberInfo) o;
                                                Type attribute_type = (Type) attributes [o];

                                                complexType.Attributes.Add (WriteSchemaAttribute (member, attribute_type));
                                        }
                                }
                        } catch (ArgumentException e) {
                                throw new ArgumentException (String.Format ("There is an error in '{0}'\n\t{1}", type.Name, e.Message));
                        }

                        extension.BaseTypeName = new XmlQualifiedName (baseSchemaType.Name);
                        extension.Particle = sequence;

                        generatedSchemaTypes.Add (type.FullName, complexType);
                        return complexType;
                }
开发者ID:symform,项目名称:mono,代码行数:48,代码来源:MonoXSD.cs


示例13: Check

		public override void Check (ConformanceCheckContext ctx, XmlSchemaComplexContentExtension value)
		{
			CheckSchemaQName (ctx, value, value.BaseTypeName);
			if (value.BaseTypeName.Namespace == "http://schemas.xmlsoap.org/soap/encoding/" && value.BaseTypeName.Name == "Array")
				ctx.ReportRuleViolation (value, BasicProfileRules.R2110);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:6,代码来源:BasicProfileChecker.cs


示例14: ExportStructMapping

        XmlQualifiedName ExportStructMapping(StructMapping mapping, string ns) {
            if (mapping.TypeDesc.IsRoot) return ExportRootMapping(mapping);
            XmlSchemaComplexType type = (XmlSchemaComplexType)types[mapping];
            if (type == null) {
                if (!mapping.IncludeInSchema) throw new InvalidOperationException(Res.GetString(Res.XmlSoapCannotIncludeInSchema, mapping.TypeDesc.Name));
                CheckForDuplicateType(mapping.TypeName, mapping.Namespace);
                type = new XmlSchemaComplexType();
                type.Name = mapping.TypeName;
                types.Add(mapping, type);
                AddSchemaItem(type, mapping.Namespace, ns);
                type.IsAbstract = mapping.TypeDesc.IsAbstract;

                if (mapping.BaseMapping != null && mapping.BaseMapping.IncludeInSchema) {
                    XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension();
                    extension.BaseTypeName = ExportStructMapping(mapping.BaseMapping, mapping.Namespace);
                    XmlSchemaComplexContent model = new XmlSchemaComplexContent();
                    model.Content = extension;
                    type.ContentModel = model;
                }
                ExportTypeMembers(type, mapping.Members, mapping.Namespace);
                ExportDerivedMappings(mapping);
            }
            else {
                AddSchemaImport(mapping.Namespace, ns);
            }
            return new XmlQualifiedName(type.Name, mapping.Namespace);
        }
开发者ID:ArildF,项目名称:masters,代码行数:27,代码来源:soapschemaexporter.cs


示例15: Check

		public virtual void Check (ConformanceCheckContext ctx, XmlSchemaComplexContentExtension value) {}
开发者ID:nobled,项目名称:mono,代码行数:1,代码来源:ConformanceChecker.cs


示例16: CreateNodeType

		/// <summary>
		/// Creates the schema type representing the node type
		/// </summary>
		/// <returns>Type definition for a node</returns>
		static XmlSchemaType CreateNodeType()
		{
			XmlSchemaComplexContentExtension Extension = new XmlSchemaComplexContentExtension();
			Extension.BaseTypeName = GetQualifiedTypeName(ScriptSchemaStandardType.NodeBody);
			Extension.Attributes.Add(CreateSchemaAttribute("Name", ScriptSchemaStandardType.Name, XmlSchemaUse.Required));
			Extension.Attributes.Add(CreateSchemaAttribute("Requires", ScriptSchemaStandardType.NameOrTagList, XmlSchemaUse.Optional));
			Extension.Attributes.Add(CreateSchemaAttribute("Produces", ScriptSchemaStandardType.TagList, XmlSchemaUse.Optional));
			Extension.Attributes.Add(CreateSchemaAttribute("After", ScriptSchemaStandardType.NameOrTagList, XmlSchemaUse.Optional));
			Extension.Attributes.Add(CreateSchemaAttribute("Token", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Optional));
			Extension.Attributes.Add(CreateSchemaAttribute("If", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Optional));
			Extension.Attributes.Add(CreateSchemaAttribute("NotifyOnWarnings", ScriptSchemaStandardType.Boolean, XmlSchemaUse.Optional));

			XmlSchemaComplexContent ContentModel = new XmlSchemaComplexContent();
			ContentModel.Content = Extension;

			XmlSchemaComplexType ComplexType = new XmlSchemaComplexType();
			ComplexType.Name = GetTypeName(ScriptSchemaStandardType.Node);
			ComplexType.ContentModel = ContentModel;
			return ComplexType;
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:24,代码来源:Schema.cs


示例17: CreateSwitchElement

		/// <summary>
		/// Creates an element representing a conditional "Switch" block, which recursively contains another type
		/// </summary>
		/// <param name="InnerType">The base type for the do block to contain</param>
		/// <returns>New schema element for the block</returns>
		static XmlSchemaElement CreateSwitchElement(ScriptSchemaStandardType InnerType)
		{
			// Create the "Option" element
			XmlSchemaComplexContentExtension CaseExtension = new XmlSchemaComplexContentExtension();
			CaseExtension.BaseTypeName = GetQualifiedTypeName(InnerType);
			CaseExtension.Attributes.Add(CreateSchemaAttribute("If", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Required));

			XmlSchemaComplexContent CaseContentModel = new XmlSchemaComplexContent();
			CaseContentModel.Content = CaseExtension;

			XmlSchemaComplexType CaseSchemaType = new XmlSchemaComplexType();
			CaseSchemaType.ContentModel = CaseContentModel;

			XmlSchemaElement CaseElement = new XmlSchemaElement();
			CaseElement.Name = "Case";
			CaseElement.SchemaType = CaseSchemaType;
			CaseElement.MinOccurs = 0;
			CaseElement.MaxOccursString = "unbounded";

			// Create the "Otherwise" element
			XmlSchemaElement OtherwiseElement = new XmlSchemaElement();
			OtherwiseElement.Name = "Default";
			OtherwiseElement.SchemaTypeName = GetQualifiedTypeName(InnerType);
			OtherwiseElement.MinOccurs = 0;
			OtherwiseElement.MaxOccurs = 1;

			// Create the "Switch" element
			XmlSchemaSequence SwitchSequence = new XmlSchemaSequence();
			SwitchSequence.Items.Add(CaseElement);
			SwitchSequence.Items.Add(OtherwiseElement);

			XmlSchemaComplexType SwitchSchemaType = new XmlSchemaComplexType();
			SwitchSchemaType.Particle = SwitchSequence;

			XmlSchemaElement SwitchElement = new XmlSchemaElement();
			SwitchElement.Name = "Switch";
			SwitchElement.SchemaType = SwitchSchemaType;
			return SwitchElement;
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:44,代码来源:Schema.cs


示例18: Visit

 protected override void Visit(XmlSchemaComplexContentExtension extension)
 {
     // Does not have text.
 }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:4,代码来源:SimpleTypeStructureBuilder.cs


示例19: ExportStructMapping

 XmlQualifiedName ExportStructMapping(StructMapping mapping, string ns, XmlSchemaElement element) {
     if (mapping.TypeDesc.IsRoot) {
         needToExportRoot = true;
         return XmlQualifiedName.Empty;
     }
     if (mapping.IsAnonymousType) {
         if (references[mapping] != null)
             throw new InvalidOperationException(Res.GetString(Res.XmlCircularReference2, mapping.TypeDesc.Name, "AnonymousType", "false"));
         references[mapping] = mapping;
     }
     XmlSchemaComplexType type = (XmlSchemaComplexType)types[mapping];
     if (type == null) {
         if (!mapping.IncludeInSchema) throw new InvalidOperationException(Res.GetString(Res.XmlCannotIncludeInSchema, mapping.TypeDesc.Name));
         CheckForDuplicateType(mapping, mapping.Namespace);
         type = new XmlSchemaComplexType();
         if (!mapping.IsAnonymousType) {
             type.Name = mapping.TypeName;
             AddSchemaItem(type, mapping.Namespace, ns);
             types.Add(mapping, type);
         }
         type.IsAbstract = mapping.TypeDesc.IsAbstract;
         bool openModel = mapping.IsOpenModel;
         if (mapping.BaseMapping != null && mapping.BaseMapping.IncludeInSchema) {
             if (mapping.BaseMapping.IsAnonymousType) {
                 throw new InvalidOperationException(Res.GetString(Res.XmlAnonymousBaseType, mapping.TypeDesc.Name, mapping.BaseMapping.TypeDesc.Name, "AnonymousType", "false"));
             }
             if (mapping.HasSimpleContent) {
                 XmlSchemaSimpleContent model = new XmlSchemaSimpleContent();
                 XmlSchemaSimpleContentExtension extension = new XmlSchemaSimpleContentExtension();
                 extension.BaseTypeName = ExportStructMapping(mapping.BaseMapping, mapping.Namespace, null);
                 model.Content = extension;
                 type.ContentModel = model;
             }
             else {
                 XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension();
                 extension.BaseTypeName = ExportStructMapping(mapping.BaseMapping, mapping.Namespace, null);
                 XmlSchemaComplexContent model = new XmlSchemaComplexContent();
                 model.Content = extension;
                 model.IsMixed = XmlSchemaImporter.IsMixed((XmlSchemaComplexType)types[mapping.BaseMapping]);
                 type.ContentModel = model;
             }
             openModel = false;
         }
         ExportTypeMembers(type, mapping.Members, mapping.TypeName, mapping.Namespace, mapping.HasSimpleContent, openModel);
         ExportDerivedMappings(mapping);
         if (mapping.XmlnsMember != null) {
             AddXmlnsAnnotation(type, mapping.XmlnsMember.Name);
         }
     }
     else {
         AddSchemaImport(mapping.Namespace, ns);
     }
     if (mapping.IsAnonymousType) {
         references[mapping] = null;
         if (element != null) 
             element.SchemaType = type;
         return XmlQualifiedName.Empty;
     }
     else {
         XmlQualifiedName qname = new XmlQualifiedName(type.Name, mapping.Namespace);
         if (element != null) element.SchemaTypeName = qname;
         return qname;
     }
 }
开发者ID:uQr,项目名称:referencesource,代码行数:64,代码来源:XmlSchemaExporter.cs


示例20: CreateSchemaComplexType

        /// <summary>
        /// Creates the an xml schema for a complex type. This method automatically takes care of
        /// any base classes that must be added.
        /// <para />
        /// This method already adds the <see cref="XmlSchemaComplexType" /> to the <see cref="XmlSchemaSet" />.
        /// </summary>
        /// <param name="type">The type to create the complex schema for.</param>
        /// <param name="schema">The schema.</param>
        /// <param name="schemaSet">The schema set.</param>
        /// <param name="serializationManager">The serialization manager.</param>
        /// <param name="generateFlatSchema">A value indicating whether the schema should be generated as flat schema.</param>
        /// <returns>The complex schema for the specified type.</returns>
        private static XmlSchemaComplexType CreateSchemaComplexType(Type type, XmlSchema schema, XmlSchemaSet schemaSet, ISerializationManager serializationManager, bool generateFlatSchema)
        {
            // Determine name, which is complex in generic types
            string typeName = GetTypeNameForSchema(type);

            // First, add the type, otherwise we might get into a stackoverflow when using generic base types
            // <xs:complexType>
            var modelBaseType = new XmlSchemaComplexType();
            modelBaseType.Name = typeName;
            modelBaseType.IsMixed = false;

            schema.Items.Add(modelBaseType);

            var propertiesSequence = GetPropertiesSequence(type, schema, schemaSet, serializationManager);

            // If flat, don't generate base classes, just the type itself
            if (generateFlatSchema)
            {
                modelBaseType.Particle = propertiesSequence;
                return modelBaseType;
            }

            if (type.IsGenericType)
            {
                var genericComplexType = new XmlSchemaComplexType();
                genericComplexType.Name = typeName;

                // <xs:annotation>
                var annotation = new XmlSchemaAnnotation();

                // <xs:appinfo>
                var appInfo = new XmlSchemaAppInfo();

                //<GenericType xmlns="http://schemas.microsoft.com/2003/10/Serialization/" Name="DataContractBaseOf{0}{#}" Namespace="http://schemas.datacontract.org/2004/07/STC">
                //  <GenericParameter Name="ProfileDateRange2" Namespace="http://schemas.datacontract.org/2004/07/STC.Meter.ProfileData"/>
                //</GenericType>
                var genericTypeElement = new XElement("GenericType");
                genericTypeElement.Add(new XAttribute("Name", string.Format("{0}Of{{0}}{{#}}", typeName)));
                genericTypeElement.Add(new XAttribute("Namespace", GetTypeNamespaceForSchema(type)));

                foreach (var genericArgument in type.GetGenericArgumentsEx())
                {
                    var genericArgumentQualifiedName = AddTypeToSchemaSet(genericArgument, schemaSet, serializationManager);
                    var genericArgumentElement = new XElement("GenericParameter");
                    genericArgumentElement.Add(new XAttribute("Name", genericArgumentQualifiedName.Name));
                    genericArgumentElement.Add(new XAttribute("Namespace", genericArgumentQualifiedName.Namespace));
                    genericTypeElement.Add(genericArgumentElement);
                }

                var conversionDoc = new XmlDocument();
                appInfo.Markup = new XmlNode[] { conversionDoc.CreateTextNode(genericTypeElement.ToString()) };

                annotation.Items.Add(appInfo);
            }

            var baseTypeQualifiedName = AddTypeToSchemaSet(type.BaseType, schemaSet, serializationManager);
            if (baseTypeQualifiedName != null)
            {
                // <xs:extensions base="address">
                var complexContentExtension = new XmlSchemaComplexContentExtension();
                complexContentExtension.BaseTypeName = baseTypeQualifiedName;
                complexContentExtension.Particle = propertiesSequence;

                // <xs:complexContent>
                var complexContent = new XmlSchemaComplexContent();
                complexContent.Content = complexContentExtension;

                modelBaseType.ContentModel = complexContent;
            }

            return modelBaseType;
        }
开发者ID:JaysonJG,项目名称:Catel,代码行数:84,代码来源:XmlSchemaHelper.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Schema.XmlSchemaComplexType类代码示例发布时间:2022-05-26
下一篇:
C# Schema.XmlSchemaComplexContent类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap