#!/usr/bin/perl use strict; use warnings; use Test; BEGIN { plan tests => 4 } use XML::XPath; ok(1); my $xp = XML::XPath->new(ioref => *DATA); my @nodes; @nodes = $xp->findnodes('/order'); ok @nodes == 1, 1, q[the root element must be an order]; @nodes = $xp->findnodes('/order/customer'); ok @nodes == 1,1, q[an order must contain a customer element]; @nodes = $xp->findnodes('/order/customer/name'); ok @nodes == 1,1, q[an order must contain a customer element with name]; __DATA__ Coyote, Ltd.
1313 Desert Road
Nowheresville AZ 90210