Skip Menu |

This queue is for tickets about the Data-Validate-XSD CPAN distribution.

Report information
The Basics
Id: 120267
Status: open
Priority: 0/
Queue: Data-Validate-XSD

People
Owner: Nobody in particular
Requestors: apramanik [...] sis-emea.com
Cc:
AdminCc:

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



Subject: Bug : Result not as expected.
Date: Wed, 15 Feb 2017 18:11:29 +0000
To: "bug-Data-Validate-XSD [...] rt.cpan.org" <bug-Data-Validate-XSD [...] rt.cpan.org>
From: Amarendra Pramanik <apramanik [...] sis-emea.com>
Hi, I am facing issue while validating the data against the structure $def. Even if the data for BS_INFO_CALLED_NUM_FIELD_REF(string)not matching with the data type, the output showing success parsing. Will you please check what is the issue and why the validation is not happing. $def = { root => [ { name => 'XDRAttributes', type => 'XDR' }, ], complexTypes => { XDR => [ { name => 'BS_INFO_CALLED_NUM_FIELD_REF', type => 'integer', minLength =>5, maxLength => 38 }, { name => 'BS_INFO_DIAL_DIGITS_FIELD_REF', type => 'integer', minLength =>0, maxLength => 38 }, { name => 'BUSINESS_INFO_BS_ID', type => 'integer', minLength =>0, maxLength => 38 }, { name => 'BUSINESS_INFO_BS_VERSION', type => 'integer', minLength =>0, maxLength => 38 }, ], }, }; $data = { XDRAttributes => { BS_INFO_CALLED_NUM_FIELD_REF => 'hhffl', } }; my $validator = Data::Validate::XSD->new( $def ); $validator->setStrict( 1 ); my $errors = $validator->validate( $data ); warn Dumper($errors) if $errors; BR/ Amarendra
You've asked it to required at least 1 and no more than 1 of each of the elements in XDRAttributes. I tried your schema in my newer version of the code in python and it causes the same errors. The errors are valid. If you want the XDRAttributes to be optional, you should set maxOccurs and minOccurs as needed. Next the PATTERN error is because hhffl isn't a number.
Subject: RE: [rt.cpan.org #120267] Bug : Result not as expected.
Date: Thu, 16 Feb 2017 03:44:28 +0000
To: "bug-Data-Validate-XSD [...] rt.cpan.org" <bug-Data-Validate-XSD [...] rt.cpan.org>
From: Amarendra Pramanik <apramanik [...] sis-emea.com>
Dear Martin, Thank you very much for your prompt reply. I have tried with minOccurs & I found XDRAttributes becomes optional, absolutely correct outcome and expected. However, as I mentioned earlier, I am not getting any pattern error because of the data ‘hhffl’ and it is returning success which is not an expected result. [cid:image001.png@01D28833.F4CBC3F0] Most intestinally if I made type : datetime, then only I am getting the expected outcome & for other datatypes it is not. $def = { root => [ { name => 'XDRAttributes', type => 'XDR' }, ], complexTypes => { XDR => [ { name => 'BS_INFO_CALLED_NUM_FIELD_REF', type => 'datetime', minOccurs => 1, maxLength => 38 }, [cid:image002.png@01D28835.0E2A67B0] Will you please help me to resolve this issue & please let me know if you require any clarification from me. I found this module to be very useful validating dataset. Thanks & Regards Amarendra Show quoted text
-----Original Message----- From: Martin Owens via RT [mailto:bug-Data-Validate-XSD@rt.cpan.org] Sent: 16 February 2017 05:57 To: Amarendra Pramanik <apramanik@sis-emea.com> Subject: [rt.cpan.org #120267] Bug : Result not as expected. <URL: https://rt.cpan.org/Ticket/Display.html?id=120267 > You've asked it to required at least 1 and no more than 1 of each of the elements in XDRAttributes. I tried your schema in my newer version of the code in python and it causes the same errors. The errors are valid. If you want the XDRAttributes to be optional, you should set maxOccurs and minOccurs as needed. Next the PATTERN error is because hhffl isn't a number.
Download image001.png
image/png 2.6k
image001.png
Download image002.png
image/png 4.8k
image002.png
You are right, I think the issue is with the perl version. The code is "lib/Data/Validate/XSD.pm:585" if you want to have a go at fixing it. I'm re-opening the issue here, but since the module is effectively unmaintained now after all these years, you might be better off using python if you can.
Subject: RE: [rt.cpan.org #120267] Bug : Result not as expected.
Date: Thu, 16 Feb 2017 04:12:46 +0000
To: "bug-Data-Validate-XSD [...] rt.cpan.org" <bug-Data-Validate-XSD [...] rt.cpan.org>
From: Amarendra Pramanik <apramanik [...] sis-emea.com>
Dear Martin, I found at "lib/Data/Validate/XSD.pm:584" the ‘if’ checking is failing & it should be if(defined($typedef->{'pattern'}) and ref($typedef->{'pattern'}) eq 'Regexp') { rather than : if(defined($typedef->{'pattern'}) and ref($typedef->{'pattern'}) eq ' REGEX') { Will you please update the release. Thank you very much for your support. BR/ Amarendra Show quoted text
-----Original Message----- From: Martin Owens via RT [mailto:bug-Data-Validate-XSD@rt.cpan.org] Sent: 16 February 2017 09:30 To: Amarendra Pramanik <apramanik@sis-emea.com> Subject: [rt.cpan.org #120267] Bug : Result not as expected. <URL: https://rt.cpan.org/Ticket/Display.html?id=120267 > You are right, I think the issue is with the perl version. The code is "lib/Data/Validate/XSD.pm:585" if you want to have a go at fixing it. I'm re-opening the issue here, but since the module is effectively unmaintained now after all these years, you might be better off using python if you can.
Thanks for the patch. I've incorporated it into the attached package (version 1.06) but I've completely forgotten how to upload things to CPAN. If you register yourself on CPAN PAUSE, I'll give you co-authoriship over the module and you can upload, fix, etc as you need. Let me know your username there.
Subject: Data-Validate-XSD-1.06.tar.gz

Message body not shown because it is not plain text.

Subject: RE: [rt.cpan.org #120267] Bug : Result not as expected.
Date: Fri, 17 Feb 2017 04:14:58 +0000
To: "bug-Data-Validate-XSD [...] rt.cpan.org" <bug-Data-Validate-XSD [...] rt.cpan.org>
From: Amarendra Pramanik <apramanik [...] sis-emea.com>
Thank you very much @Martin for this patch. My User Name Is : amarendra.pramanik@gmail.com<mailto:amarendra.pramanik@gmail.com> BR/ Amarendra Show quoted text
-----Original Message----- From: Martin Owens via RT [mailto:bug-Data-Validate-XSD@rt.cpan.org] Sent: 16 February 2017 18:16 To: Amarendra Pramanik <apramanik@sis-emea.com> Subject: [rt.cpan.org #120267] Bug : Result not as expected. <URL: https://rt.cpan.org/Ticket/Display.html?id=120267 > Thanks for the patch. I've incorporated it into the attached package (version 1.06) but I've completely forgotten how to upload things to CPAN. If you register yourself on CPAN PAUSE, I'll give you co-authoriship over the module and you can upload, fix, etc as you need. Let me know your username there.
I can't find you in the CPAN users list. The closest person is "Amarendran R. Subramanian" and that's very likely wrong. So what we need is not a rt.cpan.org account, but rather a PAUSE ID see http://www.cpan.org/modules/04pause.html