annotate Lib/IMPL/DOM/Schema.pm @ 230:6d8092d8ce1b

*reworked IMPL::Security *reworked IMPL::Web::Security *refactoring
author sergey
date Mon, 08 Oct 2012 03:37:37 +0400
parents 4d0e1962161c
children 5c82eec23bb6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
1 package IMPL::DOM::Schema;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
4
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
5 use IMPL::require {
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
6 ComplexNode => 'IMPL::DOM::Schema::ComplexNode',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
7 ComplexType => 'IMPL::DOM::Schema::ComplexType',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
8 SimpleNode => 'IMPL::DOM::Schema::SimpleNode',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
9 SimpleType => 'IMPL::DOM::Schema::SimpleType',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
10 Node => 'IMPL::DOM::Schema::Node',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
11 AnyNode => 'IMPL::DOM::Schema::AnyNode',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
12 NodeList => 'IMPL::DOM::Schema::NodeList',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
13 NodeSet => 'IMPL::DOM::Schema::NodeSet',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
14 Property => 'IMPL::DOM::Schema::Property',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
15 SwitchNode => 'IMPL::DOM::Schema::SwitchNode',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
16 Validator => 'IMPL::DOM::Schema::Validator',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
17 Builder => 'IMPL::DOM::Navigator::Builder',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
18 XMLReader => 'IMPL::DOM::XMLReader',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
19 InflateFactory => 'IMPL::DOM::Schema::InflateFactory',
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
20 Loader => 'Code::Loader'
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
21 };
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
22
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 152
diff changeset
23 use parent qw(IMPL::DOM::Document);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
24 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
25 use IMPL::Class::Property::Direct;
101
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
26 use File::Spec;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
27
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
28 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
29 'IMPL::DOM::Document' => sub { nodeName => 'schema' }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
30 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
31
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
32 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
33 private _direct property _TypesMap => prop_all;
101
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
34 public _direct property baseDir => prop_all;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
35 public _direct property BaseSchemas => prop_get | owner_set;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
36 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
37
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
38 my $validatorLoader = Loader->new(prefix => Validator, verifyNames => 1);
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
39
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
40 sub resolveType {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
41 $_[0]->{$_TypesMap}->{$_[1]};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
42 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
43
102
cf3b6ef2be22 Schema beta version
wizard
parents: 101
diff changeset
44 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
45 my ($this,%args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
46
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
47 $this->{$baseDir} = ($args{baseDir} || '.');
102
cf3b6ef2be22 Schema beta version
wizard
parents: 101
diff changeset
48 }
cf3b6ef2be22 Schema beta version
wizard
parents: 101
diff changeset
49
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
50 sub Create {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
51 my ($this,$nodeName,$class,$refArgs) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
52
100
df6b4f054957 Schema in progress
wizard
parents: 98
diff changeset
53 die new IMPL::Exception('Invalid node class') unless $class->isa('IMPL::DOM::Node');
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
54
101
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
55 if ($class->isa('IMPL::DOM::Schema::Validator')) {
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
56 $class = $validatorLoader->GetFullName($nodeName);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
57 unless (eval {$class->can('new')}) {
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
58 $validatorLoader->Require($nodeName);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
59 die new IMPL::Exception("Invalid validator",$class,$e) if $e;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
60 }
101
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
61 }
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
62
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
63 return $this->SUPER::Create($nodeName,$class,$refArgs);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
64 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
65
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
66 sub Process {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
67 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
68
101
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
69 # process instructions
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
70 $this->Include($_) foreach map $_->nodeProperty('source'), $this->selectNodes('Include');
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
71
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
72 # build types map
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
73 $this->{$_TypesMap} = { map { $_->type, $_ } $this->selectNodes(sub { $_[0]->nodeName eq 'ComplexType' || $_[0]->nodeName eq 'SimpleType' } ) };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
74 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
75
101
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
76 sub Include {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
77 my ($this,$file) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
78
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
79 my $schema = $this->LoadSchema(File::Spec->catfile($this->baseDir, $file));
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
80
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
81 $this->appendRange( $schema->childNodes );
101
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
82 }
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
83
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
84 sub LoadSchema {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
85 my ($this,$file) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
86
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
87 $file = File::Spec->rel2abs($file);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
88
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
89 my $class = ref $this || $this;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
90
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
91 my $reader = Reader->(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
92 Navigator => Builder->new(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
93 $class,
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
94 $class->MetaSchema
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
95 ),
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
96 SkipWhitespace => 1
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
97 );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
98
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
99 $reader->ParseFile($file);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
100
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
101 my $schema = $reader->Navigator->Document;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
102
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
103 my ($vol,$dir) = File::Spec->splitpath($file);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
104
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
105 $schema->baseDir($dir);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
106
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
107 my @errors = $class->MetaSchema->Validate($schema);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
108
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
109 die new IMPL::Exception("Schema is invalid",$file,map( $_->Message, @errors ) ) if @errors;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
110
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
111 $schema->Process;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
112
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
113 return $schema;
101
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
114 }
d8dc6cad3f55 Schema in progress
wizard
parents: 100
diff changeset
115
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
116 sub Validate {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
117 my ($this,$node) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
118
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
119 if ( my ($schemaNode) = $this->selectNodes(sub { $_->isa(Node) and $_[0]->name eq $node->nodeName })) {
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
120 $schemaNode->Validate($node);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
121 } else {
126
c8dfbbdd8005 Several bug fixes
wizard
parents: 104
diff changeset
122 return new IMPL::DOM::Schema::ValidationError(Node => $node, Message=> "A specified document (%Node.nodeName%) doesn't match the schema");
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
123 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
124 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
125
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
126 my $schema;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
127
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
128 sub MetaSchema {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
129
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
130 return $schema if $schema;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
131
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
132 $schema = Schema->new();
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
133
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
134 $schema->appendRange(
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
135 ComplexNode->new(name => 'schema')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
136 NodeSet->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
137 Node->new(name => 'ComplexNode', type => 'ComplexNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
138 Node->new(name => 'ComplexType', type => 'ComplexType', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
139 Node->new(name => 'SimpleNode', type => 'SimpleNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
140 Node->new(name => 'SimpleType', type => 'SimpleType', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
141 Node->new(name => 'Node', type => 'Node', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
142 SimpleNode->new(name => 'Include', minOccur => 0, maxOccur=>'unbounded')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
143 Property->new(name => 'source')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
144 )
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
145 ),
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
146 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
147 ComplexType->new(type => 'NodeSet', nativeType => 'IMPL::DOM::Schema::NodeSet')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
148 NodeSet->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
149 Node->new(name => 'ComplexNode', type => 'ComplexNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
150 Node->new(name => 'SimpleNode', type => 'SimpleNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
151 Node->new(name => 'Node', type=>'Node', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
152 SwitchNode->new(minOccur => 0, maxOccur => 1)->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
153 Node->new(name => 'AnyNode', type => 'AnyNode'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
154 Node->new(name => 'SwitchNode',type => 'SwitchNode')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
155 )
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
156 )
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
157 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
158 ComplexType->new(type => 'SwitchNode', nativeType => 'IMPL::DOM::Schema::SwitchNode')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
159 NodeSet->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
160 Node->new(name => 'ComplexNode', type=>'ComplexNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
161 Node->new(name => 'SimpleNode', type=>'SimpleNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
162 Node->new(name => 'Node', type=>'Node', minOccur => 0, maxOccur=>'unbounded'),
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
163 )
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
164 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
165 ComplexType->new(type => 'NodeList', nativeType => 'IMPL::DOM::Schema::NodeList')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
166 NodeSet->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
167 Node->new(name => 'ComplexNode', type => 'ComplexNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
168 Node->new(name => 'SimpleNode', type => 'SimpleNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
169 Node->new(name => 'SwitchNode',type => 'SwitchNode', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
170 Node->new(name => 'Node', type => 'Node', minOccur => 0, maxOccur=>'unbounded'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
171 Node->new(name => 'AnyNode', type => 'AnyNode', minOccur => 0, maxOccur=>'unbounded'),
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
172 )
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
173 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
174 ComplexType->new(type => 'ComplexType', nativeType => 'IMPL::DOM::Schema::ComplexType')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
175 NodeList->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
176 SwitchNode->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
177 Node->new(name => 'NodeSet', type => 'NodeSet'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
178 Node->new(name => 'NodeList',type => 'NodeList'),
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
179 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
180 Node->new(name => 'Property', type=>'Property', maxOccur=>'unbounded', minOccur=>0),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
181 AnyNode->new(maxOccur => 'unbounded', minOccur => 0, type=>'Validator')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
182 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
183 Property->new(name => 'type')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
184 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
185 ComplexType->new(type => 'ComplexNode', nativeType => 'IMPL::DOM::Schema::ComplexNode')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
186 NodeList->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
187 SwitchNode->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
188 Node->new(name => 'NodeSet', type => 'NodeSet'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
189 Node->new(name => 'NodeList',type => 'NodeList'),
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
190 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
191 Node->new(name => 'Property', type=>'Property', maxOccur=>'unbounded', minOccur=>0),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
192 AnyNode->new(maxOccur => 'unbounded', minOccur => 0, type=>'Validator')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
193 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
194 Property->new(name => 'name')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
195 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
196 ComplexType->new(type => 'SimpleType', nativeType => 'IMPL::DOM::Schema::SimpleType')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
197 NodeList->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
198 Node->new(name => 'Property', type=>'Property', maxOccur=>'unbounded', minOccur=>0),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
199 AnyNode->new(maxOccur => 'unbounded', minOccur => 0, type=>'Validator')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
200 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
201 Property->new(name => 'type'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
202 Property->(name => 'inflator', optional => 1, inflator => 'IMPL::DOM::Schema::InflateFactory')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
203 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
204 ComplexType->new(type => 'SimpleNode', nativeType => 'IMPL::DOM::Schema::SimpleNode')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
205 NodeList->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
206 Node->new(name => 'Property', type=>'Property', maxOccur=>'unbounded', minOccur=>0),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
207 AnyNode->new(maxOccur => 'unbounded', minOccur => 0, type=>'Validator')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
208 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
209 Property->new(name => 'name'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
210 Property->new(name => 'inflator', optional => 1, inflator => 'IMPL::DOM::Schema::InflateFactory')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
211 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
212 ComplexType->new(type => 'Validator', nativeType => 'IMPL::DOM::Schema::Validator')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
213 NodeList->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
214 AnyNode->new(maxOccur => 'unbounded', minOccur => 0)
100
df6b4f054957 Schema in progress
wizard
parents: 98
diff changeset
215 )
102
cf3b6ef2be22 Schema beta version
wizard
parents: 101
diff changeset
216 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
217 ComplexType->new(type => 'Property', nativeType => 'IMPL::DOM::Schema::Property' )->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
218 NodeList->new()->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
219 AnyNode->new(maxOccur => 'unbounded', minOccur => 0)
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
220 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
221 Property->new(name => 'name'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
222 Property->new(name => 'inflator', optional => 1, inflator => 'IMPL::DOM::Schema::InflateFactory')
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
223 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
224 SimpleType->new(type => 'Node', nativeType => 'IMPL::DOM::Schema::Node')->appendRange(
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
225 Property->new(name => 'name'),
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
226 Property->new(name => 'type')
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
227 ),
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 194
diff changeset
228 SimpleType->new(type => 'AnyNode', nativeType => 'IMPL::DOM::Schema::AnyNode')
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
229 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
230
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
231 $schema->Process;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
232
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
233 return $schema;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
234 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
235
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
236 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
237
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
238 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
239
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
240 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
241
98
00d88c5e8203 minor changes
wizard
parents: 49
diff changeset
242 =head1 NAME
00d88c5e8203 minor changes
wizard
parents: 49
diff changeset
243
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
244 C<IMPL::DOM::Schema> - Схема документа.
98
00d88c5e8203 minor changes
wizard
parents: 49
diff changeset
245
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
246 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
247
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 152
diff changeset
248 C<use parent qw(IMPL::DOM::Document)>
98
00d88c5e8203 minor changes
wizard
parents: 49
diff changeset
249
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
250 DOM схема - это документ, состоящий из определенных узлов, описывающая структуру
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
251 других документов.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
252
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
253 =head1 METHODS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
254
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
255 =over
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
256
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
257 =item C<< $obj->Process() >>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
258
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
259 Обновляет таблицу типов из содержимого.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
260
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
261 =item C<< $obj->ResolveType($typeName) >>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
262
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
263 Возвращает схему типа c именем C<$typeName>.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
264
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
265 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
266
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
267 =head1 META SCHEMA
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
268
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
269 Схема для описания схемы, эта схема используется для постороения других схем, выглядит приблизительно так
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
270
98
00d88c5e8203 minor changes
wizard
parents: 49
diff changeset
271 =begin code xml
00d88c5e8203 minor changes
wizard
parents: 49
diff changeset
272
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
273 <schema>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
274 <ComplexNode name="schema">
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
275 <NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
276 <Node minOcuur="0" maxOccur="unbounded" name="ComplexNode" type="ComplexNode"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
277 <Node minOcuur="0" maxOccur="unbounded" name="SimpleNode" type="SimpleNode"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
278 <Node minOcuur="0" maxOccur="unbounded" name="ComplexType" type="ComplexType"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
279 <Node minOcuur="0" maxOccur="unbounded" name="SimpleType" type="SimpleType"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
280 <SimpleNode minOcuur="0" maxOccur="unbounded" name="Node"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
281 <SimpleNode minOcuur="0" maxOccur="unbounded" name="Include"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
282 </NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
283 </ComplexNode>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
284
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
285 <ComplexType type="NodeContainer">
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
286 <NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
287 <Node minOcuur="0" maxOccur="unbounded" name="ComplexNode" type="ComplexNode"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
288 <Node minOcuur="0" maxOccur="unbounded" name="SimpleNode" type="SimpleNode"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
289 <SimpleNode minOcuur="0" maxOccur="unbounded" name="Node"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
290 </NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
291 </ComplexType>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
292
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
293 <ComplexType type="ComplexType">
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
294 <NodeList>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
295 <Node name="NodeSet" type="NodeContainer" minOcuur=0/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
296 <Node name="NodeList" type="NodeContainer" minOccur=0/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
297 <AnyNode minOccur="0" maxOccur="unbounded" type="Validator"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
298 </NodeList>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
299 </ComplexType>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
300
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
301 <ComplexType type="ComplexNode">
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
302 <NodeList>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
303 <Node name="NodeSet" type="NodeContainer" minOcuur=0/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
304 <Node name="NodeList" type="NodeContainer" minOccur=0/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
305 <AnyNode minOccur="0" maxOccur="unbounded" type="Validator"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
306 </NodeList>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
307 </ComplexType>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
308
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
309 <ComplexType type="SimpleNode">
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
310 <NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
311 <AnyNode minOccur=0 maxOccur="unbounded" type="Validator"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
312 </NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
313 </ComplexType>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
314
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
315 <ComplexType type="SimpleType">
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
316 <NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
317 <AnyNode minOccur=0 maxOccur="unbounded" type="Validator"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
318 </NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
319 </ComplexType>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
320
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
321 <ComplexType type="Validator">
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
322 <NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
323 <AnyNode minOccur=0 maxOccur="unbounded"/>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
324 </NodeSet>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
325 </ComplexType>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
326
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
327 </schema>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
328
98
00d88c5e8203 minor changes
wizard
parents: 49
diff changeset
329 =end code xml
00d88c5e8203 minor changes
wizard
parents: 49
diff changeset
330
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
331 =cut