I have a problem with validation of the case that if attribute "brand" has value "x" then it is required to use attribute "model" otherwise attribute "model" should not be used.
XSD part which I am using for that is as below :
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name = "deviceList" type="deviceType"/>
<xs:complexType name="deviceType">
<xs:attribute name="brand" type="xs:string"/>
<xs:attribute name="model" type="xs:string" use="prohibited"/>
<xs:choice>
<xs:sequence>
<xs:attribute name="A" use="required" fixed="1"/>
<xs:attribute name="B" use="required"/>
</xs:sequence>
<xs:attribute name="A" use="required"/>
</xs:choice>
</xs:complexType>
</xs:schema>
When validating the result is : The content of 'variableType' is invalid. Element 'choice' is invalid, misplaced, or occurs too often.
To be fair I don't know why it is not validating properly ...
XML part which I am trying to validate:
<?xml version="1.1"?>
<!-- <deviceMappingFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="XSD file.xsd"> -->
<deviceList brand="x" model="yyy( model required if brand=x , if other not in use))"/>