1 |
package Message::DOM::Notation; |
2 |
use strict; |
3 |
our $VERSION=do{my @r=(q$Revision: 1.6 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
4 |
push our @ISA, 'Message::DOM::Node', 'Message::IF::Notation'; |
5 |
require Message::DOM::Node; |
6 |
|
7 |
sub ____new ($$$) { |
8 |
my $self = shift->SUPER::____new (shift); |
9 |
$$self->{node_name} = $_[0]; |
10 |
return $self; |
11 |
} # ____new |
12 |
|
13 |
sub AUTOLOAD { |
14 |
my $method_name = our $AUTOLOAD; |
15 |
$method_name =~ s/.*:://; |
16 |
return if $method_name eq 'DESTROY'; |
17 |
|
18 |
if ({ |
19 |
## Read-only attributes (trivial accessors) |
20 |
node_name => 1, |
21 |
owner_document_type_definition => 1, |
22 |
}->{$method_name}) { |
23 |
no strict 'refs'; |
24 |
eval qq{ |
25 |
sub $method_name (\$) { |
26 |
if (\@_ > 1) { |
27 |
require Carp; |
28 |
Carp::croak (qq<Can't modify read-only attribute>); |
29 |
} |
30 |
return \${\$_[0]}->{$method_name}; |
31 |
} |
32 |
}; |
33 |
goto &{ $AUTOLOAD }; |
34 |
} elsif ({ |
35 |
## Read-write attributes (DOMString, trivial accessors) |
36 |
public_id => 1, |
37 |
system_id => 1, |
38 |
}->{$method_name}) { |
39 |
no strict 'refs'; |
40 |
eval qq{ |
41 |
sub $method_name (\$;\$) { |
42 |
if (\@_ > 1) { |
43 |
if (\${\$_[0]}->{strict_error_checking} and |
44 |
\${\$_[0]}->{manakai_read_only}) { |
45 |
report Message::DOM::DOMException |
46 |
-object => \$_[0], |
47 |
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
48 |
-subtype => 'READ_ONLY_NODE_ERR'; |
49 |
} |
50 |
if (defined \$_[1]) { |
51 |
\${\$_[0]}->{$method_name} = ''.\$_[1]; |
52 |
} else { |
53 |
delete \${\$_[0]}->{$method_name}; |
54 |
} |
55 |
} |
56 |
return \${\$_[0]}->{$method_name}; |
57 |
} |
58 |
}; |
59 |
goto &{ $AUTOLOAD }; |
60 |
} else { |
61 |
require Carp; |
62 |
Carp::croak (qq<Can't locate method "$AUTOLOAD">); |
63 |
} |
64 |
} # AUTOLOAD |
65 |
|
66 |
## |Node| attributes |
67 |
|
68 |
sub child_nodes ($) { |
69 |
require Message::DOM::NodeList; |
70 |
return bless \\($_[0]), 'Message::DOM::NodeList::EmptyNodeList'; |
71 |
} # child_nodes |
72 |
|
73 |
sub node_name ($); # read-only trivial accessor |
74 |
|
75 |
sub node_type () { 12 } # NOTATION_NODE |
76 |
|
77 |
sub text_content () { undef } |
78 |
|
79 |
## |Node| methods |
80 |
|
81 |
sub append_child ($$) { |
82 |
report Message::DOM::DOMException |
83 |
-object => $_[0], |
84 |
-type => 'HIERARCHY_REQUEST_ERR', |
85 |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
86 |
} # append_child |
87 |
|
88 |
sub manakai_append_text () { } |
89 |
|
90 |
sub insert_before ($;$) { |
91 |
report Message::DOM::DOMException |
92 |
-object => $_[0], |
93 |
-type => 'HIERARCHY_REQUEST_ERR', |
94 |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
95 |
} # insert_before |
96 |
|
97 |
sub replace_child ($$) { |
98 |
report Message::DOM::DOMException |
99 |
-object => $_[0], |
100 |
-type => 'HIERARCHY_REQUEST_ERR', |
101 |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
102 |
} # replace_child |
103 |
|
104 |
## |Notation| attributes |
105 |
|
106 |
sub manakai_declaration_base_uri ($;$) { |
107 |
## NOTE: Same as |Notation|'s. |
108 |
|
109 |
if (@_ > 1) { |
110 |
if (${${$_[0]}->{owner_document}}->{strict_error_checking} and |
111 |
${$_[0]}->{manakai_read_only}) { |
112 |
report Message::DOM::DOMException |
113 |
-object => $_[0], |
114 |
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
115 |
-subtype => 'READ_ONLY_NODE_ERR'; |
116 |
} |
117 |
if (defined $_[1]) { |
118 |
${$_[0]}->{manakai_declaration_base_uri} = ''.$_[1]; |
119 |
} else { |
120 |
delete ${$_[0]}->{manakai_declaration_base_uri}; |
121 |
} |
122 |
} |
123 |
|
124 |
if (defined wantarray) { |
125 |
if (defined ${$_[0]}->{manakai_declaration_base_uri}) { |
126 |
return ${$_[0]}->{manakai_declaration_base_uri}; |
127 |
} else { |
128 |
local $Error::Depth = $Error::Depth + 1; |
129 |
return $_[0]->base_uri; |
130 |
} |
131 |
} |
132 |
} # manakai_declaration_base_uri |
133 |
|
134 |
## NOTE: A manakai extension. |
135 |
sub owner_document_type_definition ($); |
136 |
|
137 |
## NOTE: Setter is a manakai extension. |
138 |
sub public_id ($;$); |
139 |
|
140 |
## NOTE: Setter is a manakai extension. |
141 |
sub system_id ($;$); |
142 |
|
143 |
package Message::IF::Notation; |
144 |
|
145 |
package Message::DOM::Document; |
146 |
|
147 |
sub create_notation ($$) { |
148 |
return Message::DOM::Notation->____new (@_[0, 1]); |
149 |
} # create_notation |
150 |
|
151 |
=head1 LICENSE |
152 |
|
153 |
Copyright 2007 Wakaba <w@suika.fam.cx> |
154 |
|
155 |
This program is free software; you can redistribute it and/or |
156 |
modify it under the same terms as Perl itself. |
157 |
|
158 |
=cut |
159 |
|
160 |
1; |
161 |
## $Date: 2007/07/08 05:42:37 $ |