Xml Schema for repeating sequence of elements

Jhonson

New Member
I have xml as follows \[code\]<Search> <Term /> <And /> <Term /> <And /> <Term /></Search>\[/code\]There can be n number of Terms and n-1 Ands (n > 0) in the sequence as shown. I tried the following xml schema but above xml would not get validated against the schema. Error: cvc-complex-type.2.4.b: The content of element 'Search' is not complete. One of '{And}' is expected.\[code\]<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="Search"> <xs:complexType> <xs:sequence> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="Term" type="xs:string" /> <xs:element name="And" type="xs:string" /> </xs:sequence> <xs:element name="Term" minOccurs="1" maxOccurs="1" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element></xs:schema>\[/code\]Appreciate any help with the xml schema.
 
Back
Top