annotate Lib/IMPL/DOM/Schema/Node.pm @ 46:75148ccd732d

Upgrading resources
author Sergey
date Tue, 02 Feb 2010 17:09:49 +0300
parents c2e7f7c96bcd
children 16ada169ca75
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 {
24
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
11 public _direct property minOccur => prop_all;
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
12 public _direct property maxOccur => prop_all;
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
13 public _direct property type => prop_all;
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
14 public _direct 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
24
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
24 $this->{$minOccur} = defined $args{minOccur} ? $args{minOccur} : 1;
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
25 $this->{$maxOccur} = defined $args{maxOccur} ? $args{maxOccur} : 1;
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
26 $this->{$type} = $args{type};
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
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
37
c2e7f7c96bcd performance improvements, DOM reworked (a little)
Sergey
parents: 24
diff changeset
33 if (my $schemaType = $this->{$type} ? $this->document->resolveType($this->{$type}) : undef ) {
19
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
24
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
40 sub qname {
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
41 $_[0]->nodeName.'[name='.$_[0]->{$name}.']';
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
42 }
7f00786f8210 Первая рабочая реазизация схемы и навигаторов
Sergey
parents: 20
diff changeset
43
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
44 1;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
45
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
46 __END__
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
47 =pod
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
48
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
49 =head1 SYNOPSIS
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
50
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
51 package Restriction;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
52 use base qw(IMPL::DOM::Schema::Item);
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
53
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
54 sub Validate {
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
55 my ($this,$node) = @_;
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
56 }
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
57
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
58 =head1 DESCRIPTION
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
59
20
267460284fb3 DOM Schema
Sergey
parents: 19
diff changeset
60 .
18
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
61
818c74b038ae DOM Schema + tests
Sergey
parents:
diff changeset
62 =cut