posted 14 years ago
When I try to validate the following schema in Altova XML Spy, it gives me validation error. The idea is - either [customerId & shipTo should be provided] or [orderdetails and billto should be provided]. But the XML instance can also provide the other elements optionally. So, a particular XML instance may have all the 4 elements -> cusotmerId, orderdetails, billto & shipto.
Any reason why is the schema not validating and what is the resolution?
Error
------
The schema doesn't appear to be valid by itself (as a part of another schema, it might still be OK).
'<xs:element name='customerId'>' makes the content model non-deterministic against '<xs:element name='customerId'>'. Possible causes: name equality, overlapping occurrence or substitution groups.
Error location: xs:schema / xs:complexType / xs:choice / xs:sequence / xs:element
Details
cos-nonambig: '<xs:element name='customerId'>' makes the content model non-deterministic against '<xs:element name='customerId'>'. Possible causes: name equality, overlapping occurrence or substitution groups.
--> 1 solution I had is define seprate elements for each of the choice group and declare it under ordertype. But this introduces a new element under "order". But this impacts the client code, if somebody has programmed according to the order of xml elements.
Any other way to have the xml structure as - no impact on client code with change in a valid schema
Thanks.