Mercurial > pub > Impl
diff 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 |
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/Validator/RegExp.pm Mon Aug 09 08:45:36 2010 +0400 +++ b/Lib/IMPL/DOM/Schema/Validator/RegExp.pm Mon Aug 16 08:26:44 2010 +0400 @@ -14,6 +14,8 @@ BEGIN { public property message => prop_all; + public property launder => prop_all; + private property _rx => prop_all; } sub CTOR { @@ -25,13 +27,17 @@ sub Validate { my ($this,$node,$ctx) = @_; - my $rx = $this->nodeValue; + my $rx = $this->_rx() || $this->_rx( map qr{$_}, $this->nodeValue ); + return new IMPL::DOM::Schema::ValidationError( Node => $node, Source => $ctx && $ctx->{Source} || $this->parentNode, Schema => $this->parentNode, Message => $this->message - ) unless (not $node->isComplex) and $node->nodeValue =~ /$rx/; + ) unless (not $node->isComplex) and $node->nodeValue =~ /($rx)/; + + $node->nodeValue($1) if $this->launder; + return (); }