When textNumberCheckPolicy="strict" Daffodil configures ICU to use the pattern to determine if a decimal point should be required or not allowed. If a decimal point exists in the pattern, then it must also exist in the data. And if a decimal point does not exist in the pattern, then it must also not exist in the data.

If you want an optional decimal point, you have to set textNumberCheckPolicy to lax.

On 2024-01-16 12:29 PM, Roger L Costello wrote:
My input contains a decimal value representing a latitude minutes.  Here are several legal values:

74

74.1

74.12

74.123

76.1234

As you can see, the value may be a whole number, or it may have a decimal point followed by 1-4 digits.

This works fine if the value is a whole number:

<xs:elementname="LatitudeMinutes"
                 type="xs:decimal"
                 dfdl:lengthKind="pattern"
                 dfdl:lengthPattern="[0-9]{2}[0-9\.]*(?=([^0-9]))"
                 dfdl:textNumberRep="standard"
                 dfdl:textNumberCheckPolicy="strict"
                 dfdl:textNumberPattern="00"
                 dfdl:textStandardGroupingSeparator=","
                 dfdl:textStandardDecimalSeparator="."
                 dfdl:textStandardBase="10"
                 dfdl:textNumberRounding="pattern">
</xs:element>

But it fails if the value has a decimal point followed by digits.

This works fine if the value has a decimal point followed by digits:

<xs:elementname="LatitudeMinutes"
                 type="xs:decimal"
                 dfdl:lengthKind="pattern"
                 dfdl:lengthPattern="[0-9]{2}[0-9\.]*(?=([^0-9]))"
                 dfdl:textNumberRep="standard"
                 dfdl:textNumberCheckPolicy="strict"
                 dfdl:textNumberPattern="00.0"
                 dfdl:textStandardGroupingSeparator=","
                 dfdl:textStandardDecimalSeparator="."
                 dfdl:textStandardBase="10"
                 dfdl:textNumberRounding="pattern">
</xs:element>

But it fails if the value doesn’t have a decimal point followed by digits.

How to declare LatitudeMinutes so that it can parse any of the inputs shown above?


Reply via email to