1 |
#!/usr/bin/perl |
#!/usr/bin/perl |
2 |
use strict; |
use strict; |
3 |
use Test; |
use Test; |
4 |
BEGIN { plan tests => 23 } |
BEGIN { plan tests => 43 } |
5 |
|
|
6 |
require Message::DOM::DOMImplementation; |
require Message::DOM::DOMImplementation; |
7 |
use Message::Util::Error; |
use Message::Util::Error; |
8 |
|
|
9 |
my $dom = Message::DOM::DOMImplementation->____new; |
my $dom = Message::DOM::DOMImplementation->new; |
10 |
my $doc = $dom->create_document; |
my $doc = $dom->create_document; |
11 |
|
|
12 |
|
for my $v ( |
13 |
|
[a => undef], |
14 |
|
[abc => undef], |
15 |
|
['a:b' => undef], |
16 |
|
[1 => 'INVALID_CHARACTER_ERR'], |
17 |
|
[1234 => 'INVALID_CHARACTER_ERR'], |
18 |
|
["\x{3001}\x{3002}" => 'INVALID_CHARACTER_ERR'], ## XML 1.1 Name |
19 |
|
[':aa' => undef], |
20 |
|
[':1' => undef], |
21 |
|
['a:' => undef], |
22 |
|
["a:\x{3005}b" => undef], ## XML 1.0 Name, XML 1.1 QName |
23 |
|
) { |
24 |
|
$doc->strict_error_checking (1); |
25 |
|
if (not defined $v->[1]) { |
26 |
|
try { |
27 |
|
my $dt = $doc->create_notation ($v->[0]); |
28 |
|
ok $dt->node_name, $v->[0], 'create_notation '.$v->[0]; |
29 |
|
} catch Message::IF::DOMException with { |
30 |
|
my $e = shift; |
31 |
|
ok $e->type, undef, 'create_notation '.$v->[0]; |
32 |
|
}; |
33 |
|
} else { |
34 |
|
try { |
35 |
|
$doc->create_notation ($v->[0]); |
36 |
|
ok 0, 1, 'create_notation '.$v->[0]; |
37 |
|
} catch Message::IF::DOMException with { |
38 |
|
my $e = shift; |
39 |
|
ok $e->type, $v->[1], 'create_notation '.$v->[0]; |
40 |
|
}; |
41 |
|
} |
42 |
|
$doc->strict_error_checking (0); |
43 |
|
my $dt = $doc->create_notation ($v->[0]); |
44 |
|
ok $dt->node_name, $v->[0], 'create_notation s '.$v->[0]; |
45 |
|
} |
46 |
|
$doc->strict_error_checking (1); |
47 |
|
|
48 |
my $ent = $doc->create_notation ('entity'); |
my $ent = $doc->create_notation ('entity'); |
49 |
|
|
50 |
for my $prop (qw/public_id system_id/) { |
for my $prop (qw/public_id system_id/) { |