Mercurial > pub > Impl
comparison Lib/IMPL/DOM/Navigator/SchemaNavigator.pm @ 246:2746a8e5a6c4
Fixed regressions in DOM due previous refactorings
Fixed ObjectToDOM transformation to handle a schema with mixed node types
| author | sergey |
|---|---|
| date | Tue, 30 Oct 2012 01:17:31 +0400 |
| parents | 2904da230022 |
| children | 4ddb27ff4a0b |
comparison
equal
deleted
inserted
replaced
| 245:7c517134c42f | 246:2746a8e5a6c4 |
|---|---|
| 1 package IMPL::DOM::Navigator::SchemaNavigator; | 1 package IMPL::DOM::Navigator::SchemaNavigator; |
| 2 use strict; | 2 use strict; |
| 3 use warnings; | 3 use warnings; |
| 4 | 4 |
| 5 use parent qw(IMPL::DOM::Navigator); | |
| 6 use IMPL::Class::Property; | 5 use IMPL::Class::Property; |
| 7 use IMPL::Class::Property::Direct; | 6 use IMPL::Class::Property::Direct; |
| 8 | 7 |
| 9 require IMPL::DOM::Schema::ComplexType; | 8 require IMPL::DOM::Schema::ComplexType; |
| 10 require IMPL::DOM::Schema::NodeSet; | 9 require IMPL::DOM::Schema::NodeSet; |
| 11 require IMPL::DOM::Schema::AnyNode; | 10 require IMPL::DOM::Schema::AnyNode; |
| 12 | 11 |
| 13 __PACKAGE__->PassThroughArgs; | 12 use IMPL::declare { |
| 13 base => [ | |
| 14 'IMPL::DOM::Navigator' => '@_' | |
| 15 ] | |
| 16 }; | |
| 14 | 17 |
| 15 BEGIN { | 18 BEGIN { |
| 16 public _direct property Schema => prop_get; | 19 public _direct property Schema => prop_get; |
| 17 private _direct property _historySteps => prop_all; | 20 private _direct property _historySteps => prop_all; |
| 18 } | 21 } |
| 19 | 22 |
| 20 sub CTOR { | 23 sub CTOR { |
| 21 my ($this,$schema) = @_; | 24 my ($this,$schema) = @_; |
| 22 | 25 |
| 23 $this->{$Schema} = $schema; | 26 $this->{$Schema} = $schema->isa('IMPL::DOM::Schema::ComplexNode') ? $schema->document : $schema; |
| 24 | 27 |
| 25 die new IMPL::InvalidArgumentException("A schema object is required") unless $schema->isa('IMPL::DOM::Schema') || $schema->isa('IMPL::DOM::Schema::ComplexNode'); | 28 die new IMPL::InvalidArgumentException("A schema object is required") unless ref $this->{$Schema} && eval { $this->{$Schema}->isa('IMPL::DOM::Schema') }; |
| 26 } | 29 } |
| 27 | 30 |
| 28 my $schemaAnyNode = IMPL::DOM::Schema::ComplexType->new(type => '::AnyNodeType', nativeType => 'IMPL::DOM::ComplexNode')->appendRange( | 31 my $schemaAnyNode = IMPL::DOM::Schema::ComplexType->new(type => '::AnyNodeType', nativeType => 'IMPL::DOM::ComplexNode')->appendRange( |
| 29 IMPL::DOM::Schema::NodeSet->new()->appendRange( | 32 IMPL::DOM::Schema::NodeSet->new()->appendRange( |
| 30 IMPL::DOM::Schema::AnyNode->new() | 33 IMPL::DOM::Schema::AnyNode->new() |
