Mercurial > pub > Impl
comparison Lib/IMPL/DOM/Node.pm @ 152:1e7f03414b65
DOM: schema improvements
DOM: saving to XML::Writer feature
author | wizard |
---|---|
date | Thu, 23 Sep 2010 03:58:43 +0400 |
parents | e6447ad85cb4 |
children | 76515373dac0 |
comparison
equal
deleted
inserted
replaced
151:e36ffd8c29db | 152:1e7f03414b65 |
---|---|
315 sub firstChild { | 315 sub firstChild { |
316 @_ >=2 ? $_[0]->replaceNodeAt(0,$_[1]) : $_[0]->childNodes->[0]; | 316 @_ >=2 ? $_[0]->replaceNodeAt(0,$_[1]) : $_[0]->childNodes->[0]; |
317 } | 317 } |
318 | 318 |
319 sub _getIsComplex { | 319 sub _getIsComplex { |
320 $_[0]->childNodes->Count ? 1 : 0; | 320 ($_[0]->{$childNodes} and $_[0]->{$childNodes}->Count) ? 1 : 0; |
321 } | 321 } |
322 | 322 |
323 sub _updateDocRefs { | 323 sub _updateDocRefs { |
324 my ($this) = @_; | 324 my ($this) = @_; |
325 | 325 |
390 my %props = map {$_->Name, 1} $this->get_meta(typeof IMPL::Class::PropertyInfo, sub { $_->Attributes->{domProperty}},1); | 390 my %props = map {$_->Name, 1} $this->get_meta(typeof IMPL::Class::PropertyInfo, sub { $_->Attributes->{domProperty}},1); |
391 | 391 |
392 return (keys %props,keys %{$this->{$_propertyMap}}); | 392 return (keys %props,keys %{$this->{$_propertyMap}}); |
393 } | 393 } |
394 | 394 |
395 sub save { | |
396 my ($this,$writer) = @_; | |
397 | |
398 if ( not ( $this->isComplex or defined $this->{$nodeValue} ) ) { | |
399 $writer->emptyTag( | |
400 $this->{$nodeName}, | |
401 map { | |
402 $_, | |
403 $this->nodeProperty($_) | |
404 } grep defined $this->nodeProperty($_), $this->listProperties | |
405 ); | |
406 } else { | |
407 $writer->startTag( | |
408 $this->{$nodeName}, | |
409 map { | |
410 $_, | |
411 $this->nodeProperty($_) | |
412 } grep defined $this->nodeProperty($_), $this->listProperties | |
413 ); | |
414 $writer->characters($this->{$nodeValue}) if $this->{$nodeValue}; | |
415 | |
416 $_->save($writer) foreach $this->childNodes; | |
417 | |
418 $writer->endTag($this->{$nodeName}); | |
419 } | |
420 } | |
421 | |
395 sub qname { | 422 sub qname { |
396 $_[0]->{$nodeName}; | 423 $_[0]->{$nodeName}; |
397 } | 424 } |
398 | 425 |
399 sub path { | 426 sub path { |