Test::XML - Compare XML in perl tests


Test-XML documentation  | view source Contained in the Test-XML distribution.

Index


NAME

Top

Test::XML - Compare XML in perl tests

SYNOPSIS

Top

  use Test::XML tests => 3;
  is_xml( '<foo />', '<foo></foo>' );   # PASS
  is_xml( '<foo />', '<bar />' );       # FAIL
  isnt_xml( '<foo />', '<bar />' );     # PASS
  is_well_formed_xml('<foo/>');               # PASS
  is_well_formed_xml('<foo>');                # FAIL

DESCRIPTION

Top

This module contains generic XML testing tools. See below for a list of other modules with functions relating to specific XML modules.

FUNCTIONS

Top

is_xml ( GOT, EXPECTED [, TESTNAME ] )

This function compares GOT and EXPECTED, both of which are strings of XML. The comparison works semantically and will ignore differences in syntax which are meaningless in xml, such as different quote characters for attributes, order of attributes or empty tag styles.

Returns true or false, depending upon test success.

isnt_xml( GOT, MUST_NOT_BE [, TESTNAME ] )

This function is similiar to is_xml(), except that it will fail if GOT and MUST_NOT_BE are identical.

is_well_formed_xml( XML [, TESTNAME ] )

This function determines whether or not a given XML string is parseable as XML.

is_good_xml ( XML [, TESTNAME ] )

This is an alias for is_well_formed_xml().

NOTES

Top

There are several features of XML::SemanticDiff that may suprise you if you are not aware of them. In particular:

SEE ALSO

Top

Test::XML::SAX, Test::XML::Twig.

Test::More, XML::SemanticDiff.

AUTHOR

Top

Dominic Mitchell, <cpan2 (at) semantico.com>

COPYRIGHT AND LICENSE

Top


Test-XML documentation  | view source Contained in the Test-XML distribution.