annotate Lib/IMPL/DOM/Schema/Node.pm @ 22:da5bc24b3d3c

wmi tests
author Sergey
date Wed, 30 Sep 2009 17:41:32 +0400
parents 267460284fb3
children 7f00786f8210
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
1 package IMPL::DOM::Schema::Node;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
2 use strict;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
3 use warnings;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
4
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
5 use base qw(IMPL::DOM::Node);
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
6 use IMPL::Class::Property;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
7 use IMPL::DOM::Property qw(_dom);
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
8 use IMPL::Class::Property::Direct;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
9
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
10 BEGIN {
19
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
11 public property minOccur => prop_all;
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
12 public property maxOccur => prop_all;
20
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
13 public property type => prop_all;
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
14 public property name => prop_all;
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
15 }
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
16
20
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
17 our %CTOR = (
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
18 'IMPL::DOM::Node' => sub {my %args = @_; $args{nodeName} ||= 'Node'; %args}
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
19 );
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
20
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
21 sub CTOR {
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
22 my ($this,%args) = @_;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
23
20
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
24 $this->minOccur(defined $args{minOccur} ? $args{minOccur} : 1);
19
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
25 $this->maxOccur(defined $args{maxOccur} ? $args{maxOccur} : 1);
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
26 $this->type($args{type});
20
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
27 $this->name($args{name}) or die new IMPL::InvalidArgumentException('Argument is required','name');
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
28 }
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
29
19
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
30 sub Validate {
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
31 my ($this,$node) = @_;
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
32
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
33 if (my $schemaType = $this->type ? $this->rootNode->resolveType($this->type) : undef ) {
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
34 return $schemaType->Validate($node);
20
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
35 } else {
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
36 return ();
19
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
37 }
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
38 }
1ca530e5c9c5 DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
Sergey
parents: 18
diff changeset
39
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
40 1;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
41
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
42 __END__
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
43 =pod
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
44
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
45 =head1 SYNOPSIS
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
46
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
47 package Restriction;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
48 use base qw(IMPL::DOM::Schema::Item);
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
49
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
50 sub Validate {
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
51 my ($this,$node) = @_;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
52 }
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
53
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
54 =head1 DESCRIPTION
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
55
20
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
56 .
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
57
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
58 =cut