annotate Lib/IMPL/DOM/Navigator/Builder.pm @ 13:bb8d67f811ea

merge heads
author Sergey
date Wed, 02 Sep 2009 23:11:14 +0400
parents 955b2324c1bf 75980091813b
children 65a7bb156fb7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
75980091813b DOM и навигация
Sergey
parents:
diff changeset
1 package IMPL::DOM::Navigator::Builder;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
2 use strict;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
3 use warnings;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
4
75980091813b DOM и навигация
Sergey
parents:
diff changeset
5 use base qw(IMPL::DOM::Navigator);
75980091813b DOM и навигация
Sergey
parents:
diff changeset
6 use IMPL::Class::Property;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
7 use IMPL::Class::Property::Direct;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
8
75980091813b DOM и навигация
Sergey
parents:
diff changeset
9 BEGIN {
75980091813b DOM и навигация
Sergey
parents:
diff changeset
10 protected _direct property _navigatorSchema => prop_all;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
11 public _direct property Document => prop_get | owner_set;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
12 }
75980091813b DOM и навигация
Sergey
parents:
diff changeset
13
75980091813b DOM и навигация
Sergey
parents:
diff changeset
14 __PACKAGE__->PassThroughArgs;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
15
75980091813b DOM и навигация
Sergey
parents:
diff changeset
16 sub CTOR {
75980091813b DOM и навигация
Sergey
parents:
diff changeset
17 my ($this,$domDocument,$schema) = @_;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
18
75980091813b DOM и навигация
Sergey
parents:
diff changeset
19 $this->{$Document} = $domDocument;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
20 $this->{$_navigatorSchema} = new IMPL::DOM::Navigator($schema);
75980091813b DOM и навигация
Sergey
parents:
diff changeset
21 }
75980091813b DOM и навигация
Sergey
parents:
diff changeset
22
75980091813b DOM и навигация
Sergey
parents:
diff changeset
23 sub NavigateCreate {
75980091813b DOM и навигация
Sergey
parents:
diff changeset
24 my ($this,$nodeName,%props) = @_;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
25
75980091813b DOM и навигация
Sergey
parents:
diff changeset
26 if ( my $nodeSchema = $this->{$_navigatorSchema}->Navigate($nodeName) ) {
75980091813b DOM и навигация
Sergey
parents:
diff changeset
27
75980091813b DOM и навигация
Sergey
parents:
diff changeset
28
75980091813b DOM и навигация
Sergey
parents:
diff changeset
29 } else {
75980091813b DOM и навигация
Sergey
parents:
diff changeset
30 die new IMPL::InvalidOperationException("Requested elemnt not found in the schema");
75980091813b DOM и навигация
Sergey
parents:
diff changeset
31 }
75980091813b DOM и навигация
Sergey
parents:
diff changeset
32 }
75980091813b DOM и навигация
Sergey
parents:
diff changeset
33
75980091813b DOM и навигация
Sergey
parents:
diff changeset
34 1;