jccunning has asked for the wisdom of the Perl Monks concerning the following question:

Does XML::SemanticDiff only compare two files line by line in same location. Small test below indicates that two exact lines for DBUS in file are not detected. DBUS reported as rogue element.
#!/bin/perl use strict; use warnings; my $file = 'xml1.xml'; my $file2 = 'xml2.xml'; my $h = Myclass->new; # use XML::Parser; use XML::SemanticDiff; my $diff = XML::SemanticDiff->new(diffhandler => $h, keepdata => 1); $diff->compare($file, $file2); package Myclass; use Data::Dumper; sub new { bless {}, shift } sub attribute_value { my ($self, $attr_name, $element, $to_props, $from_props) = @_; print "\n\nattribute value\n"; print Dumper($self, $attr_name, $element, $to_props, $from_props); } sub rogue_element { my ( $self, $name, $props ) = @_; print "\n\nrogue element\n"; print Dumper($self, $name, $props); }

Sample xml1 file

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noName +spaceSchemaLocation="panoply.xsd"> <classes name="Panoply::AccessLogic"> <all_members name="accessLogic" protection="public"/> <all_members name="DBUS" protection="public"/> </classes> </root>

Sample xml2 file

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noName +spaceSchemaLocation="panoply.xsd"> <classes name="Panoply::AccessLogic"> <all_members name="accessLogic" protection="public"/> <all_members name="APR" protection="public"/> <all_members name="DBUS" protection="public"/> </classes> </root>

Replies are listed 'Best First'.
Re: XML SemanticDiff output
by toolic (Bishop) on Jul 26, 2012 at 15:24 UTC
Re: XML SemanticDiff output
by choroba (Cardinal) on Jul 26, 2012 at 15:37 UTC
    It is probably done element by element rather than line by line.