Page 1 of 1

Validating xs:nonNegativeInteger in schema 1.0 with oXygen

Posted: Fri Nov 25, 2016 1:25 pm
by mhGLEIF
One last validation question for this week:

I'm trying to validate an instance containing

Code: Select all

<RecordCount>-78</RecordCount>
against the XML Schema 1.0 spec containing

Code: Select all

<xs:element name="RecordCount" type="xs:nonNegativeInteger">
<xs:annotation>
<xs:documentation>The number of data records in the file. Can be a positive whole (integer) number, or zero (0).</xs:documentation>
</xs:annotation>
</xs:element>
but oXygen is not giving me a validation error for the - even though it gives correct validation errors for non-numbers, empty or decimal points.

Am I indicating the negative integer wrongly in the test data? Have I defined the content type wrongly?

I also tried to define this based off of xs:int as below but again this didn't give an error for -78 etc.

Code: Select all

<xs:simpleType name="CountType">
<xs:annotation>
<xs:documentation>A count must be a whole number, equal to zero or more.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:int">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>

Re: Validating xs:nonNegativeInteger in schema 1.0 with oXygen

Posted: Fri Nov 25, 2016 6:15 pm
by adrian
Hi,

Both give me an error on -78 (they both work with 78). So it's something else, not the type declaration.

Regards,
Adrian