XML-SemanticDiff - is there a way to check if one xml document is contained in another?

Posted on Mon Aug 29 17:45:39 2005 by yishay
is there a way to check if one xml document is contained in another?

Hi,

SemanticDiff works well for testing identity of two xml documents. However, what if I want to check if source document is contained in destination document?

For example:

$src = q{ <a> <b name="B"/> <b name="C"/> <b name="D"/> </a>}; $dst = q{ <a> <b name="A"/> <b name="B"/> <b name="C"/> <b name="D"/> </a>}; use XML::SemanticDiff; my $diff = XML::SemanticDiff->new(); foreach my $change ($diff->compare($src, $dst)) { print "$change->{message} in context $change->{context}\n"; }
output:
Attribute 'name' has different value in element 'b'. in context /a[1]/b[1]
Attribute 'name' has different value in element 'b'. in context /a[1]/b[2]
Attribute 'name' has different value in element 'b'. in context /a[1]/b[3]
Rogue element 'b' in element '/a[1]'. in context /a[1]

=======

All messages except the last I'd like to disregard programatically. Has anyone done this? Any ideas?

Thanks in advance, Yishay

Write a response