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


C# Schema.XmlSchemaComplexType類代碼示例

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


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

示例1: GetSchema

        public XmlSchemaElement GetSchema()
        {
            var type = new XmlSchemaComplexType();

            type.Attributes.Add(new XmlSchemaAttribute
                                    {
                                        Name = "refValue",
                                        Use = XmlSchemaUse.Required,
                                        SchemaTypeName =
                                            new XmlQualifiedName("positiveInteger", "http://www.w3.org/2001/XMLSchema")
                                    });

            type.Attributes.Add(new XmlSchemaAttribute
                                    {
                                        Name = "test",
                                        Use = XmlSchemaUse.Optional,
                                        SchemaTypeName =
                                            new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
                                    });

            
            var restriction = new XmlSchemaSimpleTypeRestriction
                                  {
                                      BaseTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
                                  };

            restriction.Facets.Add(new XmlSchemaEnumerationFacet {Value = "years"});
            restriction.Facets.Add(new XmlSchemaEnumerationFacet {Value = "weeks"});
            restriction.Facets.Add(new XmlSchemaEnumerationFacet {Value = "days"});

            var simpleType = new XmlSchemaSimpleType {Content = restriction};


            type.Attributes.Add(new XmlSchemaAttribute
                                    {
                                        Name = "units",
                                        Use = XmlSchemaUse.Required,
                                        SchemaType = simpleType
                                    });


            type.Attributes.Add(new XmlSchemaAttribute
                                    {
                                        Name = "expressionLanguage",
                                        Use = XmlSchemaUse.Optional,
                                        SchemaTypeName =
                                            new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
                                    });

            var element = new XmlSchemaElement
                              {
                                  Name = "dicom-age-less-than",
                                  SchemaType = type
                              };

            return element;
        }
開發者ID:nhannd,項目名稱:Xian,代碼行數:57,代碼來源:DicomAgeLessThanSpecification.cs

示例2: AndSchema

		public static XmlSchemaElement AndSchema()
		{
			var type = new XmlSchemaComplexType();

			var any = new XmlSchemaAny();
			any.MinOccurs = 1;
			any.MaxOccursString = "unbounded";
			any.ProcessContents = XmlSchemaContentProcessing.Strict;
			any.Namespace = "##local";

			var sequence = new XmlSchemaSequence();
			type.Particle = sequence;
			sequence.Items.Add(any);

			var attrib = new XmlSchemaAttribute();
			attrib.Name = "expressionLanguage";
			attrib.Use = XmlSchemaUse.Optional;
			attrib.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
			type.Attributes.Add(attrib);

			attrib = new XmlSchemaAttribute();
			attrib.Name = "failMessage";
			attrib.Use = XmlSchemaUse.Optional;
			attrib.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
			type.Attributes.Add(attrib);

			var element = new XmlSchemaElement();
			element.Name = "and";
			element.SchemaType = type;

			return element;
		}
開發者ID:m-berkani,項目名稱:ClearCanvas,代碼行數:32,代碼來源:XmlSpecificationSchema.cs

示例3: 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

示例4: ChildComplexType

 public ChildComplexType(XmlSchemaComplexType complexType, string elementName, string dotnetClassName, string nameSpace, XmlQualifiedName qname)
 {
     this.ComplexType = complexType;
     this.ElementName = elementName;
     this.DotnetClassName = dotnetClassName;
     this.Namespace = nameSpace;
     this.Qname = qname;
 }
開發者ID:MartinBG,項目名稱:Gva,代碼行數:8,代碼來源:ChildComplexType.cs

示例5: XmlSchemaComplexType

 static XmlSchemaComplexType() {
     anyType = new XmlSchemaComplexType();
     anyType.SetContentType(XmlSchemaContentType.Mixed);
     anyType.ElementDecl = SchemaElementDecl.CreateAnyTypeElementDecl();
     XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
     anyAttribute.BuildNamespaceList(null);
     anyType.SetAttributeWildcard(anyAttribute);
     anyType.ElementDecl.AnyAttribute = anyAttribute;
 }
開發者ID:ArildF,項目名稱:masters,代碼行數:9,代碼來源:xmlschemacomplextype.cs

示例6: CreateXmlSchemaForIndicatorsInGroup

        /// <summary>
        /// Формируем XmlSchema для правильного отображения индикаторов группы в VGridControl
        /// </summary>
        /// <param name="elmList">названия всех по</param>
        /// <returns>Возвращаем поток в который записана XmlSchema</returns>
        public static MemoryStream CreateXmlSchemaForIndicatorsInGroup(List<string[]> elmList)
        {
            var xmlSchema = new XmlSchema();

            // <xs:element name="root">
            var elementRoot = new XmlSchemaElement();
            xmlSchema.Items.Add(elementRoot);
            elementRoot.Name = "root";
            // <xs:complexType>
            var complexType = new XmlSchemaComplexType();
            elementRoot.SchemaType = complexType;

            // <xs:choice minOccurs="0" maxOccurs="unbounded">
            var choice = new XmlSchemaChoice();
            complexType.Particle = choice;
            choice.MinOccurs = 0;
            choice.MaxOccursString = "unbounded";

            // <xs:element name="record">
            var elementRecord = new XmlSchemaElement();
            choice.Items.Add(elementRecord);
            elementRecord.Name = "record";
            // <xs:complexType>
            var complexType2 = new XmlSchemaComplexType();
            elementRecord.SchemaType = complexType2;

            // <xs:sequence>
            var sequence = new XmlSchemaSequence();
            complexType2.Particle = sequence;

            foreach (var el in elmList)
            {
                var element = new XmlSchemaElement();
                sequence.Items.Add(element);
                element.Name = el[0];
                element.SchemaTypeName = new XmlQualifiedName(el[1], "http://www.w3.org/2001/XMLSchema");
            }

            var schemaSet = new XmlSchemaSet();
            schemaSet.Add(xmlSchema);
            schemaSet.Compile();

            XmlSchema compiledSchema = null;

            foreach (XmlSchema schema1 in schemaSet.Schemas())
                compiledSchema = schema1;

            var nsmgr = new XmlNamespaceManager(new NameTable());
            nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");

            var ms = new MemoryStream();
            if (compiledSchema != null) compiledSchema.Write(ms, nsmgr);
            ms.Position = 0;

            return ms;
        }
