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

Первая рабочая реазизация схемы и навигаторов
author Sergey
date Mon, 05 Oct 2009 00:48:49 +0400
parents fafe56cfcd69
children dd4d72600c69
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Node.pm	Wed Sep 30 17:43:52 2009 +0400
+++ b/Lib/IMPL/DOM/Node.pm	Mon Oct 05 00:48:49 2009 +0400
@@ -167,6 +167,9 @@
     
     if (ref $query eq 'CODE') {
         @result = grep &$query($_), @{$this->childNodes};
+    } elsif (ref $query eq 'ARRAY' ) {
+        my %keys = map (($_,1),@$query);
+        @result = grep $keys{$_->nodeName}, @{$this->childNodes};
     } elsif (defined $query) {
         @result = grep $_->nodeName eq $query, @{$this->childNodes};
     } else {
@@ -246,4 +249,18 @@
     }
 }
 
+sub qname {
+    $_[0]->{$nodeName};
+}
+
+sub path {
+    my ($this) = @_;
+    
+    if ($this->parentNode) {
+        return $this->parentNode->path.'.'.$this->qname;
+    } else {
+        return $this->qname;
+    }
+}
+
 1;