I am getting error validating with this XML:
<xs:simpleType name="XYZ">
<xs:restriction base="xs:nonNegativeInteger">
<xs:enumeration value="1">
</xs:enumeration>
<xs:enumeration value="2">
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
XML value :
<XYZ>2</XYZ>
cvc-enumeration-valid: Value '2' is not facet-valid with respect to enumeration '[1]'. It must be a value from the enumeration.
Can anyone please help me to understand the problem? How to resolve it ?
The error message,
cvc-enumeration-valid: Value '2' is not facet-valid with respect to enumeration '[1]'. It must be a value from the enumeration.
and the simpleType
from your question do not agree.
The error message implies that only 1
is allowed yet 2
was encountered; your type definition does indeed allow both 1
and 2
.
To elicit an actual error message pertaining to your xs:simpleType
, your XML would have to use a value, say 3
, not allowed. Then, you would receive an error message like this:
cvc-enumeration-valid: Value '3' is not facet-valid with respect to enumeration '[1, 2]'. It must be a value from the enumeration.
Therefore, your (first, maybe only?) mistake is in believing that the posted xs:simpleType
definition has anything to do with that error message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With