The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::XML::Compare - Test if two XML documents semantically the same

SYNOPSIS

 use Test::XML::Compare tests => 2;

 my $xml1 = "<foo xmlns="urn:message"><bar baz="buzz">text</bar></foo>";
 my $xml2 = "<f:foo xmlns:f="urn:message"><f:bar baz="buzz">text</f:bar></f:foo>";
 my $xml3 = "<foo><bar baz="buzz">text</bar></foo>";

 # These will pass
 is_xml_same $xml1, $xml2;

 # These will fail
 is_xml_same $xml1, $xml3;
 is_xml_same $xml2, $xml3;

 # however, you can also check for failures, so these now succeed
 is_xml_different $xml1, $xml3;
 is_xml_different $xml2, $xml3;

 # ... and this fails
 is_xml_different $xml1, $xml2;

DESCRIPTION

This module allows you to test if two XML documents are semantically the same. This also holds true if different prefixes are being used for the xmlns, or if there is a default xmlns in place.

It uses XML::Compare to do all of it's checking.

SUBROUTINES

is_xml_same $xml1, $xml2, $name;

Test passes if the XML string in $xml1 is semantically the same as the XML string in $xml2. Optionally name the test with $name.

is_xml_different $xml1, $xml2, $name;

Test passes if the XML string in $xml1 is semantically different to the XML string in $xml2. Optionally name the test with $name.

EXPORTS

Everything in "SUBROUTINES" by default, as expected.

SEE ALSO

Test::Builder

XML::LibXML

XML::Compare

AUTHOR

Andrew Chilton, <andychilton@gmail.com<gt>, <andy@catalyst dot net dot nz<gt>

http://www.chilts.org/blog/

COPYRIGHT & LICENSE

This software development is sponsored and directed by New Zealand Registry Services, http://www.nzrs.net.nz/

The work is being carried out by Catalyst IT, http://www.catalyst.net.nz/

Copyright (c) 2009, NZ Registry Services. All Rights Reserved. This software may be used under the terms of the Artistic License 2.0. Note that this license is compatible with both the GNU GPL and Artistic licenses. A copy of this license is supplied with the distribution in the file COPYING.txt.