Hello,
I'm wondering if it's possible to validate 1 XML value against another?
For example, I have a list of genres and sub-genres in an XML feed and based on the specified genre in the XML I want to validate it against a list of allowable sub-genre values for that genre.
Code:
<myfeed genre="fruit" subgenre="apples" />
<myfeed genre="animals" subgenre="tiger" />
I want the schema to first see the genre of "fruit" or "animals" and based on which one was selected validate it against different xsd:enumeration blocks.
So, if fruit was selected as the genre, a list of allowable sub-genres would be...
Code:
<xsd:restriction base="xsd:string">
<xsd:enumeration value="apples" />
<xsd:enumeration value="oranges" />
<xsd:enumeration value="bananas" />
</xsd:restriction>
And if animals was selected as the genre, a list of allowable sub-genres would be...
Code:
<xsd:restriction base="xsd:string">
<xsd:enumeration value="tiger" />
<xsd:enumeration value="monkey" />
<xsd:enumeration value="panda" />
</xsd:restriction>