comparison Lib/IMPL/DOM/Schema/ComplexType.pm @ 105:a6e9759ff88a

Fixed a validation errors parameters
author wizard
date Tue, 11 May 2010 02:59:49 +0400
parents c289ed9662ca
children e30bdd040fe3
comparison
equal deleted inserted replaced
104:196bf443b5e1 105:a6e9759ff88a
28 $this->{$nativeType} = $args{nativeType}; 28 $this->{$nativeType} = $args{nativeType};
29 $this->{$messageWrongType} = $args{messageWrongType} || "A complex node '%Node.path%' is expected to be %Schema.nativeType%"; 29 $this->{$messageWrongType} = $args{messageWrongType} || "A complex node '%Node.path%' is expected to be %Schema.nativeType%";
30 } 30 }
31 31
32 sub Validate { 32 sub Validate {
33 my ($this, $node) = @_; 33 my ($this, $node,$ctx) = @_;
34 34
35 if ($this->{$nativeType}) { 35 if ($this->{$nativeType}) {
36 return new IMPL::DOM::Schema::ValidationError( 36 return new IMPL::DOM::Schema::ValidationError(
37 Node => $node, 37 Node => $node,
38 Source => $this, 38 Source => $ctx && $ctx->{Source} || $this,
39 Schema => $this, 39 Schema => $this,
40 Message => $this->messageWrongType 40 Message => $this->messageWrongType
41 ) unless $node->isa($this->{$nativeType}); 41 ) unless $node->isa($this->{$nativeType});
42 } 42 }
43 return $this->SUPER::Validate($node); 43 return $this->SUPER::Validate($node,$ctx);
44 } 44 }
45 45
46 sub qname { 46 sub qname {
47 $_[0]->nodeName.'[type='.$_[0]->type.']'; 47 $_[0]->nodeName.'[type='.$_[0]->type.']';
48 } 48 }