<?xml version="1.0"?> <root> <el1 el1attr="good"/> <el2 el2attr="good">Some Text</el2> <el3/> </root> |
<?xml version="1.0"?> <root> <el1 el1attr="bad"/> <el2 bogus="true"/> <el4>Rogue</el4> </root> |
|
|
|
|
#!/usr/bin/perl -w use strict; use SOAP::Lite; ... my $soap = SOAP::Lite -> uri('http://my.host.tld/WebSemDiff') -> proxy('http://my.host.tld/cgi-bin/semdiff.cgi') -> on_fault( &fatal_error ); my $result = $soap->compare( $file1, $file2 )->result; print "Comparing $f1 and $f2...n"; if ( defined $result and scalar( @ ) == 0 ) { print "Files are semantically identicaln"; exit; } foreach my $diff ( @ ) { print $diff-> . ' ' . $diff-> . ' - ' . $diff-> . ' ' . $diff-> . "n"; } |
Comparing docs/doc1.xml and docs/doc2.xml... /root[1]/el1[1] 3 - 3 Attribute 'el1attr' has different value in element 'el1'. /root[1]/el2[1] 4 - 4 Character differences in element 'el2'. /root[1]/el2[1] 4 - 4 Attribute 'el2attr' missing from element 'el2'. /root[1]/el2[1] 4 - 4 Rogue attribute 'bogus' in element 'el2'. /root[1] 5 - 5 Child element 'el3' missing from element '/root[1]'. /root[1] 5 - 5 Rogue element 'el4' in element '/root[1]'. |
use SOAP::Lite +autodispatch => uri => 'http://my.host.tld/WebSemDiff', proxy =>'http://my.host.tld/cgi-bin/semdiff.cgi', on_fault => &fatal_error ; my $result = SOAP->compare( $file1, $file2 ); print "Comparing $f1 and $f2...n"; # etc .. |
用户评论