Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: nb [...] solfaktor.com
Cc:
AdminCc:

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



Subject: Observation in module XML::Compile::WSDL11
Date: Wed, 31 May 2017 09:34:14 +0200
To: bug-XML-Compile-WSDL11 [...] rt.cpan.org
From: Nils Barkald <nb [...] solfaktor.com>
Hello, The observation is made in version 3.05 of XML::Compile::WSDL11. A number with a leading zero should probably be accepted as value in an element when the base type is 'xs:integer' A value of '0519' is not accepted (this is month and year concatenated). The error message: string `519' does not match pattern `-?[0-9]{4,4}' at fop_createformofpayment_11_1:FOP_CreateFormOfPayment/fopGroup/mopDescription/paymentModule/mopInformation/creditCardData/creditCardDetails/ccInfo/expiryDate#facet The definition of the element in the XSD-file: <xs:element name="expiryDate" minOccurs="0" type="NumericInteger_Length4To4"> <xs:annotation> <xs:documentation xml:lang="en">Expiry date : format MMYY</xs:documentation> </xs:annotation> </xs:element> Definition of the type: <xs:simpleType name="NumericInteger_Length4To4"> <xs:annotation> <xs:documentation xml:lang="en">Format limitations: n4</xs:documentation> </xs:annotation> <xs:restriction base="xs:integer"> <xs:pattern value="-?[0-9]{4,4}" /> </xs:restriction> </xs:simpleType> Best regards Nils Barkald Software Engineer Reisegiganten ASnils@reisegiganten.no mob +47 928 46 764 pho +47 21 09 50 21
Subject: Re: [rt.cpan.org #121946] Observation in module XML::Compile::WSDL11
Date: Wed, 31 May 2017 13:51:15 +0200
To: Nils Barkald via RT <bug-XML-Compile-WSDL11 [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Nils Barkald via RT (bug-XML-Compile-WSDL11@rt.cpan.org) [170531 07:34]: Show quoted text
> Wed May 31 03:34:30 2017: Request 121946 was acted upon. > Transaction: Ticket created by nb@solfaktor.com > Queue: XML-Compile-WSDL11 > Subject: Observation in module XML::Compile::WSDL11 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121946 >
I give three answers. The last one may help you work around this ;-) But first let's try to discover why this issue exists. Show quoted text
> A value of '0519' is not accepted (this is month and year concatenated). > > <xs:element name="expiryDate" minOccurs="0" > type="NumericInteger_Length4To4">
Show quoted text
> <xs:simpleType name="NumericInteger_Length4To4"> > <xs:restriction base="xs:integer"> > <xs:pattern value="-?[0-9]{4,4}" />
1. Well, this is the main cause of this issue: a date is not an integer. In this case a string of 4 digits, right... but an integer has many properties, like addition and subtraction, positive and negative, leading zero's are ignored. 2. The interpretation of the field does not follow the rules of a number. Worse: the canonicalization of the integer may cause a string which is outside its lexical restriction. That is what happens here. The specification has a Note about this. Read the Note in 4.3.4.4 at https://www.w3.org/TR/xmlschema11-2/#rf-pattern Note: As noted in Datatype (§2.1), certain uses of the ·pattern· facet may eliminate from the lexical space the canonical forms of some values in the value space; this can be inconvenient for applications which write out the canonical form of a value and rely on being able to read it in again as a legal lexical form. This specification provides no recourse in such situations; applications are free to deal with it as they see fit. Caution is advised. (Arggg... these XSD specs are so hard to read!) In my words: if your pattern excludes canonical forms of acceptable values, you are on your own. The downside of this note: it is allowed to mess things up. 3. Solution From this statement, it is not clear whether you want to read or write XML: Show quoted text
> A value of '0519' is not accepted (this is month and year concatenated). > The error message: > string `519' does not match pattern `-?[0-9]{4,4}' at
I can reproduce you issue while reading. There is something wrong with the order of facet processing. I am trying to solve it now. It's quite nasty in the edge cases. Hopefully I can send you a patch today. -- Greetz, MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Fixed with XML::Compile release 1.57