Skip Menu |

This queue is for tickets about the XML-SemanticDiff CPAN distribution.

Report information
The Basics
Id: 2322
Status: resolved
Priority: 0/
Queue: XML-SemanticDiff

People
Owner: Nobody in particular
Requestors: AWelch2 [...] northropgrumman.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: empty elements perhaps handled incorrectly
perl version => ActiveState binary build 633, v5.6.1 built for MSWin32-x86-multi-thread OS => Windows 2000 (also confirmed on RH 8.0) Description => When missing_element() is called for an empty element, then the value 'o' is found in CData, instead of a null string, which seems inappropriate. User error may be at work here as I am just starting to use this package. To reproduce, simply use a couple of test XML files with empty elements. This problem may afflict other callbacks, I am not sure.
On Tue Apr 01 08:46:17 2003, guest wrote: Show quoted text
> perl version => ActiveState binary build 633, v5.6.1 built for > MSWin32-x86-multi-thread > > OS => Windows 2000 (also confirmed on RH 8.0) > > Description => When missing_element() is called for an empty
element, Show quoted text
> then the value 'o' is found in CData, instead of a null string, > which seems inappropriate. User error may be at work here as I
am Show quoted text
> just starting to use this package. To reproduce, simply use a > couple of test XML files with empty elements. This problem may > afflict other callbacks, I am not sure.
Hello, guest. Per your instructions, I wrote the attached test script, and tested against it. It did not specify a "CData" at all in the structure. Maybe it was fixed since then. Next time, please take the time to write a testcase, that demonstrates how it fails. You can find the modifications here: http://svn.berlios.de/svnroot/repos/web-cpan/XML-SemanticDiff/trunk/ Note that this version is an off-shoot of the original module, which I created in order to fix the bugs I encountered in it. Regards, Shlomi Fish
# This is a regression test file for bug: # # http://rt.cpan.org/Ticket/Display.html?id=2322 # # It seems to already have been fixed by the time this test was written. use strict; use warnings; use Test::More tests => 1; use XML::SemanticDiff; package MyDiffHandler; sub new { my $class = shift; my $self = {}; bless $self, $class; $self->{save_CData} = []; return $self; } sub missing_element { my $self = shift; my ($elem, $properties) = @_; push @{$self->{save_CData}}, { cdata => $properties->{CData} }; return {}; } package main; my $handler = MyDiffHandler->new(); my $diff = XML::SemanticDiff->new(diffhandler => $handler); my $xml_with_empty_element = <<'EOF'; <root><b>Quark</b><hello /></root> EOF my $xml_without_empty_element = <<'EOF'; <root><b>Quark</b></root> EOF my @results = $diff->compare( $xml_with_empty_element, $xml_without_empty_element, ); # TEST is_deeply ($handler->{save_CData}, [ { cdata => undef } ], "Testing that the cdata for an empty element is the empty string." );
The testcase is available in the version in CPAN (0.96), and there's no testcase from the original poster. So resolving the bug until we find more about it.