comparison Lib/IMPL/DOM/Schema/Property.pm @ 24:7f00786f8210

Первая рабочая реазизация схемы и навигаторов
author Sergey
date Mon, 05 Oct 2009 00:48:49 +0400
parents fafe56cfcd69
children 9dd67fa91ee3
comparison
equal deleted inserted replaced
23:716b287d4795 24:7f00786f8210
11 11
12 BEGIN { 12 BEGIN {
13 public property RequiredMessage => prop_all; 13 public property RequiredMessage => prop_all;
14 } 14 }
15 15
16 our %CTOR = { 16 our %CTOR = (
17 'IMPL::DOM::Schema::SimleNode' => sub { 17 'IMPL::DOM::Schema::SimpleNode' => sub {
18 my %args = @_; 18 my %args = @_;
19 19
20 $args{maxOccur} = 1; 20 $args{maxOccur} = 1;
21 $args{minOccur} = delete $args{optional} ? 0 : 1; 21 $args{minOccur} = delete $args{optional} ? 0 : 1;
22 $args{nodeName} ||= 'Property'; 22 $args{nodeName} ||= 'Property';
23 23
24 return %args; 24 return %args;
25 } 25 }
26 }; 26 );
27 27
28 sub CTOR { 28 sub CTOR {
29 my ($this,%args) = @_; 29 my ($this,%args) = @_;
30 30
31 $this->RequiredMessage($args{RequiredMessage} || 'A property %Schema.name% is required'); 31 $this->RequiredMessage($args{RequiredMessage} || 'A property %Schema.name% is required');
37 if ($this->minOccur) { 37 if ($this->minOccur) {
38 my $prop = $this->name; 38 my $prop = $this->name;
39 my $nodeProp = new IMPL::DOM::Node(nodeName => '::property', nodeValue => $node->$prop() || $node->nodePropety($prop)); 39 my $nodeProp = new IMPL::DOM::Node(nodeName => '::property', nodeValue => $node->$prop() || $node->nodePropety($prop));
40 40
41 if (! $nodeProp->nodeValue) { 41 if (! $nodeProp->nodeValue) {
42 return new IMPL::DOM::Schema::VaidationError( 42 return new IMPL::DOM::Schema::ValidationError(
43 Message => 43 Message =>
44 ); 44 );
45 } 45 }
46 return $this->SUPER::Validate($nodeProp); 46 return $this->SUPER::Validate($nodeProp);
47 } else { 47 } else {