XML technologies / XML Schema / XML Schema element reference / xs:totalDigits

(Excerpt from “XML Schema” by Eric van der Vlist)

Facet specifying the total digit count of a numeric data type.

<xs:totalDigits
    fixed = xs:boolean : "false"
    id = xs:ID
    value = xs:positiveInteger
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: (xs:annotation?)
</xs:totalDigits>

May occur within: xs:restriction (simple type), xs:restriction (simple content)

May be used as a facet for: xs:byte, xs:decimal, xs:int, xs:integer, xs:long, xs:negativeInteger, xs:nonNegativeInteger, xs:nonPositiveInteger, xs:positiveInteger, xs:short, xs:unsignedByte, xs:unsignedInt, xs:unsignedLong, xs:unsignedShort

Description

xs:totalDigits specifies the maximum digit count for data type decimal and derived types, before and after the decimal point, excluding the point itself.

This facet restricts the value space: digits are counted after conversion to canonical form and removal of leading and trailing zeros.

Restrictions

It is also possible to use xs:pattern to restrict the total digit count in the lexical space.

Within a restriction step, an interaction exists between xs:totalDigits and xs:fractionDigits, since inconsistent values produce data types with empty value spaces.

xs:totalDigits must restrict its base type’s value space. The value must be smaller than the base type’s xs:totalDigits value, if defined.

Example

<xs:simpleType name="totalDigits">
    <xs:restriction base="xs:integer">
        <xs:totalDigits value="5"/>
    </xs:restriction>
</xs:simpleType>

Attributes

fixed
If the value is true, the facet’s value cannot be changed during further restriction.

id
Element ID according to W3C XML Schema.

value
Facet value.

   

 

 

 

back to top