Subject: | Same tag name in different locations causes spurious change |
Attached below are two variations of the same XML file. Both have
<Description> tags at the root level and also one level deeper, inside
the <TimeZone> tag. They should be considered identical, but this short
example program erroneously reports that they are different.
use XML::SemanticDiff;
my $diff = XML::SemanticDiff->new();
foreach my $change ($diff->compare('derived.xml', 'orig.xml')) {
print "$change->{message}\n";
}
% perl compare.pl
Child element 'Description' missing from element
'/LocalPresentationManifest[1]/Properties[1]/TimeZone[1]'.
Rogue element 'Description' in element
'/LocalPresentationManifest[1]/Properties[1]/TimeZone[1]'.
Subject: | derived.xml |
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<LocalPresentationManifest>
<Properties>
<TimeZone>
<Description>(GMT-06:00) Central Time (US & Canada)</Description>
<Abbreviation>CST</Abbreviation>
<Identifier>19</Identifier>
<Name>Central Time</Name>
</TimeZone>
<Description>This presentation is a brief overview of the MediaLandscape Product and Serivce Offerings.</Description>
</Properties>
</LocalPresentationManifest>
Subject: | orig.xml |
<LocalPresentationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Properties>
<Description>This presentation is a brief overview of the MediaLandscape Product and Serivce Offerings.</Description>
<TimeZone>
<Identifier>19</Identifier>
<Name>Central Time</Name>
<Description>(GMT-06:00) Central Time (US & Canada)</Description>
<Abbreviation>CST</Abbreviation>
</TimeZone>
</Properties>
</LocalPresentationManifest>