XML Numeric Values Format Specification

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 nameApplicable typesDescription
totalDigitsdouble float decimalNumber of total significiant digits. Trailing and leading zeros are not counted by this parameter.
fractionDigitsdouble float decimalNumber of maximum signficiant digits in fraction part, precision.
fractionMinDigitsdouble float decimalNumber of minimum digits in the fraction part. If the fraction part has less digits than this parameter then trailing zeros will be added.
integerMaxDigitsdouble float decimalMaximum digits in integer part; if it is 0 and integer part is 0 then integer part will be omitted, for example .3, or -.3.
integerMinDigitsdouble float decimalMinimum digits in integer part, leading zeros will be added if necessary.
expSymboldouble floatExponent symbol. 'E' or 'e' only; 0 if no exponent is expected.
expMinValuedouble floatMaximum exponent value. By default, -infinity.
expMaxValuedouble floatMaximum exponent value. By default, infinity.
expDigitsdouble floatNumber of digits in exponent part; if exponent's value is not enough, trailing zeros will be added.
signPresentdouble float decimalIndicates (“true” or “false”), sign must be present, even if value is positive.
pointPresentdouble float decimalIndicates (“true” or “false”), decimal point must be present, even if value's fraction is 0
expPresentdouble floatIndicates (“true” or “false”), exponent must be present, even if its value is 0.
expSignPresentdouble floatIndicates (“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”/>