[DFDL-865] Spec Clarification needed: totalDigits, fractionDigits, and textNumberPattern Created: 22/Aug/13 Updated: 01/Oct/13 Resolved: 23/Sep/13 Status: Project: Component/s: Affects Version/s: Fix Version/s: Closed Daffodil Documentation None Type: Reporter: Resolution: Labels: Remaining Estimate: Time Spent: Original Estimate: Task Jessie Chab Fixed None Not Specified s12 Priority: Assignee: Votes: Major Jessie Chab 0 Not Specified Not Specified Description Message posed to Working Group by Mike: {noformat} 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.{noformat} Comments Comment by Mike Beckerle [ 23/Sep/13 ] This was clarified, and the spec as of Sept 2013 (v1.0.4), no longer requires any consistency checking between totalDigits, fractionDigits, and textNumberPattern. Note that for validation, fractionDigits applies only to xs:decimal type, where it is meaningful for both text and binary representations. Comment by Mike Beckerle [ 23/Sep/13 ] This was just a issue to get a resolution from the DFDL workgroup to a question on the spec. That clarification is now in the spec, or rather the confusing requirement to cross check textNumberPattern and fractionDigits has been dropped. Comment by Jessie Chab [ 01/Oct/13 ] verified change in spec, marked requirement as obsolete in Testlink, modified tests to expect a correct parse and validation errors. Moved tests from scala-debug to scala, updated test descriptions, and marked as 'passed' in testlink. Generated at Tue Feb 09 06:07:36 CST 2016 using JIRA 7.0.10#70120sha1:37e3d7a6fc4d580639533e7f7c232c925e554a6a.