BJtheGreat
New Member
I would like to define two elements in my XSD-file that can occure 'unbounded' many time, but they have to come always one after another. Example:XML-File:\[code\]<company/><address/><customer/><customerContact/><customer/><customerContact/><customer/><customerContact/>\[/code\]Now the problem is, that the following XSD definition\[code\]<xs:element name="company" type="companyType"/><xs:element name="address" type="addressType"/><xs:element name="customer" type="customerType" maxOccurs="unbounded"/><xs:element name="customerContact" type="customerContactType" maxOccurs="unbounded"/>\[/code\]is only working with XML files like\[code\]<company/><address/><customer/><customer/><customer/><customerContact/><customerContact/><customerContact/>\[/code\]where customer and customerContact do not alternate. I had the idea of defining an element which says customer or customerContact and allow repetition of that element. That would solve my problem, but it would also allow other solutions which should not be accepted as valid.I think the clean solution would be to have XML like\[code\]<company/><address/><customerEnvelope> <customer/> <customerContact/><customerEnvelope><customerEnvelope> <customer/> <customerContact/></customerEnvelope>\[/code\]and repeat customerEnvelope. Unfortunately the XML-structure is already given by my customer, so I am not able to make changes here.Is it possible to define this kind of structure with XSD, or would I need to use the above-mentioned work-around?