These qualifiers are used to customize the encoding format of numeric values (XSD
double, decimal, or float types). It is
sometimes necessary to have numbers formatted in a certain way (for example, a decimal
value format such as“+0012.00”). By default, all leading and trailing zeros are omitted,
as well as the positive sign, so the value above will be encoded as “12”. It is possible
using these qualifiers to specify the exact required format of such values. This can be
done at any scope - global, schema or node. To customize the format of all decimal,
double or float values at the global or schema level, use the
<decimalFormat>
, <doubleFormat>
and
<floatFormat>
configuration elements respectively. For the node
scope, use <numericFormat>
element.
Usage
<decimalFormat | doubleFormat | floatFormat | numericFormat [totalDigits=”xs:byte”] [fractionDigits=”xs:byte”] [fractionMinDigits=”xs:byte”] [integerMaxDigits=”xs:byte”] [integerMinDigits=”xs:byte”] [expSymbol=”xs:token”] [expMinValue=”xs:short”] [expMaxValue=”xs:short”] [expDigits=”xs:byte”] [signPresent=”xs:boolean”] [pointPresent=”xs:boolean”] [expSignPresent=”xs:boolean”] [expPresent=”xs:boolean”] >
All attributes are optional, the order is not important.
Attribute name | Applicable types | Description |
---|---|---|
totalDigits | double float decimal | Number of total significiant digits. Trailing and leading zeros are not counted by this parameter. |
fractionDigits | double float decimal | Number of maximum signficiant digits in fraction part, precision. |
fractionMinDigits | double float decimal | Number of minimum digits in the fraction part. If the fraction part has less digits than this parameter then trailing zeros will be added. |
integerMaxDigits | double float decimal | Maximum digits in integer part; if it is 0 and integer part is 0 then integer part will be omitted, for example .3, or -.3. |
integerMinDigits | double float decimal | Minimum digits in integer part, leading zeros will be added if necessary. |
expSymbol | double float | Exponent symbol. 'E' or 'e' only; 0 if no exponent is expected. |
expMinValue | double float | Maximum exponent value. By default, -infinity. |
expMaxValue | double float | Maximum exponent value. By default, infinity. |
expDigits | double float | Number of digits in exponent part; if exponent's value is not enough, trailing zeros will be added. |
signPresent | double float decimal | Indicates (“true” or “false”), sign must be present, even if value is positive. |
pointPresent | double float decimal | Indicates (“true” or “false”), decimal point must be present, even if value's fraction is 0 |
expPresent | double float | Indicates (“true” or “false”), exponent must be present, even if its value is 0. |
expSignPresent | double float | Indicates (“true” or “false”), exponent sign must be present, even if its value is positive. |
So, to format a decimal value “12” as “+0012.00” the configuration element for node should look as follows:
<numericFormat fractionMinDigits=”2” integerMinDigits=”4” signPresent=”true”/>