-#ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
-print "The record has been updated (nchanges=$nchanges).\n";
+print("Document modified with $nchanges change", $nchanges == 1 ? "" : "s",
+ ": ", join(", ", map { $_->[2] } @changedFields), "\n");
+
+if ($opts{w}) {
+ ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
+ print "Rewrote record '$id'\n";
+}
+
+if ($opts{n}) {
+ foreach my $key (sort keys %data) {
+ my $ref = $fieldsByKey{$key};
+ my($name, $nlines, $caption, $xpath, @addAfter) = @$ref;
+ print "New $caption ($xpath) = '", $xc->findvalue($xpath), "'\n";
+ }
+}
+
+if ($opts{x}) {
+ print $newText;
+}