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

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

Facet specifying a numeric data type’s decimal places.

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

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

May be used as a facet for: xs:decimal

Description

xs:fractionDigits specifies the maximum decimal places, digits after the decimal point, for data type xs:decimal.

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

Restrictions

Within a restriction step, xs:fractionDigits depends on xs:totalDigits, since inconsistent values produce data types with empty value spaces.

xs:fractionDigits must restrict the base type’s value space, and the specified value must be smaller than the corresponding base-type value if defined.

If needed, xs:pattern can restrict decimal places in the lexical space.

Example

<xs:simpleType name="fractionDigits">
    <xs:restriction base="xs:decimal">
        <xs:fractionDigits value="2"/>
    </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