Skip Menu |

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

Report information
The Basics
Id: 5541
Status: resolved
Priority: 0/
Queue: XML-Validator-Schema

People
Owner: Nobody in particular
Requestors: adamk [...] ali.as
Cc:
AdminCc:

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



Subject: Support for additional derived simple types
XML::Validator::Schema doesn't appear to support the positiveInteger family of simple types. They can be implemented fairly easy... see attached patch again 1.05 If the patch is ok, would it be OK to build and upload a 1.06 with these changes included, as I have an active project which uses one of them. Thanks
diff -r XML-Validator-Schema-1.05.old/Schema/SimpleType.pm XML-Validator-Schema-1.05/Schema/SimpleType.pm 274a275,290 > # http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/#nonPositiveInteger > $BUILTIN{nonPositiveInteger} = $BUILTIN{integer}->derive(name => 'nonPositiveInteger'); > $BUILTIN{nonPositiveInteger}->restrict( maxInclusive => 0 ); > > # http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/#nonNegativeInteger > $BUILTIN{nonNegativeInteger} = $BUILTIN{integer}->derive(name => 'nonNegativeInteger'); > $BUILTIN{nonNegativeInteger}->restrict( minInclusive => 0 ); > > # http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/#positiveInteger > $BUILTIN{positiveInteger} = $BUILTIN{nonNegativeInteger}->derive(name => 'positiveInteger'); > $BUILTIN{positiveInteger}->restrict( minInclusive => 1 ); > > # http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/#negativeInteger > $BUILTIN{negativeInteger} = $BUILTIN{nonPositiveInteger}->derive(name => 'negativeInteger'); > $BUILTIN{negativeInteger}->restrict( maxInclusive => -1 ); > diff -r XML-Validator-Schema-1.05.old/t/03types.t XML-Validator-Schema-1.05/t/03types.t 28a29 > ok(check_type(integer => "0")); 35a37,72 > ok(supported_type('nonPositiveInteger')); > ok( check_type(nonPositiveInteger => "0")); > ok(not check_type(nonPositiveInteger => "1")); > ok( check_type(nonPositiveInteger => "-1")); > ok(not check_type(nonPositiveInteger => "2147483647")); > ok( check_type(nonPositiveInteger => "-2147483648")); > ok(not check_type(nonPositiveInteger => "12147483648")); > ok( check_type(nonPositiveInteger => "-12147483648")); > > ok(supported_type('nonNegativeInteger')); > ok( check_type(nonNegativeInteger => "0")); > ok( check_type(nonNegativeInteger => "1")); > ok(not check_type(nonNegativeInteger => "-1")); > ok( check_type(nonNegativeInteger => "2147483647")); > ok(not check_type(nonNegativeInteger => "-2147483648")); > ok( check_type(nonNegativeInteger => "12147483648")); > ok(not check_type(nonNegativeInteger => "-12147483648")); > > ok(supported_type('positiveInteger')); > ok(not check_type(positiveInteger => "0")); > ok( check_type(positiveInteger => "1")); > ok(not check_type(positiveInteger => "-1")); > ok( check_type(positiveInteger => "2147483647")); > ok(not check_type(positiveInteger => "-2147483648")); > ok( check_type(positiveInteger => "12147483648")); > ok(not check_type(positiveInteger => "-12147483648")); > > ok(supported_type('negativeInteger')); > ok(not check_type(negativeInteger => "0")); > ok(not check_type(negativeInteger => "1")); > ok( check_type(negativeInteger => "-1")); > ok(not check_type(negativeInteger => "2147483647")); > ok( check_type(negativeInteger => "-2147483648")); > ok(not check_type(negativeInteger => "12147483648")); > ok( check_type(negativeInteger => "-12147483648")); >
From: adamk [...] cpan.org
Show quoted text
> They can be implemented fairly easy... see attached patch again 1.05
That should of course be "against"...
Thanks, applied!