Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.

X Report information
Id: 2322
Status: resolved
Left: 0 min
Priority: 0/0
Queue: XML-SemanticDiff

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

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

X Attachments
12missing-element-has-o-as-cdata.t




X History Display mode: Brief headersFull headers
#   Tue Apr 01 08:46:17 2003 guest - Ticket created  
Subject: empty elements perhaps handled incorrectly
[text/plain 503b]
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.
#   Mon Jul 02 09:57:15 2007 SHLOMIF - Correspondence added  
[text/plain 1k]
On Tue Apr 01 08:46:17 2003, guest wrote:
> 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.

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


[text/x-troff 1k]
# 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."
);

#   Mon Jul 02 09:57:19 2007 RT_System - Status changed from 'new' to 'open'  
#   Sun Jul 08 04:39:50 2007 SHLOMIF - Correspondence added  
[text/plain 158b]
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.
#   Sun Jul 08 04:39:53 2007 SHLOMIF - Status changed from 'open' to 'resolved'