[DFDL-WG] clarification needed: 16.3.1 and totalDigits, fractionDigits and textNumberPattern compatibility checks

Mike Beckerle mbeckerle.dfdl at gmail.com
Thu Aug 22 10:34:53 EDT 2013


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.

Comments?

-- 
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology |
www.tresys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20130822/d85d8594/attachment.html>


More information about the dfdl-wg mailing list