02 Jul 2009 06:12:12 UTC
- Distribution: Test-XML
- Module version: 0.08
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (8)
- Testers (12264 / 99 / 0)
- KwaliteeBus factor: 0
- 90.00% Coverage
- License: perl_5
- Perl: v5.6.0
- Download (9.23KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:2 non-PAUSE users
Test::XML - Compare XML in perl tests
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
This module contains generic XML testing tools. See below for a list of other modules with functions relating to specific XML modules.
- 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().
There are several features of XML::SemanticDiff that may suprise you if you are not aware of them. In particular:
Leading and trailing whitespace is always stripped, even in elements with character content.
Whitespace inside character content is always stripped down to a single space.
In mixed content elements (ie: an element with both text and elements beneath it), all text is treated as a single value.
The order of elements is ignored.
Dominic Mitchell, <cpan2 (at) semantico.com>
Copyright 2002 by semantico
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|