sroberts82
Programmer
Hi,
Im currently looking at using XML Schemas to validate my code. Here is my problem. I want to validate by attribute so that if attribute is x i have 1 child element otherwise i have 2:
<element att="x">
<cap>a</cap>
<cap>b</cap>
</element>
<element att="y">
<cap>a</cap>
<cap>b</cap>
</element>
The only way i can see to it is to define 2 different elements x and y but that doesnt make sense it the context I am using as X and Y ARE attributes of my element and it makes the XML more complex which is not good for the user who has to write it. So my question is can I validate based on attribute? Thanks in advance,
Im currently looking at using XML Schemas to validate my code. Here is my problem. I want to validate by attribute so that if attribute is x i have 1 child element otherwise i have 2:
<element att="x">
<cap>a</cap>
<cap>b</cap>
</element>
<element att="y">
<cap>a</cap>
<cap>b</cap>
</element>
The only way i can see to it is to define 2 different elements x and y but that doesnt make sense it the context I am using as X and Y ARE attributes of my element and it makes the XML more complex which is not good for the user who has to write it. So my question is can I validate based on attribute? Thanks in advance,