開發者ID:Biskup,項目名稱:GOATApplication,代碼行數:61,代碼來源:StaticData.cs

示例7: GetSchema

		public XmlSchemaElement GetSchema()
		{
			var type = new XmlSchemaComplexType();

			return new XmlSchemaElement
			{
				Name = OperatorTag,
				SchemaType = type
			};
		}
開發者ID:m-berkani,項目名稱:ClearCanvas,代碼行數:10,代碼來源:RequiresOrderIntendedForQCSpecification.cs

示例8: GetStype

		XmlSchemaComplexType GetStype ()
		{
			XmlSchemaSequence seq = new XmlSchemaSequence ();
			seq.Items.Add (new XmlSchemaAny ());
		
			XmlSchemaComplexType stype = new XmlSchemaComplexType ();
			stype.Particle = seq;
			
			return stype;
		}
開發者ID:nobled,項目名稱:mono,代碼行數:10,代碼來源:XmlSchemasTests.cs

示例9: CheckComplexType

 private void CheckComplexType(XmlQualifiedName typeName, XmlSchemaComplexType type)
 {
     if (type.IsAbstract)
     {
         ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, System.Runtime.Serialization.SR.GetString("AbstractTypeNotSupported"));
     }
     if (type.IsMixed)
     {
         ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, System.Runtime.Serialization.SR.GetString("MixedContentNotSupported"));
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:11,代碼來源:SchemaImporter.cs

示例10: VisitComplexType

        public virtual void VisitComplexType(XmlSchemaComplexType xmlSchemaComplexType)
        {
            //            XmlSchemaParticle particle = xmlSchemaComplexType.ContentTypeParticle;
            //            VisitParticle(particle);

            foreach (XmlSchemaObject attribute in xmlSchemaComplexType.Attributes)
            {
                Dispatch(attribute);
            }
            Dispatch(xmlSchemaComplexType.Particle);
        }
開發者ID:willrawls,項目名稱:arp,代碼行數:11,代碼來源:XsdVisitor.cs

示例11: Generator

 public Generator(XmlSchemaComplexType xsCoxType,
                  Dictionary<string, string> elementRef,
                  Dictionary<string, string> includePath,
                  List<KeyValuePair<string, string>> elementSubstitutionRef,
                  Dictionary<string, XmlSchemaGroup> elementGroupRef)
 {
     this.includePath = includePath;
     this.elementRef = elementRef;
     this.elementSubstitutionRef = elementSubstitutionRef;
     this.elementGroupRef = elementGroupRef;
     this.setXsd(xsCoxType);
 }
開發者ID:minikie,項目名稱:OTCDerivativesCalculatorModule,代碼行數:12,代碼來源:Generator.cs

示例12: FixtureInit

        public override void FixtureInit()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
            schemas.Add(SchemaCompletion);
            XmlSchemaCompletion xsdSchemaCompletion = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
            schemas.Add(xsdSchemaCompletion);

            string xml = GetSchema();
            int index = xml.IndexOf("type=\"text-type\"");
            index = xml.IndexOf("text-type", index);
            XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);
            schemaComplexType = (XmlSchemaComplexType)schemaDefinition.GetSelectedSchemaObject(xml, index);
        }
開發者ID:2594636985,項目名稱:SharpDevelop,代碼行數:13,代碼來源:ElementTypeSelectedTestFixture.cs

示例13: FixtureInit

		public override void FixtureInit()
		{
			XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
			schemas.Add(SchemaCompletionData);
			XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
			schemas.Add(xsdSchemaCompletionData);
			XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
			
			string xml = GetSchema();
			int index = xml.IndexOf("type=\"text-type\"");
			index = xml.IndexOf("text-type", index);
			schemaComplexType = (XmlSchemaComplexType)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
		}
開發者ID:kingjiang,項目名稱:SharpDevelopLite,代碼行數:13,代碼來源:ElementTypeSelectedTestFixture.cs

示例14: AddExtensionAttributes

        private void AddExtensionAttributes(ClassInfo classInfo, XmlSchemaComplexType complex)
        {
            if (complex.ContentModel == null || !(complex.ContentModel.Content is XmlSchemaSimpleContentExtension))
                return;

            var sce = complex.ContentModel.Content as XmlSchemaSimpleContentExtension;

            if (sce.Attributes.Count == 0)
                return;

            AddAttributes(classInfo, sce.Attributes);
            AddValueProperty(classInfo, sce);
        }
開發者ID:7digital,項目名稱:XsdToObject,代碼行數:13,代碼來源:ClassParser.cs

示例15: Visit

        protected override void Visit(XmlSchemaComplexType type)
        {
            if (type.QualifiedName.IsEmpty)
                base.Visit(type);
            else
            {
                if (!AddUsage(type))
                    return;

                PushNamedObject(type);
                base.Visit(type);
                PopNamedObject();
            }
        }
開發者ID:sergey-steinvil,項目名稱:xsddoc,代碼行數:14,代碼來源:TypeUsageFinder.cs


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