How to describe math formula by using xsd?
-
14-11-2019 - |
Question
i"m trying to validate if an xml element is a multiply of 5 by using xsd. does any 1 have an idea how to do it ?
Thanks,
Itay
Solution
I'm pretty sure you can't use general formula for validation. But in your specific case you can use a pattern match to match multiples of 5
<xs:element name="myelement">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]*[05]{1}"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:element>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow