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

Первая рабочая реазизация схемы и навигаторов
author Sergey
date Mon, 05 Oct 2009 00:48:49 +0400
parents fafe56cfcd69
children dd4d72600c69
comparison
equal deleted inserted replaced
23:716b287d4795 24:7f00786f8210
165 165
166 my @result; 166 my @result;
167 167
168 if (ref $query eq 'CODE') { 168 if (ref $query eq 'CODE') {
169 @result = grep &$query($_), @{$this->childNodes}; 169 @result = grep &$query($_), @{$this->childNodes};
170 } elsif (ref $query eq 'ARRAY' ) {
171 my %keys = map (($_,1),@$query);
172 @result = grep $keys{$_->nodeName}, @{$this->childNodes};
170 } elsif (defined $query) { 173 } elsif (defined $query) {
171 @result = grep $_->nodeName eq $query, @{$this->childNodes}; 174 @result = grep $_->nodeName eq $query, @{$this->childNodes};
172 } else { 175 } else {
173 if (wantarray) { 176 if (wantarray) {
174 return @{$this->childNodes}; 177 return @{$this->childNodes};
244 } else { 247 } else {
245 return $this->{$_propertyMap}{$name}; 248 return $this->{$_propertyMap}{$name};
246 } 249 }
247 } 250 }
248 251
252 sub qname {
253 $_[0]->{$nodeName};
254 }
255
256 sub path {
257 my ($this) = @_;
258
259 if ($this->parentNode) {
260 return $this->parentNode->path.'.'.$this->qname;
261 } else {
262 return $this->qname;
263 }
264 }
265
249 1; 266 1;