Mercurial > pub > Impl
diff Lib/IMPL/DOM/Schema/NodeSet.pm @ 125:a4b0a819bbda
Small fixes in IMPL::DOM::Schema
author | wizard |
---|---|
date | Thu, 10 Jun 2010 17:43:51 +0400 |
parents | cf3b6ef2be22 |
children | 1e7f03414b65 |
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/NodeSet.pm Thu Jun 10 02:45:59 2010 +0400 +++ b/Lib/IMPL/DOM/Schema/NodeSet.pm Thu Jun 10 17:43:51 2010 +0400 @@ -24,12 +24,14 @@ } sub Validate { - my ($this,$node) = @_; + my ($this,$node,$ctx) = @_; my @errors; my %nodes; my $anyNode; + my $sourceSchema = $ctx->{Source} || $this->parentNode; + foreach (@{$this->childNodes}) { if ($_->isa('IMPL::DOM::Schema::AnyNode')) { $anyNode = {Schema => $_, Min => $_->minOccur, Max => $_->maxOccur eq 'unbounded' ? undef : $_->maxOccur , Seen => 0 }; @@ -42,7 +44,7 @@ if (my $info = $nodes{$child->nodeName} || $anyNode) { $info->{Seen}++; push @errors,new IMPL::DOM::Schema::ValidationError ( - Source => $this, + Source => $sourceSchema, Node => $child, Parent => $node, Schema => $info->{Schema}, @@ -54,7 +56,7 @@ } } else { push @errors, new IMPL::DOM::Schema::ValidationError ( - Source => $this, + Source => $sourceSchema, Node => $child, Parent => $node, Message => $this->messageUnexpected @@ -64,7 +66,7 @@ foreach my $info (values %nodes) { push @errors, new IMPL::DOM::Schema::ValidationError ( - Source => $this, + Source => $sourceSchema, Schema => $info->{Schema}, Parent => $node, Message => $this->messageMin