18
|
1 package IMPL::DOM::Navigator::SchemaNavigator;
|
|
2 use strict;
|
|
3 use warnings;
|
|
4
|
|
5 use base qw(IMPL::DOM::Navigator);
|
|
6 use IMPL::Class::Property;
|
|
7 use IMPL::Class::Property::Direct;
|
|
8
|
|
9 __PACKAGE__->PassThroughArgs;
|
|
10
|
|
11 BEGIN {
|
|
12 public _direct property Schema => prop_get;
|
|
13 }
|
|
14
|
|
15 sub CTOR {
|
|
16 my ($this,$schema) = @_;
|
|
17
|
|
18 $this->{$Schema} = $schema;
|
|
19
|
|
20 die new IMPL::InvalidArgumentException("A schema object is required") unless $schema->isa('IMPL::DOM::Schema');
|
|
21 }
|
|
22
|
|
23 sub Navigate {
|
|
24 my ($this,$query) = @_;
|
|
25
|
|
26 if (my ($newNode) = $this->Current->selectNodes($query)) {
|
|
27 if (ref $newNode eq 'IMPL::DOM::Schema::Node') {
|
|
28 $newNode = $this->{$Schema}->ResolveType($newNode->type) || $newNode;
|
|
29 }
|
|
30 return $this->_NavigateNode($newNode);
|
|
31 } else {
|
|
32 return undef;
|
|
33 }
|
|
34 }
|
|
35
|
|
36 1;
|
|
37 __END__
|
|
38
|
|
39 =pod
|
|
40
|
|
41 =head1 DESCRIPTION
|
|
42
|
|
43 , , <Node nodeName="SomeName" type="ReferencedType"/>.
|
|
44 .
|
|
45
|
|
46 =cut |