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:integer

A whole number of unlimited size. It derives from xs:decimal, not from a machine int — so it has no range at all.

xs:integer is xs:decimal with fractionDigits fixed at 0. That derivation is the surprise: it inherits arbitrary precision, so there is no upper or lower bound. A 50-digit integer is valid.

If you need a bounded value, the derived types xs:int, xs:long, xs:short and xs:byte carry the ranges their names imply.

Lexical space
Optional sign, then one or more digits. No decimal point.
Derives from
xs:decimal
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.

  • 42
  • -7
  • +0
  • 12345678901234567890123456789012345678901234567890

What does not

  • 3.0

    A decimal point is not allowed, even when the value is whole.

  • 1e3

    No exponent notation.

  • 0x1F

    Only decimal digits.

What catches people out

  • Unbounded. xs:integer will happily validate a number no 64-bit type can hold, and the failure will happen in your code rather than in validation.
  • '3.0' is not an xs:integer even though it is a whole number. The lexical form matters, not just the value.
  • For a bounded field use xs:int (32-bit) or xs:long (64-bit) and let validation catch overflow.

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.