annotate Lib/IMPL/DOM/Schema/Validator/Compare.pm @ 236:2904da230022

DOM refactoring
author sergey
date Mon, 15 Oct 2012 04:23:01 +0400
parents 4d0e1962161c
children b8c724f6de36
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
1 package IMPL::DOM::Schema::Validator::Compare;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
2 use strict;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
3
165
76515373dac0 Added Class::Template,
wizard
parents: 125
diff changeset
4 use parent qw(IMPL::DOM::Schema::Validator);
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
5
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
6 use IMPL::Resources::Format qw(FormatMessage);
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
7 use IMPL::Class::Property;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
8
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
9 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
10 public property targetProperty => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
11 public property op => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
12 public property nodePath => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
13 public property optional => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
14 private property _pathTranslated => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
15 private property _targetNode => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
16 public property message => prop_all;
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
17 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
18
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
19 our %CTOR = (
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
20 'IMPL::DOM::Schema::Validator' => sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
21 my %args = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
22 $args{nodeName} ||= 'Compare';
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
23 delete @args{qw(targetProperty op nodePath optional message)};
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
24 %args;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
25 }
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
26 );
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
27
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
28 our %Ops = (
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
29 '=' => \&_equals,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
30 'eq' => \&_equalsString,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
31 '!=' => \&_notEquals,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
32 'ne' => \&_notEqualsString,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
33 '=~' => \&_matchRx,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
34 '!~' => \&_notMatchRx,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
35 '<' => \&_less,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
36 '>' => \&_greater,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
37 'lt' => \&_lessString,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
38 'gt' => \&_greaterString
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
39 );
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
40
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
41 my $rxOps = map qr/$_/, join( '|', keys %Ops );
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
42
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
43 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
44 my ($this,%args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
45
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
46 $this->targetProperty($args{targetProperty} || 'nodeValue');
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
47 $this->op( $Ops{ $args{op} || '=' } ) or die new IMPL::InvalidArgumentException("Invalid parameter value",'op',$args{op},$this->path);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
48 $this->nodePath($args{nodePath}) or die new IMPL::InvalidArgumentException("The argument is required", 'nodePath', $this->path);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
49 $this->message($args{message} || 'The value of %Node.path% %Source.op% %Value% (%Source.nodePath%)' );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
50 $this->optional($args{optional}) if $args{optional};
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
51 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
52
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
53 sub TranslatePath {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
54 my ($this,$path) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
55
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
56 $path ||= '';
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
57
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
58 my @selectQuery;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
59
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
60 my $i = 0;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
61
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
62 foreach my $chunk (split /\//,$path) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
63 $chunk = 'document:*' if $i == 0 and not length $chunk;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
64 next if not length $chunk;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
65
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
66 my $query;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
67 my ($axis,$filter) = ( $chunk =~ /^(?:(\w+):)?(.*)$/);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
68
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
69 if ($filter =~ /^\w+|\*$/ ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
70 $query = $filter eq '*' ? undef : $filter;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
71 } elsif ( $filter =~ /^(\w+|\*)\s*((?:\[\s*\w+\s*(?:=|!=|=~|!~|eq|ne|lt|gt|)\s*["'](?:[\\'"]|\\[\\"'])*["']\])+)$/) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
72 my ($nodeName,$filterArgs) = ($1,$2);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
73
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
74 my @parsedFilters = map {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
75 my ($prop,$op,$value) = ($_ =~ /\s*(\w+)\s*(=|!=|=~|!~)\s*(["'](?:[\\'"]|\\[\\"'])*["'])/);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
76 $value =~ s/\\[\\'"]/$1/g;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
77 {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
78 prop => $prop,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
79 op => $Ops{$op},
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
80 value => $value
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
81 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
82 } grep ( $_, split ( /[\]\[]+/,$filterArgs ) );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
83
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
84 $query = sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
85 my ($node) = shift;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
86
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
87 $node->nodeName eq $nodeName or return 0 if $nodeName ne '*';
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
88 $_->{op}->(
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
89 _resovleProperty($node,$_->{prop}),
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
90 FormatMessage($_->{value},{
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
91 Schema => $this->parentNode,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
92 Node => $this->_targetNode
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
93 },\&_resovleProperty)
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
94 ) or return 0 foreach @parsedFilters;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
95
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
96 };
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
97 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
98 die new IMPL::Exception("Invalid query syntax",$path,$chunk);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
99 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
100
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
101 push @selectQuery, $axis ? { $axis => $query } : $query;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
102
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
103 $i++;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
104 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
105
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
106 return \@selectQuery;
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
107 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
108
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
109 sub Validate {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
110 my ($this,$node,$ctx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
111
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
112 my @result;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
113
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
114 $this->_targetNode($node);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
115
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
116 my $query = $this->_pathTranslated() || $this->_pathTranslated($this->TranslatePath($this->nodePath));
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
117
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
118 my ($foreignNode) = $node->selectNodes(@$query);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
119
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
120 my $Source = $ctx && $ctx->{Source} || $this->parentNode;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
121
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
122 if ($foreignNode) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
123 my $value = $this->nodeValue;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
124
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
125 if ($value) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
126 $value = FormatMessage($value, { Schema => $this->parentNode, Node => $this->_targetNode, ForeignNode => $foreignNode },\&_resovleProperty);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
127 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
128 $value = $foreignNode->nodeValue;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
129 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
130
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
131 push @result, new IMPL::DOM::Schema::ValidationError(
236
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
132 node => $node,
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
133 foreignNode => $foreignNode,
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
134 value => $value,
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
135 source => $Source,
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
136 schema => $this->parentNode,
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
137 message => $this->message
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
138 ) unless $this->op->(_resovleProperty($node,$this->targetProperty),$value);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
139 } elsif (not $this->optional) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
140 push @result, new IMPL::DOM::Schema::ValidationError(
236
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
141 node => $node,
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
142 value => '',
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
143 source => $Source,
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
144 schema => $this->parentNode,
2904da230022 DOM refactoring
sergey
parents: 194
diff changeset
145 message => $this->message
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
146 );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
147 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
148
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
149 $this->_targetNode(undef);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
150
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
151 return @result;
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
152 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
153
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
154 sub _resovleProperty {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
155 my ($node,$prop) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
156
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
157 return $node->can($prop) ? $node->$prop() : $node->nodeProperty($prop);
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
158 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
159
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
160 sub _matchRx {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
161 $_[0] =~ $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
162 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
163
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
164 sub _notMatchRx {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
165 $_[0] !~ $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
166 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
167
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
168 sub _equals {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
169 $_[0] == $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
170 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
171
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
172 sub _notEquals {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
173 $_[0] != $_[0];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
174 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
175
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
176 sub _equalsString {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
177 $_[0] eq $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
178 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
179
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
180 sub _notEqualsString {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
181 $_[0] ne $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
182 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
183
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
184 sub _less {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
185 $_[0] < $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
186 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
187
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
188 sub _greater {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
189 $_[0] > $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
190 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
191
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
192 sub _lessString {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
193 $_[0] lt $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
194 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
195
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
196 sub _greaterString {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
197 $_[0] gt $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
198 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
199
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
200 sub _lessEq {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
201 $_[0] <= $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
202 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
203
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
204 sub _greaterEq {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
205 $_[0] >= $_[1];
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
206 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
207
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
208 1;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
209
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
210 __END__
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
211
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
212 =pod
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
213
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
214 =head1 NAME
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
215
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
216 C<IMPL::DOM::Schema::Validator::Compare> - ограничение на содержимое текущего узла,
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
217 сравнивая его со значением другого узла.
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
218
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
219 =head1 SYNOPSIS
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
220
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
221 Пример типа описания поля с проверочным полем
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
222
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
223 =begin code xml
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
224
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
225 <schema>
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
226 <SimpleType type="retype_field">
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
227 <Property name="linkedNode" message="Для узла %Node.nodeName% необходимо задать свойство %Source.name%"/>
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
228 <Compare op="eq" nodePath="sibling:*[nodeName eq '%Node.linkedNode%']"/>
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
229 </SimpleType>
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
230 </schema>
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
231
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
232 =begin code xml
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
233
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
234 =head1 DESCRIPTION
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
235
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
236 Позволяет сравнивать значение текущего узла со значением другого узла.
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
diff changeset
237
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
238 =cut