public override XsdValidationState EvaluateStartElement(string localName, string ns) { emptiableComputed = false; for (int i = 0; i < choice.CompiledItems.Count; i++) { XmlSchemaParticle xsobj = (XmlSchemaParticle)choice.CompiledItems [i]; XsdValidationState xa = Manager.Create(xsobj); XsdValidationState result = xa.EvaluateStartElement(localName, ns); if (result != XsdValidationState.Invalid) { OccuredInternal++; if (Occured > choice.ValidatedMaxOccurs) { return(XsdValidationState.Invalid); } else if (Occured == choice.ValidatedMaxOccurs) { return(result); } else { return(Manager.MakeSequence(result, this)); } } } emptiable = choice.ValidatedMinOccurs <= Occured; emptiableComputed = true; return(XsdValidationState.Invalid); }
public override XsdValidationState EvaluateStartElement(string name, string ns) { XsdValidationState afterHead = head.EvaluateStartElement(name, ns); if (afterHead != XsdValidationState.Invalid) { head = afterHead; return(afterHead is XsdEmptyValidationState ? rest : this); } else if (!head.EvaluateIsEmptiable()) { return(XsdValidationState.Invalid); } return(rest.EvaluateStartElement(name, ns)); }
public override XsdValidationState EvaluateStartElement(string localName, string ns) { this.emptiableComputed = false; bool flag = true; int i = 0; while (i < this.choice.CompiledItems.Count) { XmlSchemaParticle xsobj = (XmlSchemaParticle)this.choice.CompiledItems[i]; XsdValidationState xsdValidationState = base.Manager.Create(xsobj); XsdValidationState xsdValidationState2 = xsdValidationState.EvaluateStartElement(localName, ns); if (xsdValidationState2 != XsdValidationState.Invalid) { base.OccuredInternal++; if (base.Occured > this.choice.ValidatedMaxOccurs) { return(XsdValidationState.Invalid); } if (base.Occured == this.choice.ValidatedMaxOccurs) { return(xsdValidationState2); } return(base.Manager.MakeSequence(xsdValidationState2, this)); } else { if (!this.emptiableComputed) { flag &= xsdValidationState.EvaluateIsEmptiable(); } i++; } } if (!this.emptiableComputed) { if (flag) { this.emptiable = true; } if (!this.emptiable) { this.emptiable = (this.choice.ValidatedMinOccurs <= base.Occured); } this.emptiableComputed = true; } return(XsdValidationState.Invalid); }
public override XsdValidationState EvaluateStartElement(string name, string ns) { if (this.seq.CompiledItems.Count == 0) { return(XsdValidationState.Invalid); } int num = (this.current >= 0) ? this.current : 0; XsdValidationState xsdValidationState = this.currentAutomata; bool flag = false; XsdValidationState xsdValidationState2; for (;;) { if (xsdValidationState == null) { xsdValidationState = base.Manager.Create(this.seq.CompiledItems[num] as XmlSchemaParticle); flag = true; } if (xsdValidationState is XsdEmptyValidationState && this.seq.CompiledItems.Count == num + 1 && base.Occured == this.seq.ValidatedMaxOccurs) { break; } xsdValidationState2 = xsdValidationState.EvaluateStartElement(name, ns); if (xsdValidationState2 != XsdValidationState.Invalid) { goto IL_E1; } if (!xsdValidationState.EvaluateIsEmptiable()) { goto Block_8; } num++; if (num > this.current && flag && this.current >= 0) { goto Block_13; } if (this.seq.CompiledItems.Count > num) { xsdValidationState = base.Manager.Create(this.seq.CompiledItems[num] as XmlSchemaParticle); } else { if (this.current < 0) { goto Block_15; } num = 0; xsdValidationState = null; } } return(XsdValidationState.Invalid); Block_8: this.emptiable = false; return(XsdValidationState.Invalid); IL_E1: this.current = num; this.currentAutomata = xsdValidationState2; if (flag) { base.OccuredInternal++; if (base.Occured > this.seq.ValidatedMaxOccurs) { return(XsdValidationState.Invalid); } } return(this); Block_13: return(XsdValidationState.Invalid); Block_15: return(XsdValidationState.Invalid); }
public override XsdValidationState EvaluateStartElement(string name, string ns) { if (seq.CompiledItems.Count == 0) { return(XsdValidationState.Invalid); } int idx = current < 0 ? 0 : current; XsdValidationState xa = currentAutomata; // If it is true and when matching particle was found, then // it will increment occurence. bool increment = false; while (true) { // if (current < 0 || current == seq.CompiledItems.Count) { // idx = current = 0; // increment = true; // } if (xa == null) // This code runs in case of a newiteration. { xa = Manager.Create(seq.CompiledItems [idx] as XmlSchemaParticle); increment = true; } if (xa is XsdEmptyValidationState && seq.CompiledItems.Count == idx + 1 && Occured == seq.ValidatedMaxOccurs) { return(XsdValidationState.Invalid); } else { XsdValidationState result = xa.EvaluateStartElement(name, ns); if (result == XsdValidationState.Invalid) { if (!xa.EvaluateIsEmptiable()) { emptiable = false; return(XsdValidationState.Invalid); } } else { current = idx; currentAutomata = result; if (increment) { OccuredInternal++; if (Occured > seq.ValidatedMaxOccurs) { return(XsdValidationState.Invalid); } } // current++; // return Manager.MakeSequence (result, this); return(this); // skip in other cases. } } idx++; if (idx > current && increment && current >= 0) { return(XsdValidationState.Invalid); } if (seq.CompiledItems.Count > idx) { xa = Manager.Create(seq.CompiledItems [idx] as XmlSchemaParticle); } else if (current < 0) // started from top { return(XsdValidationState.Invalid); } else // started from middle { idx = 0; xa = null; } } }