I need to put conditional enforcement on xml attributes using xsd.
For example
<Database>
<Table Name="[Summary].[Aggregates]">
<Columns>
<Column Name="MyData" DataType="varbinary" Keys="Name,AddressLine1,AddressLine2,PostalCode,EmailAddress,Phone"></Column>
<Column Name="User"></Column>
</Columns>
</Table>
<Table Name="[Summary1].[Aggregates]">
<Columns>
<Column Name="MyData" DataType="varbinary" Keys="Name,AddressLine1,AddressLine2,PostalCode,EmailAddress,Phone"></Column>
<Column Name="User"></Column>
</Columns>
</Table>
<Database>
I need to create xsd which will enforce validations such like if Column element has Name= "MyData" and DataType="varbinary" then it must have another attribute with named as Keys with atleast one value as Key="Name" else no attribute for that column.
Is this possible using xsd?
I am able to do child validations on attributes How to make type depend on attribute value using Conditional Type Assignment