diff Lib/IMPL/DOM/Schema/SimpleType.pm @ 104:196bf443b5e1

DOM::Schema RC0 inflators support, validation and some other things, Minor and major fixes almost for everything. A 'Source' property of the ValidationErrors generated from a NodeSet or a NodeList is subject to change in the future.
author wizard
date Tue, 11 May 2010 02:42:59 +0400
parents c289ed9662ca
children a6e9759ff88a
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/SimpleType.pm	Fri May 07 18:17:40 2010 +0400
+++ b/Lib/IMPL/DOM/Schema/SimpleType.pm	Tue May 11 02:42:59 2010 +0400
@@ -25,17 +25,17 @@
 sub CTOR {
     my ($this,%args) = @_;
     
-    $this->{$nativeType} = $args{nativeType};
+    $this->{$nativeType} = $args{nativeType} if $args{nativeType};
     $this->{$messageWrongType} = $args{messageWrongType} || "A simple node '%Node.path%' is expected to be %Schema.nativeType%"; 
 }
 
 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});