49
|
1 package IMPL::DOM::Schema::Node;
|
|
2 use strict;
|
|
3 use warnings;
|
|
4
|
|
5 use base qw(IMPL::DOM::Node);
|
|
6 use IMPL::Class::Property;
|
|
7 use IMPL::DOM::Property qw(_dom);
|
|
8 use IMPL::Class::Property::Direct;
|
|
9
|
|
10 BEGIN {
|
|
11 public _direct property minOccur => prop_all;
|
|
12 public _direct property maxOccur => prop_all;
|
|
13 public _direct property type => prop_all;
|
|
14 public _direct property name => prop_all;
|
100
|
15 public _direct property display => prop_all;
|
|
16 public _direct property display_no => prop_all;
|
|
17 public _direct property display_blame => prop_all;
|
49
|
18 }
|
|
19
|
|
20 our %CTOR = (
|
|
21 'IMPL::DOM::Node' => sub {my %args = @_; $args{nodeName} ||= 'Node'; %args}
|
|
22 );
|
|
23
|
|
24 sub CTOR {
|
|
25 my ($this,%args) = @_;
|
|
26
|
|
27 $this->{$minOccur} = defined $args{minOccur} ? $args{minOccur} : 1;
|
|
28 $this->{$maxOccur} = defined $args{maxOccur} ? $args{maxOccur} : 1;
|
|
29 $this->{$type} = $args{type};
|
|
30 $this->{$name} = $args{name} or die new IMPL::InvalidArgumentException('Argument is required','name');
|
100
|
31 $this->{$display} = $args{display};
|
|
32 $this->{$display_no} = $args{display_no};
|
|
33 $this->{$display_blame} = $args{display_blame};
|
49
|
34 }
|
|
35
|
|
36 sub Validate {
|
|
37 my ($this,$node) = @_;
|
|
38
|
|
39 if (my $schemaType = $this->{$type} ? $this->document->resolveType($this->{$type}) : undef ) {
|
|
40 return $schemaType->Validate($node);
|
|
41 } else {
|
|
42 return ();
|
|
43 }
|
|
44 }
|
|
45
|
103
|
46 sub inflator { undef; }
|
|
47
|
49
|
48 sub qname {
|
|
49 $_[0]->nodeName.'[name='.$_[0]->{$name}.']';
|
|
50 }
|
|
51
|
|
52 1;
|
|
53
|
|
54 __END__
|
|
55 =pod
|
|
56
|
|
57 =head1 SYNOPSIS
|
|
58
|
|
59 package Restriction;
|
|
60 use base qw(IMPL::DOM::Schema::Item);
|
|
61
|
|
62 sub Validate {
|
|
63 my ($this,$node) = @_;
|
|
64 }
|
|
65
|
|
66 =head1 DESCRIPTION
|
|
67
|
|
68 Базовый класс для элементов схемы.
|
|
69
|
|
70 =cut
|