Mercurial > pub > Impl
comparison Lib/IMPL/DOM/Schema/Validator/RegExp.pm @ 148:e6447ad85cb4
DOM objects now have a schema and schemaSource properties
RegExp now can launder data
Improved post to DOM transformation (multiple values a now supported)
Added new axes to navigation queries: ancestor and descendant
minor changes and bug fixes
author | wizard |
---|---|
date | Mon, 16 Aug 2010 08:26:44 +0400 |
parents | a6e9759ff88a |
children | 76515373dac0 |
comparison
equal
deleted
inserted
replaced
147:c2aa10fbb396 | 148:e6447ad85cb4 |
---|---|
12 | 12 |
13 use IMPL::Class::Property; | 13 use IMPL::Class::Property; |
14 | 14 |
15 BEGIN { | 15 BEGIN { |
16 public property message => prop_all; | 16 public property message => prop_all; |
17 public property launder => prop_all; | |
18 private property _rx => prop_all; | |
17 } | 19 } |
18 | 20 |
19 sub CTOR { | 21 sub CTOR { |
20 my ($this,%args) = @_; | 22 my ($this,%args) = @_; |
21 | 23 |
23 } | 25 } |
24 | 26 |
25 sub Validate { | 27 sub Validate { |
26 my ($this,$node,$ctx) = @_; | 28 my ($this,$node,$ctx) = @_; |
27 | 29 |
28 my $rx = $this->nodeValue; | 30 my $rx = $this->_rx() || $this->_rx( map qr{$_}, $this->nodeValue ); |
31 | |
29 return new IMPL::DOM::Schema::ValidationError( | 32 return new IMPL::DOM::Schema::ValidationError( |
30 Node => $node, | 33 Node => $node, |
31 Source => $ctx && $ctx->{Source} || $this->parentNode, | 34 Source => $ctx && $ctx->{Source} || $this->parentNode, |
32 Schema => $this->parentNode, | 35 Schema => $this->parentNode, |
33 Message => $this->message | 36 Message => $this->message |
34 ) unless (not $node->isComplex) and $node->nodeValue =~ /$rx/; | 37 ) unless (not $node->isComplex) and $node->nodeValue =~ /($rx)/; |
38 | |
39 $node->nodeValue($1) if $this->launder; | |
40 | |
35 return (); | 41 return (); |
36 } | 42 } |
37 | 43 |
38 1; | 44 1; |