| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
|
| 4 |
use XML::LibXML; |
| 5 |
use Test::More tests => 8; |
| 6 |
|
| 7 |
ok(my $doc = XML::LibXML::Document->new(), 'new document'); |
| 8 |
ok(my $elm = $doc->createElement('D:element'), 'create element'); |
| 9 |
ok($elm->setAttribute('xmlns:D', 'attribute'), 'set attribute'); |
| 10 |
$doc->setDocumentElement($elm); # XXX does not return true if successful |
| 11 |
ok(my $str = $doc->toString(0), 'to string'); |
| 12 |
ok(my $par = XML::LibXML->new(), 'new parser'); |
| 13 |
ok( eval { $par->parse_string($str) } , 'parse string'); |
| 14 |
is($@, "", 'parse error'); |
| 15 |
like($str, qr{<D:element xmlns:D="attribute"/>}, 'xml element'); |