XSD datatype
xs: nonNegativeInteger
An integer of 0 or more, and the right type for counts where zero is a real answer. '-0' validates too, because its value is zero.
xs:nonNegativeInteger allows zero and everything above it. It is the type for quantities, counts and sizes, where zero is a legitimate value rather than an error.
xs:unsignedInt and friends are the bounded versions; this one is unbounded.
- Lexical space
- Optional plus sign, then digits, with a value of 0 or greater.
- Derives from
xs:integer- Category
- Numeric types
- Facets
- minInclusive, maxInclusive, minExclusive, maxExclusive, pattern, enumeration, whiteSpace, totalDigits, fractionDigits
The schema used
This is the exact schema the literals above are validated against. Paste it into the validator with one of them to see the result yourself.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="v" type="xs:nonNegativeInteger"/>
</xs:schema>Related
- xs:positiveIntegerAn integer of 1 or more. Zero is not positive, which is the whole distinction from xs:nonNegativeInteger — and it is still unbounded above.
- xs:integerA whole number of unlimited size. It derives from xs:decimal, not from a machine int — so it has no range at all.
- xs:unsignedIntAn unsigned 32-bit integer: 0 to 4,294,967,295. The maximum is roughly four billion, not two — which is the point of the unsigned range.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.