1Test::XML(3)          User Contributed Perl Documentation         Test::XML(3)
2
3
4

NAME

6       Test::XML - Compare XML in perl tests
7

SYNOPSIS

9         use Test::XML tests => 3;
10         is_xml( '<foo />', '<foo></foo>' );   # PASS
11         is_xml( '<foo />', '<bar />' );       # FAIL
12         isnt_xml( '<foo />', '<bar />' );     # PASS
13         is_well_formed_xml('<foo/>');               # PASS
14         is_well_formed_xml('<foo>');                # FAIL
15

DESCRIPTION

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

FUNCTIONS

21       is_xml ( GOT, EXPECTED [, TESTNAME ] )
22           This function compares GOT and EXPECTED, both of which are strings
23           of XML.  The comparison works semantically and will ignore
24           differences in syntax which are meaningless in xml, such as
25           different quote characters for attributes, order of attributes or
26           empty tag styles.
27
28           Returns true or false, depending upon test success.
29
30       isnt_xml( GOT, MUST_NOT_BE [, TESTNAME ] )
31           This function is similiar to is_xml(), except that it will fail if
32           GOT and MUST_NOT_BE are identical.
33
34       is_well_formed_xml( XML [, TESTNAME ] )
35           This function determines whether or not a given XML string is
36           parseable as XML.
37
38       is_good_xml ( XML [, TESTNAME ] )
39           This is an alias for is_well_formed_xml().
40

NOTES

42       There are several features of XML::SemanticDiff that may suprise you if
43       you are not aware of them.  In particular:
44
45       •   Leading and trailing whitespace is always stripped, even in
46           elements with character content.
47
48       •   Whitespace inside character content is always stripped down to a
49           single space.
50
51       •   In mixed content elements (ie: an element with both text and
52           elements beneath it), all text is treated as a single value.
53
54       •   The order of elements is ignored.
55

SEE ALSO

57       Test::XML::SAX, Test::XML::Twig.
58
59       Test::More, XML::SemanticDiff.
60

AUTHOR

62       Dominic Mitchell, <cpan2 (at) semantico.com>
63
65       Copyright 2002 by semantico
66
67       This library is free software; you can redistribute it and/or modify it
68       under the same terms as Perl itself.
69
70
71
72perl v5.36.0                      2023-01-20                      Test::XML(3)
Impressum