Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-865

Spec Clarification needed: totalDigits, fractionDigits, and textNumberPattern

XMLWordPrintableJSON

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major Major
    • s12
    • None
    • Documentation
    • None

      Message posed to Working Group by Mike:

      The spec says that these need to be compatible.
       
      "If the pattern uses digits/fractions then these must match any XML schema facets."
       
      We've fallen into this trap before. Facet constraints are about the logical value, not the physical rep, and so must make equal sense for binary representations as text representations.
       
      I was considering what kinds of static cross checks would make sense here.
       
      Example: suppose fractionDigits='2'.
       
      Suppose textNumberPattern="##"
       
      the type must be xs:decimal since that's the only type that can have fractionDigits constrained in DFDL.
       
      Is there a conflict of the facet with the textNumberPattern? I think not. Even though the pattern doesn't allow for any fractional part to be expressed, that means that all values will have less than or equal to 2 fractional digits (because no fractional digits always satisfies that.)
       
      Now suppose textNumberPattern="#.########"
       
      Now the textNumberPattern will parse and accept things like 1.234 which have more than 2 fraction digits, but suppose the data simply doesn't contain any such. So all number in the data will obey the less than or equal to 2 fractional digits.
       
      Lastly, suppose textNumberPattern="9.9999"
       
      So, interpreted naively, this requires the data to contain 5 digits, so this seems inconsistent with fractionDigits of 2. 
       
      However, we know this depends on the strict/lax behavior of ICU libraries, and I believe this will happily parse the data "0.0" without error. Hence the data could still all have 2 or fewer fractional digits.
       
      So, I think this idea that the totalDigits and fractionDigits facets can be cross-checked with the textNumberPattern is spurious and we should drop it.
       
      I think it dates from a time when we were still confused about the separation of the DFDL Infoset, and facet constraints on its value spaces, which are abstract, versus the XML Infoset, where everything truly is a string as well as whatever its XML Schema type says.

              jchab Jessie Chab
              jchab Jessie Chab
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: