From 801f1db41faee3a60541a94b99a06cba228c4337 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 2 May 2007 13:52:54 +0000 Subject: [PATCH] modify_xml_document()'s code for no-opping when no change has been made now also works for present-but-empty fields. --- lib/ZOOM/IRSpy/Utils.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index 09f6b8f..6049e93 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -1,4 +1,4 @@ -# $Id: Utils.pm,v 1.29 2007-05-01 15:29:36 mike Exp $ +# $Id: Utils.pm,v 1.30 2007-05-02 13:52:54 mike Exp $ package ZOOM::IRSpy::Utils; @@ -232,21 +232,21 @@ sub modify_xml_document { # we'll check whether the element is already # canonical, to determine whether our change is a # no-op. - my $old = "???"; + my $old = ""; my @children = $node->childNodes(); if (@children == 1) { my $child = $node->firstChild(); if (ref $child && ref $child eq "XML::LibXML::Text") { $old = $child->getData(); - next if $value eq $old; } } + next if $value eq $old; $node->removeChildNodes(); my $child = new XML::LibXML::Text($value); $node->appendChild($child); push @changes, $ref; - #print "Elem $key: '$old' -> '$value' ($xpath)
\n"; + print STDERR "Elem $key: '$old' -> '$value' ($xpath)
\n"; } else { warn "unexpected node type $node"; } -- 1.7.10.4