#!/usr/bin/perl -w
plan(
tests
=> 15);
ok(1);
my
$parser
= XML::DOM::Parser->new;
my
$t
=
$parser
->parse( \
*DATA
);
my
$node
=
$t
->findvalue(
'//attr:node/@attr:findme'
);
ok(
$node
,
'someval'
);
my
@nodes
;
@nodes
=
$t
->findnodes(
'//foo:foo'
,
$t
);
ok(
@nodes
, 3);
@nodes
=
$t
->findnodes(
'//goo:foo'
,
$t
);
ok(
@nodes
, 0);
@nodes
=
$t
->findnodes(
'//foo'
,
$t
);
ok(
@nodes
, 2);
$node
=
$t
->findvalue(
'//*[@attr:findme]'
);
ok(
$node
,
'attr content'
);
ok(
$t
->findvalue(
'//attr:node/@attr:findme'
),
'someval'
);
ok(
$t
->findvalue(
'//toto'
),
'tata'
);
ok(
$t
->findvalue(
'//toto/@att'
),
'tutu'
);
$t
->set_namespace(
"foo"
=>
"flubber.example.com"
);
$t
->set_namespace(
"goo"
=>
"foobar.example.com"
);
@nodes
=
$t
->findnodes(
'//foo:foo'
,
$t
);
ok(
@nodes
, 2);
@nodes
=
$t
->findnodes(
'//goo:foo'
,
$t
);
ok(
@nodes
, 3);
@nodes
=
$t
->findnodes(
'//foo'
,
$t
);
ok(
@nodes
, 2);
ok(
$t
->findvalue(
'//attr:node/@attr:findme'
),
'someval'
);
ok(
$t
->findvalue(
'//toto'
),
'tata'
);
ok(
$t
->findvalue(
'//toto/@att'
),
'tutu'
);