File: 48_rt123379_setNamespace.t

package info (click to toggle)
libxml-libxml-perl 2.0207%2Bdfsg%2Breally%2B2.0134-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,572 kB
  • sloc: perl: 6,310; ansic: 3,851; xml: 182; sh: 21; makefile: 16
file content (15 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use strict;
use warnings;

use XML::LibXML;
use Test::More tests => 8;

ok(my $doc = XML::LibXML::Document->new(), 'new document');
ok(my $elm = $doc->createElement('D:element'), 'create element');
ok($elm->setAttribute('xmlns:D', 'attribute'), 'set attribute');
$doc->setDocumentElement($elm); # XXX does not return true if successful
ok(my $str = $doc->toString(0), 'to string');
ok(my $par = XML::LibXML->new(), 'new parser');
ok( eval { $par->parse_string($str) } , 'parse string');
is($@, "", 'parse error');
like($str, qr{<D:element xmlns:D="attribute"/>}, 'xml element');