diff Lib/IMPL/DOM/Schema/ValidationError.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 cf3b6ef2be22
children a4b0a819bbda
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/ValidationError.pm	Fri May 07 18:17:40 2010 +0400
+++ b/Lib/IMPL/DOM/Schema/ValidationError.pm	Tue May 11 02:42:59 2010 +0400
@@ -2,17 +2,21 @@
 use strict;
 use warnings;
 
+use overload
+    '""' => \&toString,
+    'fallback' => 1;
+
 use base qw(IMPL::Object);
 use IMPL::Class::Property;
 use IMPL::Class::Property::Direct;
 use IMPL::Resources::Format qw(FormatMessage);
 
 BEGIN {
-    public _direct property Node => prop_get;
-    public _direct property Schema => prop_get;
-    public _direct property Source => prop_get;
-    public _direct property Parent => prop_get;
-    public _direct property Message => prop_get;
+    public _direct property Node => prop_get; # target document node (if exists)
+    public _direct property Schema => prop_get; # a schema for the target node (if exists) 
+    public _direct property Source => prop_get; # a schema which triggered this error (can be equal to the Schema)
+    public _direct property Parent => prop_get; 
+    public _direct property Message => prop_get; # displayable message
 }
 
 sub CTOR {
@@ -25,4 +29,9 @@
     $this->{$Message} = FormatMessage(delete $args{Message}, \%args) if $args{Message};
 }
 
+sub toString {
+	(my $this) = @_;
+	return $this->Message;
+}
+
 1;