AddPlus() public méthode

public AddPlus ( ) : void
Résultat void
 private void BuildParticleContentModel(ParticleContentValidator contentValidator, XmlSchemaParticle particle)
 {
     if (particle is XmlSchemaElement)
     {
         XmlSchemaElement element = (XmlSchemaElement) particle;
         contentValidator.AddName(element.QualifiedName, element);
     }
     else if (particle is XmlSchemaAny)
     {
         XmlSchemaAny any = (XmlSchemaAny) particle;
         contentValidator.AddNamespaceList(any.NamespaceList, any);
     }
     else if (particle is XmlSchemaGroupBase)
     {
         XmlSchemaObjectCollection items = ((XmlSchemaGroupBase) particle).Items;
         bool flag = particle is XmlSchemaChoice;
         contentValidator.OpenGroup();
         bool flag2 = true;
         for (int i = 0; i < items.Count; i++)
         {
             XmlSchemaParticle particle2 = (XmlSchemaParticle) items[i];
             if (flag2)
             {
                 flag2 = false;
             }
             else if (flag)
             {
                 contentValidator.AddChoice();
             }
             else
             {
                 contentValidator.AddSequence();
             }
             this.BuildParticleContentModel(contentValidator, particle2);
         }
         contentValidator.CloseGroup();
     }
     if ((particle.MinOccurs != 1M) || (particle.MaxOccurs != 1M))
     {
         if ((particle.MinOccurs == 0M) && (particle.MaxOccurs == 1M))
         {
             contentValidator.AddQMark();
         }
         else if ((particle.MinOccurs == 0M) && (particle.MaxOccurs == 79228162514264337593543950335M))
         {
             contentValidator.AddStar();
         }
         else if ((particle.MinOccurs == 1M) && (particle.MaxOccurs == 79228162514264337593543950335M))
         {
             contentValidator.AddPlus();
         }
         else
         {
             contentValidator.AddLeafRange(particle.MinOccurs, particle.MaxOccurs);
         }
     }
 }
Exemple #2
0
 private void ParseHowMany(ParticleContentValidator pcv)
 {
     switch (GetToken(false))
     {
         case Token.Star:
             pcv.AddStar();
             return;
         case Token.QMark:
             pcv.AddQMark();
             return;
         case Token.Plus:
             pcv.AddPlus();
             return;
         default:
             return;
     }
 }
Exemple #3
0
 private static void HandleMinMax(ParticleContentValidator pContent, uint cMin, uint cMax)
 {
     if (pContent != null)
     {
         if (cMax == uint.MaxValue)
         {
             if (cMin == 0)
                 pContent.AddStar();           // minOccurs="0" and maxOccurs="infinite"
             else
                 pContent.AddPlus();           // minOccurs="1" and maxOccurs="infinite"
         }
         else if (cMin == 0)
         {                 // minOccurs="0" and maxOccurs="1")
             pContent.AddQMark();
         }
     }
 }
 private bool BuildParticleContentModel(ParticleContentValidator contentValidator, XmlSchemaParticle particle) {
     bool hasWildCard = false;
     if (particle is XmlSchemaElement) {
         XmlSchemaElement element = (XmlSchemaElement)particle;
         contentValidator.AddName(element.QualifiedName, element);       
      }
     else if (particle is XmlSchemaAny) {
         hasWildCard = true;
         XmlSchemaAny any = (XmlSchemaAny)particle;
         contentValidator.AddNamespaceList(any.NamespaceList, any);
     }
     else if (particle is XmlSchemaGroupBase) {
         XmlSchemaObjectCollection particles = ((XmlSchemaGroupBase)particle).Items;
         bool isChoice = particle is XmlSchemaChoice;
         contentValidator.OpenGroup();
         bool first = true;
         for (int i = 0; i < particles.Count; ++i) {
             Debug.Assert(!((XmlSchemaParticle)particles[i]).IsEmpty);
             if (first) {
                 first = false;
             }
             else if (isChoice) {
                 contentValidator.AddChoice();  
             }
             else {
                 contentValidator.AddSequence();
             }
             hasWildCard = BuildParticleContentModel(contentValidator, (XmlSchemaParticle)particles[i]);
         }
         contentValidator.CloseGroup();
     }
     else {
         Debug.Assert(false);
     }
     if (particle.MinOccurs == decimal.One && particle.MaxOccurs == decimal.One) {
         // nothing
     }
     else if (particle.MinOccurs == decimal.Zero && particle.MaxOccurs == decimal.One) {
         contentValidator.AddQMark();
     }
     else if (particle.MinOccurs == decimal.Zero && particle.MaxOccurs == decimal.MaxValue) {
         contentValidator.AddStar();
     }
     else if (particle.MinOccurs == decimal.One && particle.MaxOccurs == decimal.MaxValue) {
         contentValidator.AddPlus();
     }
     else {
         contentValidator.AddLeafRange(particle.MinOccurs, particle.MaxOccurs);
     }
     return hasWildCard;
 }
 private async Task ParseHowManyAsync( ParticleContentValidator pcv ) {
     switch ( await GetTokenAsync( false ).ConfigureAwait(false) ) {
         case Token.Star:
             pcv.AddStar();
             return;
         case Token.QMark:
             pcv.AddQMark();
             return;
         case Token.Plus:
             pcv.AddPlus();
             return;
         default:
             return;
     }
 }
 private static void HandleMinMax(ParticleContentValidator pContent, uint cMin, uint cMax)
 {
     if (pContent != null)
     {
         if (cMax == uint.MaxValue)
         {
             if (cMin == 0)
             {
                 pContent.AddStar();
             }
             else
             {
                 pContent.AddPlus();
             }
         }
         else if (cMin == 0)
         {
             pContent.AddQMark();
         }
     }
 }
 private void BuildParticleContentModel(ParticleContentValidator contentValidator, XmlSchemaParticle particle) {
     if (particle is XmlSchemaElement) {
         XmlSchemaElement element = (XmlSchemaElement)particle;
         contentValidator.AddName(element.QualifiedName, element);       
     }
     else if (particle is XmlSchemaAny) {
         XmlSchemaAny any = (XmlSchemaAny)particle;
         contentValidator.AddNamespaceList(any.NamespaceList, any);
     }
     else if (particle is XmlSchemaGroupBase) {
         XmlSchemaObjectCollection particles = ((XmlSchemaGroupBase)particle).Items;
         bool isChoice = particle is XmlSchemaChoice;
         contentValidator.OpenGroup();
         bool first = true;
         foreach (XmlSchemaParticle p in particles) {
             Debug.Assert(!p.IsEmpty);
             if (first) {
                 first = false;
             }
             else if (isChoice) {
                 contentValidator.AddChoice();  
             }
             else {
                 contentValidator.AddSequence();
             }
             BuildParticleContentModel(contentValidator, p);
         }
         contentValidator.CloseGroup();
     }
     else {
         Debug.Assert(false);
     }
     if (particle.MinOccurs == decimal.One && particle.MaxOccurs == decimal.One) {
         // nothing
     }
     else if (particle.MinOccurs == decimal.Zero && particle.MaxOccurs == decimal.One) {
         contentValidator.AddQMark();
     }
     else if (particle.MinOccurs == decimal.Zero && particle.MaxOccurs == decimal.MaxValue) {
         contentValidator.AddStar();
     }
     else if (particle.MinOccurs == decimal.One && particle.MaxOccurs == decimal.MaxValue) {
         contentValidator.AddPlus();
     }
     else {
         contentValidator.AddLeafRange(particle.MinOccurs, particle.MaxOccurs);
     }
 }