Mercurial > pub > Impl
diff Lib/IMPL/DOM/Schema/SimpleNode.pm @ 388:648dfaf642e0
DOM refactoring,
removed inflators from DOM Schema,
DOM validation - in progress
author | cin |
---|---|
date | Tue, 11 Feb 2014 20:22:01 +0400 |
parents | 4ddb27ff4a0b |
children |
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/SimpleNode.pm Tue Feb 11 01:13:47 2014 +0400 +++ b/Lib/IMPL/DOM/Schema/SimpleNode.pm Tue Feb 11 20:22:01 2014 +0400 @@ -2,36 +2,23 @@ use strict; use warnings; -use parent qw(IMPL::DOM::Schema::Node); -use IMPL::Class::Property; -use IMPL::DOM::Property qw(_dom); - -BEGIN { - public _dom _direct property inflator => prop_get; - public _dom _direct property messageInflateError => prop_get; -} - -our %CTOR = ( - 'IMPL::DOM::Schema::Node' => sub { - my %args = @_; - $args{nodeName} ||= 'SimpleNode'; - delete @args{qw(inflator messageInflateError)}; - %args - } -); - -sub CTOR { - my ($this,%args) = @_; - - if ( $args{inflator} ) { - $this->{$inflator} = $args{inflator} ; - $this->{$messageInflateError} = exists $args{messageInflateError} ? $args{messageInflateError} : 'Failed to inflate nodeValue %node.path%: %error%'; - } -} +use IMPL::declare { + base => [ + 'IMPL::DOM::Schema::Node' => sub { + my %args = @_; + $args{nodeName} ||= 'SimpleNode'; + %args + } + ] +}; sub Validate { my ($this,$node,$ctx) = @_; + $ctx->{schemaNode} ||= $this; # для безымянных типов + + $ctx->{schemaType} = $this; + my @result; push @result, $_->Validate($node,$ctx) foreach $this->childNodes; @@ -39,16 +26,6 @@ return @result; } -sub inflateValue { - my ($this,$value) = @_; - - if ( my $inflator = $this->inflator ) { - return $inflator->new($value,$this); - } else { - return $value; - } -} - 1; __END__