Reputation: 177
I have an element in my XML file that can have the value of either decimal or date. In the XML schema for validation, I have specified it as:
<xs:element name = "data" type="xs:decimal"/>
or I can specify it as type="xs:date"
.
This only validates it as date or decimal. Is there another datatype or something that will allow me to validate this element regardless of whether it has a date or decimal value?
Upvotes: 3
Views: 1846
Reputation: 78134
<xs:element name="data">
<xs:simpleType>
<xs:union memberTypes="xs:date xs:decimal" />
</xs:simpleType>
</xs:element>
Upvotes: 6