Mercurial > pub > Impl
comparison 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 |
comparison
equal
deleted
inserted
replaced
103:c289ed9662ca | 104:196bf443b5e1 |
---|---|
1 package IMPL::DOM::Schema::ValidationError; | 1 package IMPL::DOM::Schema::ValidationError; |
2 use strict; | 2 use strict; |
3 use warnings; | 3 use warnings; |
4 | |
5 use overload | |
6 '""' => \&toString, | |
7 'fallback' => 1; | |
4 | 8 |
5 use base qw(IMPL::Object); | 9 use base qw(IMPL::Object); |
6 use IMPL::Class::Property; | 10 use IMPL::Class::Property; |
7 use IMPL::Class::Property::Direct; | 11 use IMPL::Class::Property::Direct; |
8 use IMPL::Resources::Format qw(FormatMessage); | 12 use IMPL::Resources::Format qw(FormatMessage); |
9 | 13 |
10 BEGIN { | 14 BEGIN { |
11 public _direct property Node => prop_get; | 15 public _direct property Node => prop_get; # target document node (if exists) |
12 public _direct property Schema => prop_get; | 16 public _direct property Schema => prop_get; # a schema for the target node (if exists) |
13 public _direct property Source => prop_get; | 17 public _direct property Source => prop_get; # a schema which triggered this error (can be equal to the Schema) |
14 public _direct property Parent => prop_get; | 18 public _direct property Parent => prop_get; |
15 public _direct property Message => prop_get; | 19 public _direct property Message => prop_get; # displayable message |
16 } | 20 } |
17 | 21 |
18 sub CTOR { | 22 sub CTOR { |
19 my ($this,%args) = @_; | 23 my ($this,%args) = @_; |
20 | 24 |
23 $this->{$Source} = $args{Source} if $args{Source}; | 27 $this->{$Source} = $args{Source} if $args{Source}; |
24 $this->{$Parent} = $args{Parent} if $args{Parent}; | 28 $this->{$Parent} = $args{Parent} if $args{Parent}; |
25 $this->{$Message} = FormatMessage(delete $args{Message}, \%args) if $args{Message}; | 29 $this->{$Message} = FormatMessage(delete $args{Message}, \%args) if $args{Message}; |
26 } | 30 } |
27 | 31 |
32 sub toString { | |
33 (my $this) = @_; | |
34 return $this->Message; | |
35 } | |
36 | |
28 1; | 37 1; |