diff 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
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Navigator/SchemaNavigator.pm	Mon Oct 29 03:15:22 2012 +0400
+++ b/Lib/IMPL/DOM/Navigator/SchemaNavigator.pm	Tue Oct 30 01:17:31 2012 +0400
@@ -2,7 +2,6 @@
 use strict;
 use warnings;
 
-use parent qw(IMPL::DOM::Navigator);
 use IMPL::Class::Property;
 use IMPL::Class::Property::Direct;
 
@@ -10,7 +9,11 @@
 require IMPL::DOM::Schema::NodeSet;
 require IMPL::DOM::Schema::AnyNode;
 
-__PACKAGE__->PassThroughArgs;
+use IMPL::declare {
+    base => [
+        'IMPL::DOM::Navigator' => '@_'
+    ]
+};
 
 BEGIN {
     public _direct property Schema => prop_get;
@@ -20,9 +23,9 @@
 sub CTOR {
     my ($this,$schema) = @_;
     
-    $this->{$Schema} = $schema;
+    $this->{$Schema} = $schema->isa('IMPL::DOM::Schema::ComplexNode') ? $schema->document : $schema;
     
-    die new IMPL::InvalidArgumentException("A schema object is required") unless $schema->isa('IMPL::DOM::Schema') || $schema->isa('IMPL::DOM::Schema::ComplexNode');
+    die new IMPL::InvalidArgumentException("A schema object is required") unless ref $this->{$Schema} && eval { $this->{$Schema}->isa('IMPL::DOM::Schema') };
 }
 
 my $schemaAnyNode = IMPL::DOM::Schema::ComplexType->new(type => '::AnyNodeType', nativeType => 'IMPL::DOM::ComplexNode')->appendRange(