System.Xml.Schema.XsdBuilder.AddParticle C# (CSharp) Méthode

AddParticle() private méthode

private AddParticle ( XmlSchemaParticle particle ) : void
particle XmlSchemaParticle
Résultat void
        private void AddParticle(XmlSchemaParticle particle)
        {
            switch (this.ParentElement)
            {
                case SchemaNames.Token.XsdComplexType:
                    if ((_complexType.ContentModel != null) ||
                         (_complexType.Attributes.Count != 0 || _complexType.AnyAttribute != null) ||
                         (_complexType.Particle != null)
                         )
                    {
                        SendValidationEvent(SR.Sch_ComplexTypeContentModel, "complexType");
                    }
                    _complexType.Particle = particle;
                    break;
                case SchemaNames.Token.XsdComplexContentExtension:
                    if ((_complexContentExtension.Particle != null) ||
                         (_complexContentExtension.Attributes.Count != 0 || _complexContentExtension.AnyAttribute != null)
                       )
                    {
                        SendValidationEvent(SR.Sch_ComplexContentContentModel, "ComplexContentExtension");
                    }
                    _complexContentExtension.Particle = particle;
                    break;
                case SchemaNames.Token.XsdComplexContentRestriction:
                    if ((_complexContentRestriction.Particle != null) ||
                         (_complexContentRestriction.Attributes.Count != 0 || _complexContentRestriction.AnyAttribute != null)
                       )
                    {
                        SendValidationEvent(SR.Sch_ComplexContentContentModel, "ComplexContentExtension");
                    }
                    _complexContentRestriction.Particle = particle;
                    break;
                case SchemaNames.Token.XsdGroup:
                    if (_group.Particle != null)
                    {
                        SendValidationEvent(SR.Sch_DupGroupParticle, nameof(particle));
                    }
                    _group.Particle = (XmlSchemaGroupBase)particle;
                    break;
                case SchemaNames.Token.XsdChoice:
                case SchemaNames.Token.XsdSequence:
                    ((XmlSchemaGroupBase)this.ParentContainer).Items.Add(particle);
                    break;
                default:
                    Debug.Assert(false);
                    break;
            }
        }

Usage Example

Exemple #1
0
 /*
     <any 
       id = ID 
       maxOccurs = for maxOccurs : 1
       minOccurs = nonNegativeInteger : 1
       namespace = ##any | ##other | list of {uri, ##targetNamespace, ##local} : ##any
       processContents = skip | lax | strict : strict
       {any attributes with non-schema namespace . . .}>
       Content: (annotation?)
     </any>
 */
 private static void InitAny(XsdBuilder builder, string value) {
     builder.xso = builder.particle = builder.anyElement = new XmlSchemaAny();
     builder.AddParticle(builder.anyElement);
 } 
All Usage Examples Of System.Xml.Schema.XsdBuilder::AddParticle
XsdBuilder