Test::XML::Order - Compare the order of XML tags in perl tests
use Test::XML::Order tests => 3; is_xml_in_order( '<foo /><foo />', '<foo></foo><foo x="a"/>' ); # PASS is_xml_in_order( '<foo /><bar />', '<bar /><foo />' ); # FAIL isnt_xml_in_order( '<foo /><bar />', '<bar /><foo />' ); # PASS
This module contains generic XML testing tools. See below for a list of other modules with functions relating to specific XML modules.
This function compares GOT and EXPECTED, both of which are strings of XML. The comparison works only on the order of the tags, attributes are ignored.
Returns true or false, depending upon test success.
This function is similar to is_xml_in_order(), except that it will fail if GOT and MUST_NOT_BE have elements in the same order.
Please note the following about Test::XML::Order.
Test::XMLor a similar package if you want to make sure the XML is well formed.
is_xml_in_order('<a a="b"/>x<b></b>', '<a/><b a="c">asdf</b>');
passes as the inputs have the same order: '<a/><b/>'.
G. Allen Morris III, <gam3 (at) gam3.net>
Copyright 2007 by G. Allen Morris III
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.