diff Lib/IMPL/DOM/Navigator/Builder.pm @ 236:2904da230022

DOM refactoring
author sergey
date Mon, 15 Oct 2012 04:23:01 +0400
parents c8fe3f84feba
children b8c724f6de36
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Navigator/Builder.pm	Fri Oct 12 02:08:51 2012 +0400
+++ b/Lib/IMPL/DOM/Navigator/Builder.pm	Mon Oct 15 04:23:01 2012 +0400
@@ -2,6 +2,8 @@
 use strict;
 use warnings;
 
+use IMPL::Const qw(:prop);
+
 use parent qw(IMPL::DOM::Navigator);
 use IMPL::Class::Property;
 use IMPL::Class::Property::Direct;
@@ -10,10 +12,11 @@
 use IMPL::DOM::Document;
 
 BEGIN {
-    private _direct property _schemaNavi => prop_all;
-    private _direct property _docClass => prop_all;
-    public _direct property BuildErrors => prop_get | prop_list;
-    public _direct property Document => prop_get | owner_set;
+    private _direct property _schemaNavi => PROP_RW;
+    private _direct property _docClass => PROP_RW;
+    public _direct property BuildErrors => PROP_RO | PROP_LIST;
+    public _direct property Document => PROP_RO;
+    public _direct property ignoreUndefined => PROP_RO;
 }
 
 our %CTOR = (
@@ -21,10 +24,12 @@
 );
 
 sub CTOR {
-    my ($this,$docClass,$schema) = @_;
+    my ($this,$docClass,$schema,%opts) = @_;
     
     $this->{$_docClass} = $docClass;
     $this->{$_schemaNavi} = $schema ? IMPL::DOM::Navigator::SchemaNavigator->new($schema) : undef;
+    
+    $this->{$ignoreUndefined} = $opts{ignoreUndefined} if $opts{ignoreUndefined}; 
 }
 
 sub NavigateCreate {
@@ -54,11 +59,11 @@
             $this->BuildErrors->Append(
                 map {
                     IMPL::DOM::Schema::ValidationError->new(
-                        Node => $node,
-                        Source => $schemaSource,
-                        Schema => $schemaNode,
-                        Message => $schemaNode->messageInflateError,
-                        Error => $_
+                        node => $node,
+                        source => $schemaSource,
+                        schema => $schemaNode,
+                        message => $schemaNode->messageInflateError,
+                        error => $_
                     )                    
                 } @errors
             );
@@ -66,7 +71,9 @@
         
         return $node;
     } else {
-        die new IMPL::InvalidOperationException("The specified node is undefined", $nodeName);
+        die new IMPL::InvalidOperationException("The specified node is undefined", $nodeName)
+            if !$this->ingnoreUndefiend;
+        return;
     }
 }
 
@@ -128,6 +135,11 @@
     $this->SUPER::restoreState;
 }
 
+#compatibility
+sub buildErrors {
+    goto &BuildErrors;
+}
+
 1;
 
 __END__