XSD facet
fractionDigits and totalDigits
Decimal precision limits, counted on the value rather than the literal — so trailing zeros do not count.
fractionDigits caps the number of digits after the decimal point; totalDigits caps the number of significant digits overall. Both are measured on the value, not on how it was written.
That means '1.50' has one fraction digit, because the trailing zero is not significant. A schema with fractionDigits 1 accepts it.
- Lexical space
- A non-negative integer.
- Derives from
- Primitive type
- Category
- Constraining facets
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:simpleType name="t"><xs:restriction base="xs:decimal"><xs:fractionDigits value="2"/><xs:totalDigits value="6"/></xs:restriction></xs:simpleType>
<xs:element name="v" type="t"/>
</xs:schema>Related
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.