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

C# Schema.XmlSchemaSequence类代码示例

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

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



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

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


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


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


示例4: ReflectStringParametersMessage

        internal void ReflectStringParametersMessage() {
            Message inputMessage = InputMessage;
            foreach (ParameterInfo parameterInfo in Method.InParameters) {
                MessagePart part = new MessagePart();
                part.Name = XmlConvert.EncodeLocalName(parameterInfo.Name);
                if (parameterInfo.ParameterType.IsArray) {
                    string typeNs = DefaultNamespace;
                    if (typeNs.EndsWith("/", StringComparison.Ordinal))
                        typeNs += "AbstractTypes";
                    else
                        typeNs += "/AbstractTypes";
                    string typeName = "StringArray";
                    if (!ServiceDescription.Types.Schemas.Contains(typeNs)) {
                        XmlSchema schema = new XmlSchema();
                        schema.TargetNamespace = typeNs;
                        ServiceDescription.Types.Schemas.Add(schema);
                       
                        XmlSchemaElement element = new XmlSchemaElement();
                        element.Name = "String";
                        element.SchemaTypeName = new XmlQualifiedName("string", XmlSchema.Namespace);
                        element.MinOccurs = decimal.Zero;
                        element.MaxOccurs = decimal.MaxValue;
                        XmlSchemaSequence all = new XmlSchemaSequence();
                        all.Items.Add(element);

                        XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();
                        restriction.BaseTypeName = new XmlQualifiedName(Soap.ArrayType, Soap.Encoding);
                        restriction.Particle = all;

                        XmlSchemaImport import = new XmlSchemaImport();
                        import.Namespace = restriction.BaseTypeName.Namespace;
                        
                        XmlSchemaComplexContent model = new XmlSchemaComplexContent();
                        model.Content = restriction;

                        XmlSchemaComplexType type = new XmlSchemaComplexType();
                        type.Name = typeName;
                        type.ContentModel = model;

                        schema.Items.Add(type);
                        schema.Includes.Add(import);
                    }
                    part.Type = new XmlQualifiedName(typeName, typeNs);
                }
                else {
                    part.Type = new XmlQualifiedName("string", XmlSchema.Namespace);
                }
                inputMessage.Parts.Add(part);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:50,代码来源:HttpProtocolReflector.cs


示例5: CheckIfCollection

 private bool CheckIfCollection(XmlSchemaSequence rootSequence)
 {
     if ((rootSequence.Items == null) || (rootSequence.Items.Count == 0))
     {
         return false;
     }
     this.RemoveOptionalUnknownSerializationElements(rootSequence.Items);
     if (rootSequence.Items.Count != 1)
     {
         return false;
     }
     XmlSchemaObject obj2 = rootSequence.Items[0];
     if (!(obj2 is XmlSchemaElement))
     {
         return false;
     }
     XmlSchemaElement element = (XmlSchemaElement) obj2;
     if (!(element.MaxOccursString == "unbounded"))
     {
         return (element.MaxOccurs > 1M);
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:SchemaImporter.cs


示例6: CreateAnyType

        private static XmlSchemaComplexType CreateAnyType(XmlSchemaContentProcessing processContents)
        {
            XmlSchemaComplexType localAnyType = new XmlSchemaComplexType();
            localAnyType.SetQualifiedName(DatatypeImplementation.QnAnyType);

            XmlSchemaAny anyElement = new XmlSchemaAny();
            anyElement.MinOccurs = decimal.Zero;
            anyElement.MaxOccurs = decimal.MaxValue;

            anyElement.ProcessContents = processContents;
            anyElement.BuildNamespaceList(null);
            XmlSchemaSequence seq = new XmlSchemaSequence();
            seq.Items.Add(anyElement);

            localAnyType.SetContentTypeParticle(seq);
            localAnyType.SetContentType(XmlSchemaContentType.Mixed);

            localAnyType.ElementDecl = SchemaElementDecl.CreateAnyTypeElementDecl();
            localAnyType.ElementDecl.SchemaType = localAnyType;

            //Create contentValidator for Any
            ParticleContentValidator contentValidator = new ParticleContentValidator(XmlSchemaContentType.Mixed);
            contentValidator.Start();
            contentValidator.OpenGroup();
            contentValidator.AddNamespaceList(anyElement.NamespaceList, anyElement);
            contentValidator.AddStar();
            contentValidator.CloseGroup();
            ContentValidator anyContentValidator = contentValidator.Finish(true);
            localAnyType.ElementDecl.ContentValidator = anyContentValidator;

            XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
            anyAttribute.ProcessContents = processContents;
            anyAttribute.BuildNamespaceList(null);
            localAnyType.SetAttributeWildcard(anyAttribute);
            localAnyType.ElementDecl.AnyAttribute = anyAttribute;
            return localAnyType;
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:37,代码来源:XmlSchemaComplexType.cs


示例7: GetClassSchema

        /// <summary>
        /// Gets the class schema.
        /// </summary>
        /// <param name="t">The t.</param>
        /// <returns>schema info</returns>
        public static SchemaInfo GetClassSchema(this Type t)
        {
            var schemaInfo = new SchemaInfo();
            var classType = new XmlSchemaComplexType
                                {
                                    Name = t.Name
                                };

            var attribData = t.GetCustomAttributeDataOfType(typeof(DataContractAttribute));
            if (attribData.NamedArguments != null && attribData.NamedArguments.Count > 0)
            {
                foreach (var p1 in attribData.NamedArguments)
                {
                    switch (p1.MemberInfo.Name)
                    {
                        case "Namespace":
                            schemaInfo.Schema.TargetNamespace = p1.TypedValue.Value as string;
                            break;
                    }
                }
            }

            var sequence = new XmlSchemaSequence();

            classType.Particle = sequence;

            var propList = t.GetProperties();

            foreach (var p1 in propList)
            {
                var el = new XmlSchemaElement
                             {
                                 Name = p1.Name,
                                 MinOccurs = 0
                             };

                var xmlName = p1.PropertyType.XmlName();
                if (xmlName != null)
                {
                    el.SchemaTypeName = xmlName;
                }
                else
                {
                    if (p1.PropertyType.IsListType())
                    {
                        // what is this a list of?
                        if (p1.PropertyType.FullName != null)
                        {
                            var pr = Primitive2Xml.XmlName(InternalType(p1.PropertyType.FullName, false));
                            if (pr != null)
                            {
                                el.SchemaTypeName = new XmlQualifiedName("ArrayOf" + pr.Name);
                                schemaInfo.CustomTypes.Add(el.SchemaTypeName);
                            }
                            else
                            {
                                var schName = InternalType(p1.PropertyType.FullName, true);
                                el.SchemaTypeName = new XmlQualifiedName("ArrayOf" + schName);
                                schemaInfo.CustomTypes.Add(new XmlQualifiedName(schName));
                                schemaInfo.CustomTypes.Add(el.SchemaTypeName);
                            }
                        }
                    }
                    else if (p1.PropertyType.Name.Contains("Nullable"))
                    {
                        // what is this a nullable of?
                        if (p1.PropertyType.FullName != null)
                        {
                            var pr = Primitive2Xml.XmlName(InternalType(p1.PropertyType.FullName, false));
                            if (pr != null)
                            {
                                el.SchemaTypeName = pr;
                            }
                            else
                            {
                                var schName = InternalType(p1.PropertyType.FullName, true);
                                el.SchemaTypeName = new XmlQualifiedName(schName);
                                schemaInfo.CustomTypes.Add(el.SchemaTypeName);
                            }

                            el.IsNillable = true;
                        }
                    }
                    else
                    {
                        el.SchemaTypeName = new XmlQualifiedName(p1.PropertyType.Name);
                        schemaInfo.CustomTypes.Add(el.SchemaTypeName);
                    }
                }

                // get data member
                var attrData = p1.GetCustomAttributeDataOfType(typeof(DataMemberAttribute));
                if (attrData != null && attrData.NamedArguments != null
                    && attrData.NamedArguments.Count > 0)
                {
//.........这里部分代码省略.........
开发者ID:destevil,项目名称:CSharp2Xsd,代码行数:101,代码来源:TypeHelper.cs


示例8: GetSchema

		public XmlSchema GetSchema ()
		{
			XmlSchema s = new XmlSchema ();
			s.TargetNamespace = "http://www.go-mono.org/schemas";
			s.Id = "monoschema";
			XmlSchemaElement e = new XmlSchemaElement ();
			e.Name = "data";
			s.Items.Add (e);
			XmlSchemaComplexType cs = new XmlSchemaComplexType ();
			XmlSchemaSequence seq = new XmlSchemaSequence ();
			XmlSchemaAny any = new XmlSchemaAny ();
			any.MinOccurs = 0;
			any.MaxOccurs = decimal.MaxValue;
			seq.Items.Add (any);
			cs.Particle = seq;
			e.SchemaType = cs;
			return s;
		}
开发者ID:carrie901,项目名称:mono,代码行数:18,代码来源:ComplexDataStructure.cs


示例9: ExportParameters

		QName ExportParameters (MessageBodyDescription msgbody, string name, string ns)
		{
			XmlSchema xs = GetSchema (ns);
			//FIXME: Extract to a HasElement method ?
			foreach (XmlSchemaObject o in xs.Items) {
				XmlSchemaElement e = o as XmlSchemaElement;
				if (e == null)
					continue;

				if (e.Name == name)
					throw new InvalidOperationException (String.Format (
						"Message element named '{0}:{1}' has already been exported.",
						ns, name));
			}
				
			//Create the element for "parameters"
			XmlSchemaElement schema_element = new XmlSchemaElement ();
			schema_element.Name = name;

			XmlSchemaComplexType complex_type = new XmlSchemaComplexType ();
			//Generate Sequence representing the message/parameters
			//FIXME: MessageContractAttribute
		
			XmlSchemaSequence sequence = new XmlSchemaSequence ();
			XmlSchemaElement element = null;

			if (msgbody.ReturnValue == null) {
				//parameters
				foreach (MessagePartDescription part in msgbody.Parts) {
					if (part.Type == null)
						//FIXME: Eg. when WsdlImporter is used to import a wsdl
						throw new NotImplementedException ();
					
					element = GetSchemaElementForPart (part, xs);
					sequence.Items.Add (element);
				}
			} else {
				//ReturnValue
				if (msgbody.ReturnValue.Type != typeof (void)) {
					element = GetSchemaElementForPart (msgbody.ReturnValue, xs);
					sequence.Items.Add (element);
				}
			}

			complex_type.Particle = sequence;
			schema_element.SchemaType = complex_type;

			xs.Items.Add (schema_element);
			GeneratedXmlSchemas.Reprocess (xs);

			return new QName (schema_element.Name, xs.TargetNamespace);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:52,代码来源:WsdlExporter.cs


示例10: IsSequenceFromChoice

 private bool IsSequenceFromChoice(XmlSchemaSequence derivedSequence, XmlSchemaChoice baseChoice)
 {
     decimal num;
     decimal num2;
     this.CalculateSequenceRange(derivedSequence, out num, out num2);
     if (!this.IsValidOccurrenceRangeRestriction(num, num2, baseChoice.MinOccurs, baseChoice.MaxOccurs) || (derivedSequence.Items.Count > baseChoice.Items.Count))
     {
         return false;
     }
     for (int i = 0; i < derivedSequence.Items.Count; i++)
     {
         if (this.GetMappingParticle((XmlSchemaParticle) derivedSequence.Items[i], baseChoice.Items) < 0)
         {
             return false;
         }
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:SchemaCollectionCompiler.cs


示例11: CannonicalizeAll

 private XmlSchemaParticle CannonicalizeAll(XmlSchemaAll all, bool root, bool substitution)
 {
     if (all.Items.Count > 0)
     {
         XmlSchemaAll all2 = new XmlSchemaAll {
             MinOccurs = all.MinOccurs,
             MaxOccurs = all.MaxOccurs,
             SourceUri = all.SourceUri,
             LineNumber = all.LineNumber,
             LinePosition = all.LinePosition
         };
         for (int i = 0; i < all.Items.Count; i++)
         {
             XmlSchemaParticle item = this.CannonicalizeParticle((XmlSchemaElement) all.Items[i], false, substitution);
             if (item != XmlSchemaParticle.Empty)
             {
                 all2.Items.Add(item);
             }
         }
         all = all2;
     }
     if (all.Items.Count == 0)
     {
         return XmlSchemaParticle.Empty;
     }
     if (root && (all.Items.Count == 1))
     {
         XmlSchemaSequence sequence = new XmlSchemaSequence {
             MinOccurs = all.MinOccurs,
             MaxOccurs = all.MaxOccurs
         };
         sequence.Items.Add((XmlSchemaParticle) all.Items[0]);
         return sequence;
     }
     if ((!root && (all.Items.Count == 1)) && ((all.MinOccurs == 1M) && (all.MaxOccurs == 1M)))
     {
         return (XmlSchemaParticle) all.Items[0];
     }
     if (!root)
     {
         base.SendValidationEvent("Sch_NotAllAlone", all);
         return XmlSchemaParticle.Empty;
     }
     return all;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:45,代码来源:SchemaCollectionCompiler.cs


示例12: 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 != null) && (redefined.ElementDecl != null)) && (redefined.ContentType == XmlSchemaContentType.TextOnly))
     {
         base.SendValidationEvent("Sch_NotComplexContent", complexType);
     }
     else
     {
         complexType.SetBaseSchemaType(redefined);
         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, 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, false));
             }
             else
             {
                 complexType.SetContentTypeParticle(contentTypeParticle);
             }
             XmlSchemaContentType contentType = this.GetSchemaContentType(complexType, complexContent, item);
             if (contentType == XmlSchemaContentType.Empty)
             {
                 contentType = redefined.ContentType;
             }
             complexType.SetContentType(contentType);
             if (complexType.ContentType != redefined.ContentType)
             {
                 base.SendValidationEvent("Sch_DifContentType", complexType);
             }
         }
         else
         {
             complexType.SetContentTypeParticle(item);
             complexType.SetContentType(this.GetSchemaContentType(complexType, complexContent, complexType.ContentTypeParticle));
         }
         complexType.SetDerivedBy(XmlSchemaDerivationMethod.Extension);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:63,代码来源:SchemaCollectionCompiler.cs


示例13: IsSequenceFromAll

 private bool IsSequenceFromAll(XmlSchemaSequence derivedSequence, XmlSchemaAll baseAll) {
     if (!IsValidOccurrenceRangeRestriction(derivedSequence, baseAll) || derivedSequence.Items.Count > baseAll.Items.Count) {
         return false;
     }
     BitSet map = new BitSet(baseAll.Items.Count);
     for (int j = 0; j < derivedSequence.Items.Count; ++j) {
         int i = GetMappingParticle((XmlSchemaParticle)derivedSequence.Items[j], baseAll.Items);
         if (i >= 0) {
             if (map[i]) {
                 return false;
             }
             else {
                 map.Set(i);
             }
         }
         else {
             return false;
         }
     }
     for (int i = 0; i < baseAll.Items.Count; i++) {
         if (!map[i] && !IsParticleEmptiable((XmlSchemaParticle)baseAll.Items[i])) {
             return false;
         }
     }
     return true;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:SchemaSetCompiler.cs


示例14: IsElementFromGroupBase

 private bool IsElementFromGroupBase(XmlSchemaElement derivedElement, XmlSchemaGroupBase baseGroupBase) {
     if (baseGroupBase is XmlSchemaSequence) {
         XmlSchemaSequence virtualSeq = new XmlSchemaSequence();
         virtualSeq.MinOccurs = 1;
         virtualSeq.MaxOccurs = 1;
         virtualSeq.Items.Add(derivedElement);
         if (IsGroupBaseFromGroupBase((XmlSchemaGroupBase)virtualSeq, baseGroupBase, true)) {
             return true;
         }
         restrictionErrorMsg = Res.GetString(Res.Sch_ElementFromGroupBase1, derivedElement.QualifiedName.ToString(), derivedElement.LineNumber.ToString(NumberFormatInfo.InvariantInfo), derivedElement.LinePosition.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LineNumber.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LinePosition.ToString(NumberFormatInfo.InvariantInfo));
     }
     else if (baseGroupBase is XmlSchemaChoice) {
         XmlSchemaChoice virtualChoice = new XmlSchemaChoice();
         virtualChoice.MinOccurs = 1;
         virtualChoice.MaxOccurs = 1;
         virtualChoice.Items.Add(derivedElement);
         if (IsGroupBaseFromGroupBase((XmlSchemaGroupBase)virtualChoice, baseGroupBase, false)) {
             return true;
         }
         restrictionErrorMsg = Res.GetString(Res.Sch_ElementFromGroupBase2, derivedElement.QualifiedName.ToString(), derivedElement.LineNumber.ToString(NumberFormatInfo.InvariantInfo), derivedElement.LinePosition.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LineNumber.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LinePosition.ToString(NumberFormatInfo.InvariantInfo));
     }
     else if (baseGroupBase is XmlSchemaAll) {
         XmlSchemaAll virtualAll = new XmlSchemaAll();
         virtualAll.MinOccurs = 1;
         virtualAll.MaxOccurs = 1;
         virtualAll.Items.Add(derivedElement);
         if (IsGroupBaseFromGroupBase((XmlSchemaGroupBase)virtualAll, baseGroupBase, true)) {
             return true;
         }
         restrictionErrorMsg = Res.GetString(Res.Sch_ElementFromGroupBase3, derivedElement.QualifiedName.ToString(), derivedElement.LineNumber.ToString(NumberFormatInfo.InvariantInfo), derivedElement.LinePosition.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LineNumber.ToString(NumberFormatInfo.InvariantInfo), baseGroupBase.LinePosition.ToString(NumberFormatInfo.InvariantInfo));
     }
     return false;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:33,代码来源:SchemaSetCompiler.cs


示例15: ImportMembersMapping

        /// <include file='doc\SoapSchemaImporter.uex' path='docs/doc[@for="SoapSchemaImporter.ImportMembersMapping3"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public XmlMembersMapping ImportMembersMapping(string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement, Type baseType, bool baseTypeCanBeIndirect) {
            XmlSchemaComplexType type = new XmlSchemaComplexType();
            XmlSchemaSequence seq = new XmlSchemaSequence();
            type.Particle = seq;
            foreach (SoapSchemaMember member in members) {
                XmlSchemaElement element = new XmlSchemaElement();
                element.Name = member.MemberName;
                element.SchemaTypeName = member.MemberType;
                seq.Items.Add(element);
            }

            CodeIdentifiers identifiers = new CodeIdentifiers();
            identifiers.UseCamelCasing = true;
            MembersMapping mapping = new MembersMapping();
            mapping.TypeDesc = Scope.GetTypeDesc(typeof(object[]));
            mapping.Members = ImportTypeMembers(type, ns, identifiers);
            mapping.HasWrapperElement = hasWrapperElement;
            
            if (baseType != null) {
                for (int i = 0; i < mapping.Members.Length; i++) {
                    MemberMapping member = mapping.Members[i];
                    if (member.Accessor.Mapping is StructMapping)
                        MakeDerived((StructMapping)member.Accessor.Mapping, baseType, baseTypeCanBeIndirect);
                }
            }
            ElementAccessor accessor = new ElementAccessor();
            accessor.IsSoap = true;
            accessor.Name = name;
            accessor.Namespace = ns;
            accessor.Mapping = mapping;
            accessor.IsNullable = false;
            accessor.Form = XmlSchemaForm.Qualified;

            return new XmlMembersMapping(Scope, accessor, XmlMappingAccess.Read | XmlMappingAccess.Write);
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:39,代码来源:soapschemaimporter.cs


示例16: Write54_XmlSchemaSequence

 void Write54_XmlSchemaSequence(XmlSchemaSequence o) {
     if ((object)o == null) return;
     WriteStartElement("sequence");
     
     WriteAttribute(@"id", @"", ((System.String)[email protected]));
     WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
     WriteAttribute("maxOccurs", "", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
     WriteAttributes((XmlAttribute[])[email protected], o);
     Write5_XmlSchemaAnnotation((XmlSchemaAnnotation)[email protected]);
     XmlSchemaObjectCollection a = (XmlSchemaObjectCollection)[email protected];
     if (a != null) {
         for (int ia = 0; ia < a.Count; ia++) {
             XmlSchemaObject ai = (XmlSchemaObject)a[ia];
             if (ai is XmlSchemaAny) {
                 Write53_XmlSchemaAny((XmlSchemaAny)ai);
             }
             else if (ai is XmlSchemaSequence) {
                 Write54_XmlSchemaSequence((XmlSchemaSequence)ai);
             }
             else if (ai is XmlSchemaChoice) {
                 Write52_XmlSchemaChoice((XmlSchemaChoice)ai);
             }
             else if (ai is XmlSchemaElement) {
                 Write46_XmlSchemaElement((XmlSchemaElement)ai);
             }
             else if (ai is XmlSchemaGroupRef) {
                 Write55_XmlSchemaGroupRef((XmlSchemaGroupRef)ai);
             }
         }
     }
     WriteEndElement();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:32,代码来源:SchemaObjectWriter.cs


示例17: IsSequenceFromChoice

 private bool IsSequenceFromChoice(XmlSchemaSequence derivedSequence, XmlSchemaChoice baseChoice) {
     decimal minOccurs, maxOccurs;
     minOccurs = derivedSequence.MinOccurs * derivedSequence.Items.Count;
     if (derivedSequence.MaxOccurs == decimal.MaxValue) {
         maxOccurs = decimal.MaxValue;
     }
     else {
         maxOccurs = derivedSequence.MaxOccurs * derivedSequence.Items.Count;
     }
     if (!IsValidOccurrenceRangeRestriction(minOccurs, maxOccurs, baseChoice.MinOccurs, baseChoice.MaxOccurs) || derivedSequence.Items.Count > baseChoice.Items.Count) {
         return false;
     }
     for (int i = 0; i < derivedSequence.Items.Count; ++i) {
         if (GetMappingParticle((XmlSchemaParticle)derivedSequence.Items[i], baseChoice.Items) < 0)
             return false;
     }
     return true;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:18,代码来源:SchemaSetCompiler.cs


示例18: CalculateSequenceRange

 private void CalculateSequenceRange(XmlSchemaSequence sequence, out decimal minOccurs, out decimal maxOccurs)
 {
     minOccurs = 0M;
     maxOccurs = 0M;
     for (int i = 0; i < sequence.Items.Count; i++)
     {
         XmlSchemaParticle particle = (XmlSchemaParticle) sequence.Items[i];
         minOccurs += particle.MinOccurs;
         if (particle.MaxOccurs == 79228162514264337593543950335M)
         {
             maxOccurs = 79228162514264337593543950335M;
         }
         else if (maxOccurs != 79228162514264337593543950335M)
         {
             maxOccurs += particle.MaxOccurs;
         }
     }
     minOccurs *= sequence.MinOccurs;
     if (sequence.MaxOccurs == 79228162514264337593543950335M)
     {
         maxOccurs = 79228162514264337593543950335M;
     }
     else if (maxOccurs != 79228162514264337593543950335M)
     {
         maxOccurs *= sequence.MaxOccurs;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:SchemaCollectionCompiler.cs


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


示例20: IsSequenceFromAll

 private bool IsSequenceFromAll(XmlSchemaSequence derivedSequence, XmlSchemaAll baseAll)
 {
     if (!this.IsValidOccurrenceRangeRestriction(derivedSequence, baseAll) || (derivedSequence.Items.Count > baseAll.Items.Count))
     {
         return false;
     }
     BitSet set = new BitSet(baseAll.Items.Count);
     for (int i = 0; i < derivedSequence.Items.Count; i++)
     {
         int mappingParticle = this.GetMappingParticle((XmlSchemaParticle) derivedSequence.Items[i], baseAll.Items);
         if (mappingParticle < 0)
         {
             return false;
         }
         if (set[mappingParticle])
         {
             return false;
         }
         set.Set(mappingParticle);
     }
     for (int j = 0; j < baseAll.Items.Count; j++)
     {
         if (!set[j] && !this.IsParticleEmptiable((XmlSchemaParticle) baseAll.Items[j]))
         {
             return false;
         }
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:SchemaCollectionCompiler.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Schema.XmlSchemaSet类代码示例发布时间:2022-05-26
下一篇:
C# Schema.XmlSchemaParticle类代码示例发布时间: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