GetExpectedParticles() when sibling has 'maxOccurs=unbounded' goes into a loop

kralking

New Member
Suppose I have this XmlSchema fragment:\[code\]<xs:element name= "A"> <xs:complexType> <xs:sequence> <xs:element ref="A1" maxOccurs="1"/> <xs:element ref="A2" maxOccurs="unbounded"/> <xs:element ref="A3" maxOccurs="1"/> </xs:sequence> </xs:complexType></xs:element>\[/code\]I use the XmlSchemaValidator.GetExpectedParticles() method to cycle into A's children. Because the complexType is a Sequence, to validate a sibling I need to validate the previous one, exit from the context and only then the GetExpectedPartciles() will return the next sibling. So when I am in A1 item of the list, I call these line of code:\[code\]validator.ValidateElement("A1", null, null); --> validate and enter in the Context of A1validator.ValidateEndOfAttributes(null); --> End the validation of Attributesvalidator.SkipToEndElement(null); --> Exit from the context; only when the ComplexType is a Sequence\[/code\]When I reach the A2 element, the GetExpetectedParticles returns, as in a loop, the same Element A2 and I cannot reach the A3 element (or I do not know how to do). I suppose this is because the maxoccurs is unbounded.So the question is How can I jump to the next sibling A3?
 
Back
Top