Test::XML::XPath

Test::XML::XPath is a Perl module to test XPath assertions.
Download

Test::XML::XPath Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Dominic Mitchell
  • Publisher web site:
  • http://search.cpan.org/~semantico/

Test::XML::XPath Tags


Test::XML::XPath Description

Test::XML::XPath is a Perl module to test XPath assertions. Test::XML::XPath is a Perl module to test XPath assertions.SYNOPSIS use Test::XML::XPath tests => 3; like_xpath( '', '/foo' ); # PASS like_xpath( '', '/bar' ); # FAIL unlike_xpath( '', '/bar' ); # PASS is_xpath( 'bar', '/foo', 'bar' ); # PASS is_xpath( 'bar', '/bar', 'foo' ); # FAIL # More interesting examples of xpath assertions. my $xml = 'pub'; # Do testing for attributes. like_xpath( $xml, '/foo' ); # PASS # Find an element anywhere in the document. like_xpath( $xml, '//bosh' ); # PASS # Both. like_xpath( $xml, '//bosh' ); # PASSThis module allows you to assert statements about your XML in the form of XPath statements. You can say that a piece of XML must contain certain tags, with so-and-so attributes, etc. It will try to use any installed XPath module that it knows about. Currently, this means XML::LibXML and XML::XPath, in that order.NB: Normally in XPath processing, the statement occurs from a context node. In the case of like_xpath(), the context node will always be the root node. In practice, this means that these two statements are identical: # Absolute path. like_xpath( '', '/foo' ); # Path relative to root. like_xpath( '', 'foo' );It's probably best to use absolute paths everywhere in order to keep things simple.NB: Beware of specifying attributes. Because they use an @-sign, perl will complain about trying to interpolate arrays if you don't escape them or use single quotes. Requirements: · Perl


Test::XML::XPath Related Software