Skip to main content
XMLDir

Search 261 pages — tools, formats, elements, namespaces, XPath, datatypes, glossary, parse errors, schema errors, use cases, blog and product.

XSD datatype

xs:positiveInteger

An integer of 1 or more. Zero is not positive, which is the distinction from xs:nonNegativeInteger.

xs:positiveInteger has minInclusive fixed at 1; xs:nonNegativeInteger has it at 0. The difference is exactly whether zero is allowed, and choosing the wrong one is a common schema bug — a quantity of 0 is usually meaningful, a quantity of −1 is not.

Both are unbounded above, because both derive from xs:integer.

Lexical space
Optional plus sign, then digits, with a value of 1 or greater.
Derives from
xs:nonNegativeInteger
Category
Numeric types
Facets
minInclusive, maxInclusive, minExclusive, maxExclusive, pattern, enumeration, whiteSpace, totalDigits, fractionDigits

What validates

Every literal below is put through the schema validator on each test run, against the schema at the foot of this page.

  • 1
  • +1
  • 999999999999999999999

What does not

  • 0

    Zero is not positive.

  • -1

    Negative values are excluded.

  • 1.0

    No decimal point.

What catches people out

  • Zero fails. If a count of zero is legitimate, xs:nonNegativeInteger is the type you meant.
  • Still unbounded above — 'positive' constrains only the lower end.

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.