ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
is there a way to check if one xml document is contained in another?
by Yishay Weiss other posts by this author
Sep 5 2005 12:44AM messages near this date
view in the new Beta List Site
Re: Getting XML Nodes based on attributes value | Re: is there a way to check if one xml document is contained in another?
& XSLT 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


_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Yishay Weiss
David Nicol
Yishay Weiss
Vaclav Barta
Yishay Weiss

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved