[DFDL-WG] examples of decimal validation using pattern facet
Mike Beckerle
mbeckerle.dfdl at gmail.com
Sat May 18 14:42:31 EDT 2013
Roger costello of Mitre provides this example of using pattern facet.
Basically, it expresses several different possible formats, all of which
are some combination of digits and a optional decimal point. In terms of
cobol-style patterns it is one of these formats:
99
99.9
99.99
99.999
99.9999
I am not sure a textNumberPattern can handle the optionality of the decimal
point. I know we can deal with the varying number of fraction digits, and
the fixed number of integer digits, but conditional decimal point I am
unsure about.
---------- Forwarded message ----------
From: Costello, Roger L. <costello at mitre.org>
Date: Fri, May 17, 2013 at 4:00 PM
Subject: RE: examples of decimal validation using pattern facet
To: Mike Beckerle <mbeckerle.dfdl at gmail.com>
Cc: "Cranford, Jonathan W." <jcranford at mitre.org>
Hello Mike,****
** **
**Ø **Can you send an example of the lat/lon validation ****
**Ø **you mentioned on yesterday's Daffodil call?****
** **
Here ya go:****
<xsd:simpleType name="foo">
<xsd:restriction base="xsd:decimal">****
<xsd:minInclusive value="00"/>
<xsd:maxInclusive value="59.9999"/>
<xsd:pattern value=
"[0-9]{2}|[0-9]{2}\.[0-9]{1}|[0-9]{2}\.[0-9]{2}|[0-9]{2}\.[0-9]{3}|[0-9]{2}\.[0-9]{4}"
/>
</xsd:restriction>
</xsd:simpleType>****
** **
/Roger****
** **
*From:* Mike Beckerle [mailto:mbeckerle.dfdl at gmail.com]
*Sent:* Thursday, May 16, 2013 8:15 AM
*To:* Costello, Roger L.
*Subject:* examples of decimal validation using pattern facet****
** **
Roger,
Can you send an example of the lat/lon validation you mentioned on
yesterday's Daffodil call?
The other members of the workgroup are wondering what can't be done via
totalDigits/fractionDigits, etc.
The rationale for why pattern facet is not supported on numbers in DFDL is
that we already have a much more powerful mechanism for parsing and
unparsing numbers called textNumberPattern. The pattern facet only allows
pass/fail using a regex, and is considered redundant (and problematic) for
numbers as a result.
...mike
--
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology |
www.tresys.com****
--
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/20130518/65b489ee/attachment.html>
More information about the dfdl-wg
mailing list