changeset 105:a6e9759ff88a

Fixed a validation errors parameters
author wizard
date Tue, 11 May 2010 02:59:49 +0400
parents 196bf443b5e1
children 83e356614c1e
files Lib/IMPL/DOM/Schema/ComplexNode.pm Lib/IMPL/DOM/Schema/ComplexType.pm Lib/IMPL/DOM/Schema/SimpleType.pm Lib/IMPL/DOM/Schema/Validator/RegExp.pm
diffstat 4 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/ComplexNode.pm	Tue May 11 02:42:59 2010 +0400
+++ b/Lib/IMPL/DOM/Schema/ComplexNode.pm	Tue May 11 02:59:49 2010 +0400
@@ -25,9 +25,9 @@
 }
 
 sub Validate {
-    my ($this,$node) = @_;
+    my ($this,$node,$ctx) = @_;
     
-    map $_->Validate($node), @{$this->childNodes};
+    map $_->Validate($node,$ctx), @{$this->childNodes};
 }
 
 1;
--- a/Lib/IMPL/DOM/Schema/ComplexType.pm	Tue May 11 02:42:59 2010 +0400
+++ b/Lib/IMPL/DOM/Schema/ComplexType.pm	Tue May 11 02:59:49 2010 +0400
@@ -30,17 +30,17 @@
 }
 
 sub Validate {
-	my ($this, $node) = @_;
+	my ($this, $node,$ctx) = @_;
 	
 	if ($this->{$nativeType}) {
 		return new IMPL::DOM::Schema::ValidationError(
 			Node => $node,
-			Source => $this,
+			Source => $ctx && $ctx->{Source} || $this,
 			Schema => $this,
 			Message => $this->messageWrongType
 		) unless $node->isa($this->{$nativeType});
 	}
-	return $this->SUPER::Validate($node);
+	return $this->SUPER::Validate($node,$ctx);
 }
 
 sub qname {
--- a/Lib/IMPL/DOM/Schema/SimpleType.pm	Tue May 11 02:42:59 2010 +0400
+++ b/Lib/IMPL/DOM/Schema/SimpleType.pm	Tue May 11 02:59:49 2010 +0400
@@ -40,7 +40,7 @@
 			Message => $this->messageWrongType
 		) unless $node->isa($this->{$nativeType});
 	}
-	return $this->SUPER::Validate($node);
+	return $this->SUPER::Validate($node,$ctx);
 }
 
 sub qname {
--- a/Lib/IMPL/DOM/Schema/Validator/RegExp.pm	Tue May 11 02:42:59 2010 +0400
+++ b/Lib/IMPL/DOM/Schema/Validator/RegExp.pm	Tue May 11 02:59:49 2010 +0400
@@ -28,7 +28,7 @@
 	my $rx = $this->nodeValue;
 	return new IMPL::DOM::Schema::ValidationError(
 		Node => $node,
-		Source => ( $ctx && $ctx->{Source} ) || $this->parentNode,
+		Source => $ctx && $ctx->{Source} || $this->parentNode,
 		Schema => $this->parentNode,
 		Message => $this->message
 	) unless (not $node->isComplex) and $node->nodeValue =~ /$rx/;