Mercurial > pub > Impl
view Lib/IMPL/DOM/Schema/Node.pm @ 171:59e5fcb59d86
Исправления, изменена концепция веб-форм
author | sourcer |
---|---|
date | Mon, 06 Jun 2011 03:30:36 +0400 |
parents | 76515373dac0 |
children | d1676be8afcc |
line wrap: on
line source
package IMPL::DOM::Schema::Node; use strict; use warnings; use parent qw(IMPL::DOM::Node); use IMPL::Class::Property; use IMPL::DOM::Property qw(_dom); use IMPL::Class::Property::Direct; BEGIN { public _dom _direct property minOccur => prop_all; public _dom _direct property maxOccur => prop_all; public _dom _direct property type => prop_all; public _dom _direct property name => prop_all; public _dom _direct property display => prop_all; public _dom _direct property display_no => prop_all; public _dom _direct property display_blame => prop_all; } our %CTOR = ( 'IMPL::DOM::Node' => sub { my %args = @_; delete @args{qw( minOccur maxOccur type name display display_no display_blame )} ; $args{nodeName} ||= 'Node'; %args } ); sub CTOR { my ($this,%args) = @_; $this->{$minOccur} = defined $args{minOccur} ? $args{minOccur} : 1; $this->{$maxOccur} = defined $args{maxOccur} ? $args{maxOccur} : 1; $this->{$type} = $args{type}; $this->{$name} = $args{name} or die new IMPL::InvalidArgumentException('Argument is required','name'); $this->{$display} = $args{display} if $args{display}; $this->{$display_no} = $args{display_no} if $args{display}; $this->{$display_blame} = $args{display_blame} if $args{display}; } sub Validate { my ($this,$node) = @_; if (my $schemaType = $this->{$type} ? $this->document->resolveType($this->{$type}) : undef ) { my @errors = $schemaType->Validate($node,{Source => $this}); return @errors; } else { return (); } } sub inflateValue { $_[1]; } sub inflator { undef } sub qname { $_[0]->nodeName.'[name='.$_[0]->{$name}.']'; } 1; __END__ =pod =head1 SYNOPSIS package SchemaEntity; use parent qw(IMPL::DOM::Schema::Node); sub Validate { my ($this,$node) = @_; } =head1 DESCRIPTION . . =head1 MEMBERS =head2 PROPERTIES =over =item C<[get,set] minOccur> C<default: 1>. . =item C<[get,set] maxOccur> C<default: 1>. =item C<[get,set] type> C<default: undef> . =item C<[get,set] name> . =item C<[get,set] display> . =item C<[get,set] display_no> ( ). =item C<[get,set] display_blame> ( ). =back =cut