comparison Lib/IMPL/DOM/Schema/NodeSet.pm @ 236:2904da230022

DOM refactoring
author sergey
date Mon, 15 Oct 2012 04:23:01 +0400
parents d1676be8afcc
children b8c724f6de36
comparison
equal deleted inserted replaced
235:a4d9126edcbb 236:2904da230022
43 43
44 foreach my $child ( @{$node->childNodes} ) { 44 foreach my $child ( @{$node->childNodes} ) {
45 if (my $info = $nodes{$child->nodeName} || $anyNode) { 45 if (my $info = $nodes{$child->nodeName} || $anyNode) {
46 $info->{Seen}++; 46 $info->{Seen}++;
47 push @errors,new IMPL::DOM::Schema::ValidationError ( 47 push @errors,new IMPL::DOM::Schema::ValidationError (
48 Source => $sourceSchema, 48 source => $sourceSchema,
49 Node => $child, 49 node => $child,
50 Parent => $node, 50 parent => $node,
51 Schema => $info->{Schema}, 51 schema => $info->{Schema},
52 Message => $this->messageMax 52 message => $this->messageMax
53 ) if ($info->{Max} and $info->{Seen} > $info->{Max}); 53 ) if ($info->{Max} and $info->{Seen} > $info->{Max});
54 54
55 if (my @localErrors = $info->{Schema}->Validate($child)) { 55 if (my @localErrors = $info->{Schema}->Validate($child)) {
56 push @errors,@localErrors; 56 push @errors,@localErrors;
57 } 57 }
58 } else { 58 } else {
59 push @errors, new IMPL::DOM::Schema::ValidationError ( 59 push @errors, new IMPL::DOM::Schema::ValidationError (
60 Source => $sourceSchema, 60 source => $sourceSchema,
61 Node => $child, 61 node => $child,
62 Parent => $node, 62 parent => $node,
63 Message => $this->messageUnexpected 63 message => $this->messageUnexpected
64 ) 64 )
65 } 65 }
66 } 66 }
67 67
68 foreach my $info (values %nodes) { 68 foreach my $info (values %nodes) {
69 push @errors, new IMPL::DOM::Schema::ValidationError ( 69 push @errors, new IMPL::DOM::Schema::ValidationError (
70 Source => $sourceSchema, 70 source => $sourceSchema,
71 Schema => $info->{Schema}, 71 schema => $info->{Schema},
72 Parent => $node, 72 parent => $node,
73 Message => $this->messageMin 73 message => $this->messageMin
74 ) if $info->{Min} > $info->{Seen}; 74 ) if $info->{Min} > $info->{Seen};
75 } 75 }
76 76
77 return @errors; 77 return @errors;
78 } 78 }