Validating xs:nonNegativeInteger in schema 1.0 with oXygen

This should cover W3C XML Schema, Relax NG and DTD related problems.
mhGLEIF
Posts: 40

Validating xs:nonNegativeInteger in schema 1.0 with oXygen

Fri Nov 25, 2016 1:25 pm

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>
adrian
Posts: 2326

Re: Validating xs:nonNegativeInteger in schema 1.0 with oXygen

Fri Nov 25, 2016 6:15 pm

Hi,

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

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 0 guests