diff Lib/IMPL/DOM/Schema/Node.pm @ 24:7f00786f8210

Первая рабочая реазизация схемы и навигаторов
author Sergey
date Mon, 05 Oct 2009 00:48:49 +0400
parents 267460284fb3
children c2e7f7c96bcd
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/Node.pm	Wed Sep 30 17:43:52 2009 +0400
+++ b/Lib/IMPL/DOM/Schema/Node.pm	Mon Oct 05 00:48:49 2009 +0400
@@ -8,10 +8,10 @@
 use IMPL::Class::Property::Direct;
 
 BEGIN {
-    public property minOccur => prop_all;
-    public property maxOccur => prop_all;
-    public property type => prop_all;
-    public property name => prop_all;
+    public _direct property minOccur => prop_all;
+    public _direct property maxOccur => prop_all;
+    public _direct property type => prop_all;
+    public _direct property name => prop_all;
 }
 
 our %CTOR = (
@@ -21,22 +21,26 @@
 sub CTOR {
     my ($this,%args) = @_;
     
-    $this->minOccur(defined $args{minOccur} ? $args{minOccur} : 1);
-    $this->maxOccur(defined $args{maxOccur} ? $args{maxOccur} : 1);
-    $this->type($args{type});
-    $this->name($args{name}) or die new IMPL::InvalidArgumentException('Argument is required','name');
+    $this->{$minOccur} = defined $args{minOccur} ? $args{minOccur} : 1;
+    $this->{$maxOccur} = defined $args{maxOccur} ? $args{maxOccur} : 1;
+    $this->{$type} = $args{type};
+    $this->{$name} = $args{name} or die new IMPL::InvalidArgumentException('Argument is required','name');
 }
 
 sub Validate {
     my ($this,$node) = @_;
     
-    if (my $schemaType = $this->type ? $this->rootNode->resolveType($this->type) : undef ) {
+    if (my $schemaType = $this->{$type} ? $this->rootNode->resolveType($this->{$type}) : undef ) {
         return $schemaType->Validate($node);
     } else {
         return ();
     }
 }
 
+sub qname {
+    $_[0]->nodeName.'[name='.$_[0]->{$name}.']';
+}
+
 1;
 
 __END__