XSD: What is the difference between xs:integer and xs:int?

xsd
Michael picture Michael · Mar 11, 2013 · Viewed 95.5k times · Source

I have started to create XSD and found in couple of examples for xs:integer and xs:int.

What is the difference between xs:integer and xs:int? When I should use xs:integer? When I should use xs:int?

Answer

Michael picture Michael · Mar 11, 2013

The difference is the following: xs:int is a signed 32-bit integer. xs:integer is an integer unbounded value. See for details https://web.archive.org/web/20151117073716/http://www.w3schools.com/schema/schema_dtypes_numeric.asp For example, XJC (Java) generates Integer for xs:int and BigInteger for xs:integer.

The bottom line: use xs:int if you want to work cross platforms and be sure that your numbers will pass without a problem. If you want bigger numbers – use xs:long instead of xs:integer (it will be generated to Long).