summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5cb256b)
for all modified fields, instead of a simple modified-field count.
-# $Id: Utils.pm,v 1.15 2006-11-16 17:18:14 mike Exp $
+# $Id: Utils.pm,v 1.16 2006-11-29 17:22:00 mike Exp $
package ZOOM::IRSpy::Utils;
package ZOOM::IRSpy::Utils;
sub modify_xml_document {
my($xc, $fieldsByKey, $data) = @_;
sub modify_xml_document {
my($xc, $fieldsByKey, $data) = @_;
foreach my $key (keys %$data) {
my $value = $data->{$key};
my $ref = $fieldsByKey->{$key} or die "no field '$key'";
foreach my $key (keys %$data) {
my $value = $data->{$key};
my $ref = $fieldsByKey->{$key} or die "no field '$key'";
if ($node->isa("XML::LibXML::Attr")) {
if ($value ne $node->getValue()) {
$node->setValue($value);
if ($node->isa("XML::LibXML::Attr")) {
if ($value ne $node->getValue()) {
$node->setValue($value);
#print "Attr $key: '", $node->getValue(), "' -> '$value' ($xpath)<br/>\n";
}
} elsif ($node->isa("XML::LibXML::Element")) {
#print "Attr $key: '", $node->getValue(), "' -> '$value' ($xpath)<br/>\n";
}
} elsif ($node->isa("XML::LibXML::Element")) {
$node->removeChildNodes();
my $child = new XML::LibXML::Text($value);
$node->appendChild($child);
$node->removeChildNodes();
my $child = new XML::LibXML::Text($value);
$node->appendChild($child);
#print "Elem $key: '$old' -> '$value' ($xpath)<br/>\n";
} else {
warn "unexpected node type $node";
#print "Elem $key: '$old' -> '$value' ($xpath)<br/>\n";
} else {
warn "unexpected node type $node";
my($ppath, $selector) = $xpath =~ /(.*)\/(.*)/;
dom_add_node($xc, $ppath, $selector, $value, @addAfter);
#print "New $key ($xpath) = '$value'<br/>\n";
my($ppath, $selector) = $xpath =~ /(.*)\/(.*)/;
dom_add_node($xc, $ppath, $selector, $value, @addAfter);
#print "New $key ($xpath) = '$value'<br/>\n";