Skip Menu |

This queue is for tickets about the XML-Compile CPAN distribution.

Report information
The Basics
Id: 39224
Status: resolved
Priority: 0/
Queue: XML-Compile

People
Owner: Nobody in particular
Requestors: MIROD [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.94
Fixed in: (no value)



Subject: Bug with decimal numbers ending in .00
Hi, I have a schema that includes this type definition: <xs:simpleType name="DecimalType"> <xs:restriction base="xs:decimal"> <xs:pattern value="[0-9]{1,13}\.[0-9]{0,2}"/> </xs:restriction> </xs:simpleType> This allows for decimal numbers with 0 to 2 digits after the point. Note that the dot is compulsory. An instance with a value of 1130.00 gets rejected, as apparently the number is treated as 1130 (the decimal part gets dropped). The attached tar file shows the problem. ~> perl ex1.pl error: string `1130' does not match pattern (?-xism:^(?:[0-9]{1,13}\.[0-9]{0,2})$) at {http://www.ebinterface.at/schema/2p0/}Invoice/Tax/VAT/Item/TaxedAmount#facet I could change the schema, but it appears to be valid, so I assume it's a bug in either XML::Compile or XML::LibXML. Thanks __ mirod
Subject: bug_with_numbers.tar.gz
Download bug_with_numbers.tar.gz
application/x-gzip 14.1k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #39224] Bug with decimal numbers ending in .00
Date: Fri, 12 Sep 2008 21:05:42 +0200
To: MIROD via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* MIROD via RT (bug-XML-Compile@rt.cpan.org) [080912 15:53]: Show quoted text
> Fri Sep 12 11:53:32 2008: Request 39224 was acted upon. > Subject: Bug with decimal numbers ending in .00 > > I have a schema that includes this type definition: > > <xs:simpleType name="DecimalType"> > <xs:restriction base="xs:decimal"> > <xs:pattern value="[0-9]{1,13}\.[0-9]{0,2}"/> > </xs:restriction> > </xs:simpleType> > > This allows for decimal numbers with 0 to 2 digits after the point. Note > that the dot is compulsory. > > An instance with a value of 1130.00 gets rejected, as apparently the > number is treated as 1130 (the decimal part gets dropped).
The usual way to specify this is with the fractionDigits. Anyway, pattern is allowed according to the specs, so it is a bug. Now... find time to fix it. Another bug-report of today requires the same way of solution. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #39224] Bug with decimal numbers ending in .00
Date: Fri, 12 Sep 2008 22:43:21 +0200
To: MIROD via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* MIROD via RT (bug-XML-Compile@rt.cpan.org) [080912 15:53]: Show quoted text
> Fri Sep 12 11:53:32 2008: Request 39224 was acted upon. > Transaction: Ticket created by MIROD > Queue: XML-Compile > Subject: Bug with decimal numbers ending in .00 > > I have a schema that includes this type definition: > <xs:simpleType name="DecimalType"> > <xs:restriction base="xs:decimal"> > <xs:pattern value="[0-9]{1,13}\.[0-9]{0,2}"/> > </xs:restriction> > </xs:simpleType> > > This allows for decimal numbers with 0 to 2 digits after the point. Note > that the dot is compulsory.
One more detail. The Schema definition says a decimal is: (\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+) So, your pattern is incompatible, enforcing the dot. That doesn't mean that there isn't an issue to be solved. -- MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
fixed in 0.95, to be released later today. However, the conflict between your pattern and the syntax of decimals may cause problems with other implementations, because the order of the facet processing is unspecified. You could better use the totalDigits and fractionDigits.