Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: archier [...] yahoo.com
Cc:
AdminCc:

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



Subject: too many warning messages
in SemanticDiff 0.95 i get warnings about uninitialized values in comparisons at line 74 and 66--places where the namespace uris and text checksums are compared. i'm comparing two pretty big files, i can send them if they're requested. i think the diff itself might be working alright, but for my comparison i got about 30 warnings i'm running on solaris 2.8, perl 5.6.1. warnings spots are below. thanks for any help. a 74: unless ($from_doc->{$element}->{NamespaceURI} eq $to_doc->{$element}->{NamespaceURI}) { 66: unless ($from_doc->{$element}->{TextChecksum} eq $to_doc->{$element}->{TextChecksum}) {
Subject: too many warning messages -- some details
[guest - Thu Aug 1 21:09:57 2002]: update on this bug, i put a few print statements in, it looks like when this happens the textchecksum is undefined for both the first doc and the second. i looked through the code and couldn't quite see why this was the case. Show quoted text
> > in SemanticDiff 0.95 > > i get warnings about uninitialized values in comparisons at line 74 > and 66--places where the namespace uris and text checksums are > compared. i'm comparing two pretty big files, i can send them if > they're requested. i think the diff itself might be working > alright, but for my comparison i got about 30 warnings > > i'm running on solaris 2.8, perl 5.6.1. warnings spots are below. > thanks for any help. > > a > > > 74: > unless ($from_doc->{$element}->{NamespaceURI} eq $to_doc-
> >{$element}->{NamespaceURI}) {
> > 66: > unless ($from_doc->{$element}->{TextChecksum} eq $to_doc-
> >{$element}->{TextChecksum}) {
From: dom [...] semantico.com
[guest - Thu Aug 1 21:24:17 2002]: Show quoted text
> [guest - Thu Aug 1 21:09:57 2002]: > > update on this bug, i put a few print statements in, it looks like > when this happens the textchecksum is undefined for both the first doc > and the second. > > i looked through the code and couldn't quite see why this was the case.
I've been looking at this myself and I've just figured out why. It's because you have identically named elements in the same tree. Following my investigation backwards... TextChecksum is undefined because it's in a different element to the expected one. If you insert a call to Data::Dumper of $from_doc and $to_doc, you can see your element is in two places, one as /element[0] and one as /element[1]. Going further backwards to find out why this is the case, I looked at EndTag(). In there, $position_index->{element} is wrongly 0. It turns out that this is because of some code commented as "reset the element counter" is setting it to zero. Looking at the code, it appears that it happens in circumstances like these: <foo> <bar> <foo>oops!</foo> </bar> </foo> I made the warnings go away by using the attached patch, but it's wrong because it only works in the case of the parent element actually being in position 1... I'm not sure what the proper fix is. I'll keep working on it. XML::SemanticDiff rules as a module, BTW. :-) -Dom
--- /opt/projects/sitegroup/tandf2/5.8.0/XML/SemanticDiff.pm Tue Apr 9 09:57:59 2002 +++ /home/dom/libs/XML/SemanticDiff.pm Wed Apr 16 12:39:12 2003 @@ -201,7 +201,7 @@ foreach my $child (@{$descendents->{$element}}) { next if $seen->{$child}; # reset the relative counter - $position_index->{$child} = 0; + $position_index->{$child} = 1; $seen->{$child}++; } }
See: http://www.shlomifish.org/Files/files/code/perl/XML-SemanticDiff-0.95.tar.gz For a modified version of XML-SD that contains a fix to this problem. It adds a test and some fixes.
From: SHLOMIF [...] cpan.org
Hi all! On Fri Sep 08 03:35:24 2006, SHLOMIF wrote: Show quoted text
> See: > >
http://www.shlomifish.org/Files/files/code/perl/XML-SemanticDiff-0.95.tar.gz Show quoted text
> > For a modified version of XML-SD that contains a fix to this
problem. Show quoted text
> It adds a test and some fixes.
The latest version is available here: http://svn.berlios.de/svnroot/repos/web-cpan/XML-SemanticDiff/trunk/ Regards, Shlomi Fish
Fixed in the version uploaded to the CPAN - 0.96.