[DFDL-WG] Question about unparsing with dfdl:textNumberPattern "#.##" vs. "0.##"

Mike Beckerle mbeckerle at apache.org
Thu Oct 26 15:21:50 PDT 2023


These textNumberPatterns behave the same as far as I can tell.

I'd expect them to be different when unparsing.

When unparsing decimal number value 0.12 I'd expect....

textNumberPattern="0.##" to create a 4 character representation "0.12"

because one digit left of the decimal point is required.

But I expect...

textNumberPattern="#.##" to create a 3-character representation ".12"

because the digit to the left of the decimal point is optional and the
whole integer part is zero and so should be suppressed.

Isn't that the point of "#" versus "0" as a digit indicator in the pattern?

That's not what happens though. I get "0.12" from either textNumberPattern
pattern.

Is this a bug?

Mike Beckerle
Apache Daffodil PMC | daffodil.apache.org
OGF DFDL Workgroup Co-Chair | www.ogf.org/ogf/doku.php/standards/dfdl/dfdl
Owl Cyber Defense | www.owlcyberdefense.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/html
Size: 2062 bytes
Desc: not available
URL: <https://lists.ogf.org/pipermail/dfdl-wg/attachments/20231026/3a91064d/attachment.txt>


More information about the dfdl-wg mailing list