Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Test::XPath 0.16

    Download button

    No screenshots available
    Downloads: 265  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    David E. Wheeler | More programs
    Perl Artistic License / FREE
    November 23rd, 2011, 13:26 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Test::XPath description

    Test XML and HTML content and structure with XPath expressions

    Use the power of XPath expressions to validate the structure of your XML and HTML documents.

    Synopsis

     use Test::More tests = > 5;
     use Test::XPath;

     my $xml = < < 'XML';
     < html >
     < head >
     < title >Hello< /title >
     < style type="text/css" src="foo.css" >< /style >
     < style type="text/css" src="bar.css" >< /style >
     < /head >
     < body >
     < h1 >Welcome to my lair.< /h1 >
     < /body >
     < /html >
     XML

     my $tx = Test::XPath- >new( xml = > $xml );

     $tx- >ok( '/html/head', 'There should be a head' );
     $tx- >is( '/html/head/title', 'Hello', 'The title should be correct' );

     # Recursing into a document:
     my @css = qw(foo.css bar.css);
     $tx- >ok( '/html/head/style[@type="text/css"]', sub {
     my $css = shift @css;
     shift- >is( './@src', $css, "Style src should be $css");
     }, 'Should have style' );

     # Better yet, use PerlX::MethodCallWithBlock:
     use PerlX::MethodCallWithBlock;
     my @css = qw(foo.css bar.css);
     use PerlX::MethodCallWithBlock;
     $tx- >ok( '/html/head/style[@type="text/css"]', 'Should have style' ) {
     my $css = shift @css;
     shift- >is( './@src', $css, "Style src should be $css");
     };



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    test XML content | test HTML content | XPath expressions | XPath | expressions | testting

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM