1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
## This file is automatically generated |
3 |
wakaba |
1.9 |
## at 2006-11-05T08:23:49+00:00, |
4 |
wakaba |
1.7 |
## from file "Element.dis", |
5 |
wakaba |
1.1 |
## module <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.Element>, |
6 |
|
|
## for <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOMLatest>. |
7 |
|
|
## Don't edit by hand! |
8 |
|
|
use strict; |
9 |
|
|
require Message::DOM::DOMCore; |
10 |
wakaba |
1.9 |
require Message::DOM::Document; |
11 |
wakaba |
1.1 |
require Message::DOM::TreeCore; |
12 |
|
|
require Message::Util::Error::DOMException; |
13 |
|
|
package Message::DOM::Element; |
14 |
wakaba |
1.9 |
our $VERSION = 20061105.0823; |
15 |
|
|
package Message::DOM::Element::ManakaiDOMDocumentElement; |
16 |
|
|
our $VERSION = 20061105.0823; |
17 |
|
|
push @Message::DOM::Document::ManakaiDOMDocument::ISA, q<Message::DOM::Element::ManakaiDOMDocumentElement> unless Message::DOM::Document::ManakaiDOMDocument->isa (q<Message::DOM::Element::ManakaiDOMDocumentElement>); |
18 |
|
|
use Char::Class::XML 'InXMLNCNameChar10', |
19 |
|
|
'InXMLNCNameChar11', |
20 |
|
|
'InXMLNCNameStartChar11', |
21 |
|
|
'InXMLNameChar10', |
22 |
|
|
'InXMLNameChar11', |
23 |
|
|
'InXMLNameStartChar11', |
24 |
|
|
'InXML_NCNameStartChar10', |
25 |
|
|
'InXML_NameStartChar10'; |
26 |
|
|
sub create_element ($$) { |
27 |
|
|
my ($self, $tagName) = @_; |
28 |
|
|
my $r; |
29 |
|
|
|
30 |
|
|
{ |
31 |
|
|
|
32 |
|
|
my |
33 |
|
|
$strict = $self-> |
34 |
|
|
strict_error_checking |
35 |
|
|
; |
36 |
|
|
if ($strict) { |
37 |
|
|
my $version = $self-> |
38 |
|
|
xml_version |
39 |
|
|
; |
40 |
|
|
|
41 |
|
|
|
42 |
|
|
{ |
43 |
|
|
|
44 |
|
|
if |
45 |
|
|
(defined $tagName) { |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
{ |
49 |
|
|
|
50 |
|
|
if |
51 |
|
|
(((not defined $version or $version eq '1.0') and |
52 |
|
|
not |
53 |
|
|
($tagName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
54 |
|
|
) or |
55 |
|
|
(defined $version and $version eq '1.1' and |
56 |
|
|
not |
57 |
|
|
($tagName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
58 |
|
|
)) { |
59 |
|
|
|
60 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $tagName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
61 |
|
|
|
62 |
|
|
; |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
; |
70 |
|
|
|
71 |
|
|
|
72 |
|
|
; |
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
|
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
; |
79 |
|
|
} |
80 |
|
|
|
81 |
|
|
|
82 |
|
|
{ |
83 |
|
|
|
84 |
|
|
local $Error::Depth = $Error::Depth + 1; |
85 |
|
|
|
86 |
|
|
{ |
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
$self-> |
91 |
|
|
strict_error_checking |
92 |
|
|
( |
93 |
|
|
0 |
94 |
|
|
); |
95 |
|
|
$r = $self-> |
96 |
|
|
create_element_ns |
97 |
|
|
( |
98 |
|
|
undef |
99 |
|
|
, [ |
100 |
|
|
undef |
101 |
|
|
, $tagName]); |
102 |
|
|
$self-> |
103 |
|
|
strict_error_checking |
104 |
|
|
($strict); |
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
|
111 |
|
|
;} |
112 |
|
|
|
113 |
|
|
; |
114 |
|
|
|
115 |
|
|
|
116 |
|
|
} |
117 |
|
|
$r} |
118 |
|
|
sub create_element_ns ($$$) { |
119 |
|
|
my ($self, $namespaceURI, $qualifiedName) = @_; |
120 |
|
|
|
121 |
|
|
{ |
122 |
|
|
|
123 |
|
|
if |
124 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
125 |
|
|
require Message::DOM::DOMMain; |
126 |
|
|
|
127 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
128 |
|
|
|
129 |
|
|
; |
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
{ |
134 |
|
|
|
135 |
|
|
|
136 |
|
|
$namespaceURI = undef; |
137 |
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
; |
143 |
|
|
} |
144 |
|
|
|
145 |
|
|
|
146 |
|
|
} |
147 |
|
|
my $r; |
148 |
|
|
|
149 |
|
|
{ |
150 |
|
|
|
151 |
|
|
my |
152 |
|
|
($prefix, $lname) = ref $qualifiedName eq 'ARRAY' |
153 |
|
|
? @$qualifiedName |
154 |
|
|
: split /:/, $qualifiedName, 2; |
155 |
|
|
($prefix, $lname) = ( |
156 |
|
|
undef |
157 |
|
|
, $prefix) unless defined $lname; |
158 |
|
|
$qualifiedName = defined $prefix ? $prefix.':'.$lname : $lname; |
159 |
|
|
|
160 |
|
|
if ($self-> |
161 |
|
|
strict_error_checking |
162 |
|
|
) { |
163 |
|
|
my $version = $self-> |
164 |
|
|
xml_version |
165 |
|
|
; |
166 |
|
|
|
167 |
|
|
|
168 |
|
|
{ |
169 |
|
|
|
170 |
|
|
if |
171 |
|
|
(defined $version and $version eq '1.1') { |
172 |
|
|
unless ( |
173 |
|
|
($qualifiedName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
174 |
|
|
) { |
175 |
|
|
|
176 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
177 |
|
|
|
178 |
|
|
; |
179 |
|
|
} |
180 |
|
|
unless ( |
181 |
|
|
($qualifiedName =~ /\A\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*(?::\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*)?\z/) |
182 |
|
|
) { |
183 |
|
|
|
184 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
185 |
|
|
|
186 |
|
|
; |
187 |
|
|
} |
188 |
|
|
} else { |
189 |
|
|
unless ( |
190 |
|
|
($qualifiedName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
191 |
|
|
) { |
192 |
|
|
|
193 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
194 |
|
|
|
195 |
|
|
; |
196 |
|
|
} |
197 |
|
|
unless ( |
198 |
|
|
($qualifiedName =~ /\A\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*(?::\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*)?\z/) |
199 |
|
|
) { |
200 |
|
|
|
201 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
202 |
|
|
|
203 |
|
|
; |
204 |
|
|
} |
205 |
|
|
} |
206 |
|
|
|
207 |
|
|
|
208 |
|
|
} |
209 |
|
|
|
210 |
|
|
; |
211 |
|
|
|
212 |
|
|
|
213 |
|
|
{ |
214 |
|
|
|
215 |
|
|
if |
216 |
|
|
(defined $prefix) { |
217 |
|
|
if (not defined $namespaceURI) { |
218 |
|
|
|
219 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_PREFIX_WITH_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
220 |
|
|
|
221 |
|
|
; |
222 |
|
|
} elsif ($prefix eq 'xml' and $namespaceURI ne |
223 |
|
|
'http://www.w3.org/XML/1998/namespace' |
224 |
|
|
) { |
225 |
|
|
|
226 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XML_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
227 |
|
|
|
228 |
|
|
; |
229 |
|
|
} elsif ($prefix eq 'xmlns' and $namespaceURI ne |
230 |
|
|
'http://www.w3.org/2000/xmlns/' |
231 |
|
|
) { |
232 |
|
|
|
233 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XMLNS_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
234 |
|
|
|
235 |
|
|
; |
236 |
|
|
} elsif ($namespaceURI eq |
237 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
238 |
|
|
$prefix ne 'xml') { |
239 |
|
|
|
240 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XML_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
241 |
|
|
|
242 |
|
|
; |
243 |
|
|
} elsif ($namespaceURI eq |
244 |
|
|
'http://www.w3.org/2000/xmlns/' and |
245 |
|
|
$prefix ne 'xmlns') { |
246 |
|
|
|
247 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
248 |
|
|
|
249 |
|
|
; |
250 |
|
|
} |
251 |
|
|
} else { ## No prefix |
252 |
|
|
if (not defined $namespaceURI) { |
253 |
|
|
# |
254 |
|
|
} elsif ($namespaceURI eq |
255 |
|
|
'http://www.w3.org/2000/xmlns/' and |
256 |
|
|
$lname ne 'xmlns') { |
257 |
|
|
|
258 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => undef, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
259 |
|
|
|
260 |
|
|
; |
261 |
|
|
} |
262 |
|
|
} |
263 |
|
|
|
264 |
|
|
|
265 |
|
|
} |
266 |
|
|
|
267 |
|
|
; |
268 |
|
|
if (defined $namespaceURI and $namespaceURI eq |
269 |
|
|
'http://www.w3.org/2000/xmlns/' and |
270 |
|
|
|
271 |
|
|
($qualifiedName eq 'xmlns' or |
272 |
|
|
(defined $prefix and $prefix eq 'xmlns'))) { |
273 |
|
|
|
274 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'create_element_ns', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMDocumentElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'qualifiedName', 'http://www.w3.org/2001/04/infoset#localName' => $lname, 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI'; |
275 |
|
|
|
276 |
|
|
; |
277 |
|
|
} |
278 |
|
|
} |
279 |
|
|
|
280 |
|
|
my $bag = |
281 |
|
|
$self->{'b'} |
282 |
|
|
; |
283 |
|
|
my $stem; |
284 |
|
|
|
285 |
|
|
|
286 |
|
|
{ |
287 |
|
|
|
288 |
|
|
|
289 |
|
|
$stem = 'Message::DOM::Element::ManakaiDOMElement'->___create_node_stem ($bag, { |
290 |
|
|
|
291 |
|
|
'rc' |
292 |
|
|
=> 0, |
293 |
|
|
|
294 |
|
|
'id' |
295 |
|
|
=> \ |
296 |
|
|
( |
297 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
298 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
299 |
|
|
) |
300 |
|
|
, |
301 |
|
|
}, { |
302 |
|
|
'od' => $self, |
303 |
|
|
'ns' => \$namespaceURI, |
304 |
|
|
'pfx' => \$prefix, |
305 |
|
|
'ln' => \$lname, |
306 |
|
|
}); |
307 |
|
|
|
308 |
|
|
|
309 |
|
|
{ |
310 |
|
|
|
311 |
|
|
if |
312 |
|
|
(defined 'Message::DOM::Element::ManakaiDOMElement') { |
313 |
|
|
if (ref 'Message::DOM::Element::ManakaiDOMElement' eq 'SCALAR') { |
314 |
|
|
$stem->{'cls'} = 'Message::DOM::Element::ManakaiDOMElement'; |
315 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}) { |
316 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}; |
317 |
|
|
} else { |
318 |
|
|
require Scalar::Util; |
319 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'} = \('Message::DOM::Element::ManakaiDOMElement'); |
320 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}); |
321 |
|
|
} |
322 |
|
|
} else { |
323 |
|
|
CORE::delete $stem->{'cls'}; |
324 |
|
|
} |
325 |
|
|
|
326 |
|
|
|
327 |
|
|
} |
328 |
|
|
|
329 |
|
|
; |
330 |
|
|
$bag->{${$stem->{ |
331 |
|
|
'id' |
332 |
|
|
}}} = $stem; |
333 |
|
|
|
334 |
|
|
|
335 |
|
|
} |
336 |
|
|
|
337 |
|
|
; |
338 |
|
|
|
339 |
|
|
|
340 |
|
|
{ |
341 |
|
|
|
342 |
|
|
|
343 |
|
|
$r = ${$stem->{ |
344 |
|
|
'cls' |
345 |
|
|
}}->___create_node_ref ({ |
346 |
|
|
|
347 |
|
|
'id' |
348 |
|
|
=> $stem->{ |
349 |
|
|
'id' |
350 |
|
|
}, |
351 |
|
|
|
352 |
|
|
'b' |
353 |
|
|
=> $bag, |
354 |
|
|
}, { |
355 |
|
|
}); |
356 |
|
|
$stem->{ |
357 |
|
|
'rc' |
358 |
|
|
}++; |
359 |
|
|
|
360 |
|
|
|
361 |
|
|
} |
362 |
|
|
|
363 |
|
|
; |
364 |
|
|
|
365 |
|
|
## Default attributes |
366 |
|
|
|
367 |
|
|
|
368 |
|
|
{ |
369 |
|
|
|
370 |
|
|
|
371 |
|
|
{ |
372 |
|
|
|
373 |
|
|
local $Error::Depth = $Error::Depth + 1; |
374 |
|
|
|
375 |
|
|
{ |
376 |
|
|
|
377 |
|
|
|
378 |
|
|
XDA: |
379 |
|
|
{ |
380 |
|
|
my $__cfg = $self-> |
381 |
|
|
dom_config |
382 |
|
|
; |
383 |
|
|
last XDA unless $__cfg-> |
384 |
|
|
get_parameter |
385 |
|
|
|
386 |
|
|
( |
387 |
|
|
'http://suika.fam.cx/www/2006/dom-config/dtd-default-attribute' |
388 |
|
|
); |
389 |
|
|
my $__doctype = $self-> |
390 |
|
|
doctype |
391 |
|
|
; |
392 |
|
|
last XDA unless defined $__doctype; |
393 |
|
|
$__doctype = $__doctype-> |
394 |
|
|
get_feature |
395 |
|
|
|
396 |
|
|
( |
397 |
|
|
'http://suika.fam.cx/www/2006/feature/XDoctype' |
398 |
|
|
=> '3.0'); |
399 |
|
|
last XDA unless defined $__doctype; |
400 |
|
|
my $__et = $__doctype-> |
401 |
|
|
get_element_type_definition_node |
402 |
|
|
|
403 |
|
|
($qualifiedName); |
404 |
|
|
if ($__et) { |
405 |
|
|
my $__orig_strict = $self-> |
406 |
|
|
strict_error_checking |
407 |
|
|
; |
408 |
|
|
$self-> |
409 |
|
|
strict_error_checking |
410 |
|
|
( |
411 |
|
|
0 |
412 |
|
|
); |
413 |
|
|
my %__gattr; |
414 |
|
|
my %__has_attr; |
415 |
|
|
my %__pfx_to_uri; |
416 |
|
|
my $__copy_asis = $__cfg-> |
417 |
|
|
get_parameter |
418 |
|
|
|
419 |
|
|
( |
420 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
421 |
|
|
); |
422 |
|
|
$__cfg-> |
423 |
|
|
set_parameter |
424 |
|
|
|
425 |
|
|
( |
426 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
427 |
|
|
=> |
428 |
|
|
1 |
429 |
|
|
); |
430 |
|
|
for my $__at (@{$__et-> |
431 |
|
|
attribute_definitions |
432 |
|
|
}) { |
433 |
|
|
my $__at_default = $__at-> |
434 |
|
|
default_type |
435 |
|
|
; |
436 |
|
|
if ($__at_default == |
437 |
|
|
4 or |
438 |
|
|
|
439 |
|
|
$__at_default == |
440 |
|
|
1 |
441 |
|
|
) { |
442 |
|
|
my ($__nn1, $__nn2) = split /:/, $__at-> |
443 |
|
|
node_name |
444 |
|
|
; |
445 |
|
|
if (defined $__nn2) { # prefixed |
446 |
|
|
if ($__nn1 eq 'xmlns') { |
447 |
|
|
## TODO: NCName check, prefix check and NSURI check |
448 |
|
|
my $__attr = $self-> |
449 |
|
|
create_attribute_ns |
450 |
|
|
|
451 |
|
|
( |
452 |
|
|
'http://www.w3.org/2000/xmlns/' |
453 |
|
|
, [$__nn1, $__nn2]); |
454 |
|
|
for my $__at_child (@{$__at-> |
455 |
|
|
child_nodes |
456 |
|
|
}) { |
457 |
|
|
$__attr-> |
458 |
|
|
append_child |
459 |
|
|
|
460 |
|
|
($__at_child-> |
461 |
|
|
clone_node |
462 |
|
|
( |
463 |
|
|
1 |
464 |
|
|
)); |
465 |
|
|
} |
466 |
|
|
$__attr-> |
467 |
|
|
manakai_attribute_type |
468 |
|
|
|
469 |
|
|
($__at-> |
470 |
|
|
declared_type |
471 |
|
|
); |
472 |
|
|
my $__nsuri = $__attr-> |
473 |
|
|
value |
474 |
|
|
; |
475 |
|
|
## TODO: Namespace well-formedness check (NSURI), v1.1 chk |
476 |
|
|
$__pfx_to_uri{$__nn2} = $__nsuri; |
477 |
|
|
$r-> |
478 |
|
|
set_attribute_node_ns |
479 |
|
|
($__attr); |
480 |
|
|
## This method changes |specified| flag |
481 |
|
|
$__attr-> |
482 |
|
|
specified |
483 |
|
|
( |
484 |
|
|
0 |
485 |
|
|
); |
486 |
|
|
$__has_attr{ |
487 |
|
|
'http://www.w3.org/2000/xmlns/' |
488 |
|
|
}->{$__nn2} = |
489 |
|
|
1 |
490 |
|
|
; |
491 |
|
|
} else { |
492 |
|
|
## TODO: NCName check |
493 |
|
|
$__gattr{$__nn1}->{$__nn2} = $__at; |
494 |
|
|
} |
495 |
|
|
} else { # no prefixed |
496 |
|
|
my $__attr; |
497 |
|
|
if ($__nn1 eq 'xmlns') { |
498 |
|
|
$__attr = $self-> |
499 |
|
|
create_attribute_ns |
500 |
|
|
|
501 |
|
|
( |
502 |
|
|
'http://www.w3.org/2000/xmlns/' |
503 |
|
|
, 'xmlns'); |
504 |
|
|
$__has_attr{ |
505 |
|
|
'http://www.w3.org/2000/xmlns/' |
506 |
|
|
}->{xmlns} = |
507 |
|
|
1 |
508 |
|
|
; |
509 |
|
|
} else { |
510 |
|
|
$__attr = $self-> |
511 |
|
|
create_attribute_ns |
512 |
|
|
|
513 |
|
|
( |
514 |
|
|
undef |
515 |
|
|
, $__nn1); |
516 |
|
|
## TODO: NCName check |
517 |
|
|
} |
518 |
|
|
for my $__at_child (@{$__at-> |
519 |
|
|
child_nodes |
520 |
|
|
}) { |
521 |
|
|
$__attr-> |
522 |
|
|
append_child |
523 |
|
|
|
524 |
|
|
($__at_child-> |
525 |
|
|
clone_node |
526 |
|
|
( |
527 |
|
|
1 |
528 |
|
|
)); |
529 |
|
|
} |
530 |
|
|
$__attr-> |
531 |
|
|
manakai_attribute_type |
532 |
|
|
|
533 |
|
|
($__at-> |
534 |
|
|
declared_type |
535 |
|
|
); |
536 |
|
|
## TODO: Namespace well-formedness check (NSURI) |
537 |
|
|
$r-> |
538 |
|
|
set_attribute_node_ns |
539 |
|
|
($__attr); |
540 |
|
|
## This method changes |specified| flag |
541 |
|
|
$__attr-> |
542 |
|
|
specified |
543 |
|
|
( |
544 |
|
|
0 |
545 |
|
|
); |
546 |
|
|
} |
547 |
|
|
} |
548 |
|
|
} # attrdefs |
549 |
|
|
for my $__pfx (keys %__gattr) { |
550 |
|
|
my $__nsuri = $__pfx_to_uri{$__pfx}; |
551 |
|
|
unless (defined $__nsuri) { |
552 |
|
|
## TODO: Namespace well-formedness error |
553 |
|
|
} |
554 |
|
|
LN: for my $__ln (keys %{$__gattr{$__pfx}}) { |
555 |
|
|
if ($__has_attr{defined $__nsuri ? $__nsuri : ''}->{$__ln}) { |
556 |
|
|
## TODO: Namespace well-formedness error |
557 |
|
|
next LN; |
558 |
|
|
} |
559 |
|
|
## TODO: NCName check, prefix check and NSURI check |
560 |
|
|
my $__at = $__gattr{$__pfx}->{$__ln}; |
561 |
|
|
my $__attr = $self-> |
562 |
|
|
create_attribute_ns |
563 |
|
|
|
564 |
|
|
($__nsuri, [$__pfx, $__ln]); |
565 |
|
|
for my $__at_child (@{$__at-> |
566 |
|
|
child_nodes |
567 |
|
|
}) { |
568 |
|
|
$__attr-> |
569 |
|
|
append_child |
570 |
|
|
|
571 |
|
|
($__at_child-> |
572 |
|
|
clone_node |
573 |
|
|
( |
574 |
|
|
1 |
575 |
|
|
)); |
576 |
|
|
} |
577 |
|
|
$__attr-> |
578 |
|
|
manakai_attribute_type |
579 |
|
|
|
580 |
|
|
($__at-> |
581 |
|
|
declared_type |
582 |
|
|
); |
583 |
|
|
$r-> |
584 |
|
|
set_attribute_node_ns |
585 |
|
|
($__attr); |
586 |
|
|
## This method changes |specified| flag |
587 |
|
|
$__attr-> |
588 |
|
|
specified |
589 |
|
|
( |
590 |
|
|
0 |
591 |
|
|
); |
592 |
|
|
$__has_attr{defined $__nsuri ? $__nsuri : ''}->{$__ln} = |
593 |
|
|
1 |
594 |
|
|
; |
595 |
|
|
} # LN |
596 |
|
|
} # pfx |
597 |
|
|
$__cfg-> |
598 |
|
|
set_parameter |
599 |
|
|
|
600 |
|
|
( |
601 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
602 |
|
|
=> $__copy_asis); |
603 |
|
|
$self-> |
604 |
|
|
strict_error_checking |
605 |
|
|
($__orig_strict); |
606 |
|
|
} |
607 |
|
|
} # XDA |
608 |
|
|
|
609 |
|
|
|
610 |
|
|
|
611 |
|
|
} |
612 |
|
|
|
613 |
|
|
|
614 |
|
|
;} |
615 |
|
|
|
616 |
|
|
; |
617 |
|
|
|
618 |
|
|
|
619 |
|
|
} |
620 |
|
|
|
621 |
|
|
; |
622 |
|
|
|
623 |
|
|
|
624 |
|
|
} |
625 |
|
|
$r} |
626 |
|
|
sub create_attribute ($$) { |
627 |
|
|
my ($self, $name) = @_; |
628 |
|
|
my $r; |
629 |
|
|
|
630 |
|
|
{ |
631 |
|
|
|
632 |
|
|
my |
633 |
|
|
$strict = $self-> |
634 |
|
|
strict_error_checking |
635 |
|
|
; |
636 |
|
|
if ($strict) { |
637 |
|
|
my $version = $self-> |
638 |
|
|
xml_version |
639 |
|
|
; |
640 |
|
|
|
641 |
|
|
|
642 |
|
|
{ |
643 |
|
|
|
644 |
|
|
if |
645 |
|
|
(defined $name) { |
646 |
|
|
|
647 |
|
|
|
648 |
|
|
{ |
649 |
|
|
|
650 |
|
|
if |
651 |
|
|
(((not defined $version or $version eq '1.0') and |
652 |
|
|
not |
653 |
|
|
($name =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
654 |
|
|
) or |
655 |
|
|
(defined $version and $version eq '1.1' and |
656 |
|
|
not |
657 |
|
|
($name =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
658 |
|
|
)) { |
659 |
|
|
|
660 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $name, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
661 |
|
|
|
662 |
|
|
; |
663 |
|
|
} |
664 |
|
|
|
665 |
|
|
|
666 |
|
|
|
667 |
|
|
} |
668 |
|
|
|
669 |
|
|
; |
670 |
|
|
|
671 |
|
|
|
672 |
|
|
; |
673 |
|
|
} |
674 |
|
|
|
675 |
|
|
|
676 |
|
|
} |
677 |
|
|
|
678 |
|
|
; |
679 |
|
|
} |
680 |
|
|
|
681 |
|
|
|
682 |
|
|
{ |
683 |
|
|
|
684 |
|
|
local $Error::Depth = $Error::Depth + 1; |
685 |
|
|
|
686 |
|
|
{ |
687 |
|
|
|
688 |
|
|
|
689 |
|
|
|
690 |
|
|
$self-> |
691 |
|
|
strict_error_checking |
692 |
|
|
( |
693 |
|
|
0 |
694 |
|
|
); |
695 |
|
|
$r = $self-> |
696 |
|
|
create_attribute_ns |
697 |
|
|
( |
698 |
|
|
undef |
699 |
|
|
, [ |
700 |
|
|
undef |
701 |
|
|
, $name]); |
702 |
|
|
$self-> |
703 |
|
|
strict_error_checking |
704 |
|
|
($strict); |
705 |
|
|
|
706 |
|
|
|
707 |
|
|
|
708 |
|
|
} |
709 |
|
|
|
710 |
|
|
|
711 |
|
|
;} |
712 |
|
|
|
713 |
|
|
; |
714 |
|
|
|
715 |
|
|
|
716 |
|
|
} |
717 |
|
|
$r} |
718 |
|
|
sub create_attribute_ns ($$$) { |
719 |
|
|
my ($self, $namespaceURI, $qualifiedName) = @_; |
720 |
|
|
|
721 |
|
|
{ |
722 |
|
|
|
723 |
|
|
if |
724 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
725 |
|
|
require Message::DOM::DOMMain; |
726 |
|
|
|
727 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
728 |
|
|
|
729 |
|
|
; |
730 |
|
|
|
731 |
|
|
|
732 |
|
|
|
733 |
|
|
{ |
734 |
|
|
|
735 |
|
|
|
736 |
|
|
$namespaceURI = undef; |
737 |
|
|
|
738 |
|
|
|
739 |
|
|
|
740 |
|
|
} |
741 |
|
|
|
742 |
|
|
; |
743 |
|
|
} |
744 |
|
|
|
745 |
|
|
|
746 |
|
|
} |
747 |
|
|
my $r; |
748 |
|
|
|
749 |
|
|
{ |
750 |
|
|
|
751 |
|
|
my |
752 |
|
|
($prefix, $lname) = ref $qualifiedName eq 'ARRAY' |
753 |
|
|
? @$qualifiedName |
754 |
|
|
: split /:/, $qualifiedName, 2; |
755 |
|
|
($prefix, $lname) = ( |
756 |
|
|
undef |
757 |
|
|
, $prefix) unless defined $lname; |
758 |
|
|
|
759 |
|
|
## TODO: autoload |
760 |
|
|
if ((defined $namespaceURI and $namespaceURI eq |
761 |
|
|
'http://www.w3.org/XML/1998/namespace' |
762 |
|
|
) or |
763 |
|
|
($lname =~ /^xml:/)) { |
764 |
|
|
require Message::DOM::XML; |
765 |
|
|
} |
766 |
|
|
|
767 |
|
|
if ($self-> |
768 |
|
|
strict_error_checking |
769 |
|
|
) { |
770 |
|
|
my $version = $self-> |
771 |
|
|
xml_version |
772 |
|
|
; |
773 |
|
|
$qualifiedName = defined $prefix ? $prefix.':'.$lname |
774 |
|
|
: $lname; |
775 |
|
|
|
776 |
|
|
|
777 |
|
|
{ |
778 |
|
|
|
779 |
|
|
if |
780 |
|
|
(defined $version and $version eq '1.1') { |
781 |
|
|
unless ( |
782 |
|
|
($qualifiedName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
783 |
|
|
) { |
784 |
|
|
|
785 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
786 |
|
|
|
787 |
|
|
; |
788 |
|
|
} |
789 |
|
|
unless ( |
790 |
|
|
($qualifiedName =~ /\A\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*(?::\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*)?\z/) |
791 |
|
|
) { |
792 |
|
|
|
793 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
794 |
|
|
|
795 |
|
|
; |
796 |
|
|
} |
797 |
|
|
} else { |
798 |
|
|
unless ( |
799 |
|
|
($qualifiedName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
800 |
|
|
) { |
801 |
|
|
|
802 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
803 |
|
|
|
804 |
|
|
; |
805 |
|
|
} |
806 |
|
|
unless ( |
807 |
|
|
($qualifiedName =~ /\A\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*(?::\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*)?\z/) |
808 |
|
|
) { |
809 |
|
|
|
810 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
811 |
|
|
|
812 |
|
|
; |
813 |
|
|
} |
814 |
|
|
} |
815 |
|
|
|
816 |
|
|
|
817 |
|
|
} |
818 |
|
|
|
819 |
|
|
; |
820 |
|
|
|
821 |
|
|
|
822 |
|
|
{ |
823 |
|
|
|
824 |
|
|
if |
825 |
|
|
(defined $prefix) { |
826 |
|
|
if (not defined $namespaceURI) { |
827 |
|
|
|
828 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_PREFIX_WITH_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
829 |
|
|
|
830 |
|
|
; |
831 |
|
|
} elsif ($prefix eq 'xml' and $namespaceURI ne |
832 |
|
|
'http://www.w3.org/XML/1998/namespace' |
833 |
|
|
) { |
834 |
|
|
|
835 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XML_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
836 |
|
|
|
837 |
|
|
; |
838 |
|
|
} elsif ($prefix eq 'xmlns' and $namespaceURI ne |
839 |
|
|
'http://www.w3.org/2000/xmlns/' |
840 |
|
|
) { |
841 |
|
|
|
842 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XMLNS_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
843 |
|
|
|
844 |
|
|
; |
845 |
|
|
} elsif ($namespaceURI eq |
846 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
847 |
|
|
$prefix ne 'xml') { |
848 |
|
|
|
849 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XML_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
850 |
|
|
|
851 |
|
|
; |
852 |
|
|
} elsif ($namespaceURI eq |
853 |
|
|
'http://www.w3.org/2000/xmlns/' and |
854 |
|
|
$prefix ne 'xmlns') { |
855 |
|
|
|
856 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
857 |
|
|
|
858 |
|
|
; |
859 |
|
|
} |
860 |
|
|
} else { ## No prefix |
861 |
|
|
if (not defined $namespaceURI) { |
862 |
|
|
# |
863 |
|
|
} elsif ($namespaceURI eq |
864 |
|
|
'http://www.w3.org/2000/xmlns/' and |
865 |
|
|
$lname ne 'xmlns') { |
866 |
|
|
|
867 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => undef, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
868 |
|
|
|
869 |
|
|
; |
870 |
|
|
} |
871 |
|
|
} |
872 |
|
|
|
873 |
|
|
|
874 |
|
|
} |
875 |
|
|
|
876 |
|
|
; |
877 |
|
|
} |
878 |
|
|
|
879 |
|
|
my $bag = |
880 |
|
|
$self->{'b'} |
881 |
|
|
; |
882 |
|
|
my $stem; |
883 |
|
|
|
884 |
|
|
|
885 |
|
|
{ |
886 |
|
|
|
887 |
|
|
|
888 |
|
|
$stem = 'Message::DOM::Element::ManakaiDOMAttr'->___create_node_stem ($bag, { |
889 |
|
|
|
890 |
|
|
'rc' |
891 |
|
|
=> 0, |
892 |
|
|
|
893 |
|
|
'id' |
894 |
|
|
=> \ |
895 |
|
|
( |
896 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
897 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
898 |
|
|
) |
899 |
|
|
, |
900 |
|
|
}, { |
901 |
|
|
'od' => $self, |
902 |
|
|
'ns' => \$namespaceURI, |
903 |
|
|
'pfx' => \$prefix, |
904 |
|
|
'ln' => \$lname, |
905 |
|
|
'specified' => 1, |
906 |
|
|
}); |
907 |
|
|
|
908 |
|
|
|
909 |
|
|
{ |
910 |
|
|
|
911 |
|
|
if |
912 |
|
|
(defined 'Message::DOM::Element::ManakaiDOMAttr') { |
913 |
|
|
if (ref 'Message::DOM::Element::ManakaiDOMAttr' eq 'SCALAR') { |
914 |
|
|
$stem->{'cls'} = 'Message::DOM::Element::ManakaiDOMAttr'; |
915 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}) { |
916 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}; |
917 |
|
|
} else { |
918 |
|
|
require Scalar::Util; |
919 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'} = \('Message::DOM::Element::ManakaiDOMAttr'); |
920 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}); |
921 |
|
|
} |
922 |
|
|
} else { |
923 |
|
|
CORE::delete $stem->{'cls'}; |
924 |
|
|
} |
925 |
|
|
|
926 |
|
|
|
927 |
|
|
} |
928 |
|
|
|
929 |
|
|
; |
930 |
|
|
$bag->{${$stem->{ |
931 |
|
|
'id' |
932 |
|
|
}}} = $stem; |
933 |
|
|
|
934 |
|
|
|
935 |
|
|
} |
936 |
|
|
|
937 |
|
|
; |
938 |
|
|
|
939 |
|
|
|
940 |
|
|
{ |
941 |
|
|
|
942 |
|
|
|
943 |
|
|
$r = ${$stem->{ |
944 |
|
|
'cls' |
945 |
|
|
}}->___create_node_ref ({ |
946 |
|
|
|
947 |
|
|
'id' |
948 |
|
|
=> $stem->{ |
949 |
|
|
'id' |
950 |
|
|
}, |
951 |
|
|
|
952 |
|
|
'b' |
953 |
|
|
=> $bag, |
954 |
|
|
}, { |
955 |
|
|
}); |
956 |
|
|
$stem->{ |
957 |
|
|
'rc' |
958 |
|
|
}++; |
959 |
|
|
|
960 |
|
|
|
961 |
|
|
} |
962 |
|
|
|
963 |
|
|
; |
964 |
|
|
|
965 |
|
|
## Attribute type information |
966 |
|
|
if ((defined $namespaceURI and $namespaceURI eq |
967 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
968 |
|
|
|
969 |
|
|
$lname eq 'id') or |
970 |
|
|
(not defined $namespaceURI and $lname eq 'xml:id')) { |
971 |
|
|
|
972 |
|
|
|
973 |
|
|
{ |
974 |
|
|
|
975 |
|
|
local $Error::Depth = $Error::Depth + 1; |
976 |
|
|
|
977 |
|
|
{ |
978 |
|
|
|
979 |
|
|
|
980 |
|
|
if |
981 |
|
|
($self-> |
982 |
|
|
dom_config |
983 |
|
|
|
984 |
|
|
-> |
985 |
|
|
get_parameter |
986 |
|
|
|
987 |
|
|
( |
988 |
|
|
'http://suika.fam.cx/www/2006/dom-config/xml-id' |
989 |
|
|
)) { |
990 |
|
|
$r-> |
991 |
|
|
manakai_attribute_type |
992 |
|
|
( |
993 |
|
|
2 |
994 |
|
|
); |
995 |
|
|
} |
996 |
|
|
|
997 |
|
|
|
998 |
|
|
|
999 |
|
|
} |
1000 |
|
|
|
1001 |
|
|
|
1002 |
|
|
;} |
1003 |
|
|
|
1004 |
|
|
; |
1005 |
|
|
} |
1006 |
|
|
|
1007 |
|
|
|
1008 |
|
|
} |
1009 |
|
|
$r} |
1010 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMDocumentElement>}->{has_feature} = {}; |
1011 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Element::ManakaiDOMDocumentElement>} = 0; |
1012 |
wakaba |
1.1 |
package Message::DOM::IFLatest::Element; |
1013 |
wakaba |
1.9 |
our $VERSION = 20061105.0823; |
1014 |
wakaba |
1.1 |
package Message::DOM::Element::ManakaiDOMElement; |
1015 |
wakaba |
1.9 |
our $VERSION = 20061105.0823; |
1016 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
1017 |
|
|
'Message::DOM::IF::Element', |
1018 |
|
|
'Message::DOM::IF::Node', |
1019 |
|
|
'Message::DOM::IFLatest::Element', |
1020 |
|
|
'Message::DOM::IFLatest::Node', |
1021 |
|
|
'Message::DOM::IFLevel1::Element', |
1022 |
|
|
'Message::DOM::IFLevel1::Node', |
1023 |
|
|
'Message::DOM::IFLevel2::Element', |
1024 |
|
|
'Message::DOM::IFLevel2::Node', |
1025 |
|
|
'Message::DOM::IFLevel3::Element', |
1026 |
|
|
'Message::DOM::IFLevel3::Node'; |
1027 |
|
|
use Char::Class::XML 'InXMLNCNameChar10', |
1028 |
|
|
'InXMLNCNameChar11', |
1029 |
|
|
'InXMLNCNameStartChar11', |
1030 |
|
|
'InXMLNameChar10', |
1031 |
|
|
'InXMLNameChar11', |
1032 |
|
|
'InXMLNameStartChar11', |
1033 |
|
|
'InXML_NCNameStartChar10', |
1034 |
|
|
'InXML_NameStartChar10'; |
1035 |
|
|
sub ___create_node_stem ($$$$) { |
1036 |
|
|
my ($self, $bag, $obj, $opt) = @_; |
1037 |
|
|
my $r = {}; |
1038 |
|
|
|
1039 |
|
|
{ |
1040 |
|
|
|
1041 |
|
|
|
1042 |
|
|
$obj->{ |
1043 |
|
|
'child' |
1044 |
|
|
} = []; |
1045 |
|
|
$obj->{ |
1046 |
|
|
'attr' |
1047 |
|
|
} = {}; |
1048 |
|
|
|
1049 |
|
|
|
1050 |
|
|
{ |
1051 |
|
|
|
1052 |
|
|
if |
1053 |
|
|
(defined ${$opt->{'ns'}}) { |
1054 |
|
|
if (ref ${$opt->{'ns'}} eq 'SCALAR') { |
1055 |
|
|
$obj->{'ns'} = ${$opt->{'ns'}}; |
1056 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}) { |
1057 |
|
|
$obj->{'ns'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}; |
1058 |
|
|
} else { |
1059 |
|
|
require Scalar::Util; |
1060 |
|
|
$obj->{'ns'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}} = \(${$opt->{'ns'}}); |
1061 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}); |
1062 |
|
|
} |
1063 |
|
|
} else { |
1064 |
|
|
CORE::delete $obj->{'ns'}; |
1065 |
|
|
} |
1066 |
|
|
|
1067 |
|
|
|
1068 |
wakaba |
1.3 |
} |
1069 |
wakaba |
1.1 |
|
1070 |
|
|
; |
1071 |
|
|
|
1072 |
|
|
|
1073 |
|
|
{ |
1074 |
|
|
|
1075 |
|
|
if |
1076 |
|
|
(defined ${$opt->{'pfx'}}) { |
1077 |
|
|
if (ref ${$opt->{'pfx'}} eq 'SCALAR') { |
1078 |
|
|
$obj->{'pfx'} = ${$opt->{'pfx'}}; |
1079 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}) { |
1080 |
|
|
$obj->{'pfx'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}; |
1081 |
|
|
} else { |
1082 |
|
|
require Scalar::Util; |
1083 |
|
|
$obj->{'pfx'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}} = \(${$opt->{'pfx'}}); |
1084 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}); |
1085 |
|
|
} |
1086 |
|
|
} else { |
1087 |
|
|
CORE::delete $obj->{'pfx'}; |
1088 |
|
|
} |
1089 |
|
|
|
1090 |
|
|
|
1091 |
wakaba |
1.3 |
} |
1092 |
wakaba |
1.1 |
|
1093 |
|
|
; |
1094 |
|
|
|
1095 |
|
|
|
1096 |
|
|
{ |
1097 |
|
|
|
1098 |
|
|
if |
1099 |
|
|
(defined ${$opt->{'ln'}}) { |
1100 |
|
|
if (ref ${$opt->{'ln'}} eq 'SCALAR') { |
1101 |
|
|
$obj->{'ln'} = ${$opt->{'ln'}}; |
1102 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}) { |
1103 |
|
|
$obj->{'ln'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}; |
1104 |
|
|
} else { |
1105 |
|
|
require Scalar::Util; |
1106 |
|
|
$obj->{'ln'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}} = \(${$opt->{'ln'}}); |
1107 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}); |
1108 |
|
|
} |
1109 |
|
|
} else { |
1110 |
|
|
CORE::delete $obj->{'ln'}; |
1111 |
|
|
} |
1112 |
|
|
|
1113 |
|
|
|
1114 |
wakaba |
1.3 |
} |
1115 |
wakaba |
1.1 |
|
1116 |
|
|
; |
1117 |
|
|
|
1118 |
|
|
|
1119 |
|
|
{ |
1120 |
|
|
|
1121 |
|
|
|
1122 |
|
|
$obj->{'od'} = $opt->{'od'}->{ |
1123 |
|
|
'id' |
1124 |
|
|
}; |
1125 |
|
|
$bag->{${$opt->{'od'}->{ |
1126 |
|
|
'id' |
1127 |
|
|
}}} |
1128 |
|
|
->{'do'}->{${$obj->{ |
1129 |
|
|
'id' |
1130 |
|
|
}}} |
1131 |
|
|
= $obj->{ |
1132 |
|
|
'id' |
1133 |
|
|
}; |
1134 |
|
|
|
1135 |
|
|
|
1136 |
wakaba |
1.3 |
} |
1137 |
wakaba |
1.1 |
|
1138 |
|
|
; |
1139 |
|
|
$r = $obj; |
1140 |
|
|
|
1141 |
|
|
|
1142 |
wakaba |
1.3 |
} |
1143 |
wakaba |
1.1 |
$r} |
1144 |
|
|
sub ___create_node_ref ($$$) { |
1145 |
|
|
my ($self, $obj, $opt) = @_; |
1146 |
|
|
my $r; |
1147 |
|
|
|
1148 |
|
|
{ |
1149 |
|
|
|
1150 |
|
|
my |
1151 |
|
|
$class; |
1152 |
|
|
CLS: { |
1153 |
wakaba |
1.9 |
## From the cache |
1154 |
wakaba |
1.1 |
|
1155 |
|
|
|
1156 |
|
|
{ |
1157 |
|
|
|
1158 |
|
|
|
1159 |
|
|
$class = $obj->{ |
1160 |
|
|
'b' |
1161 |
|
|
}->{${$obj->{ |
1162 |
|
|
'id' |
1163 |
|
|
}}} |
1164 |
|
|
->{'dnrcls'}; |
1165 |
|
|
|
1166 |
|
|
|
1167 |
wakaba |
1.3 |
} |
1168 |
wakaba |
1.1 |
|
1169 |
|
|
; |
1170 |
|
|
if (defined $class) { |
1171 |
wakaba |
1.9 |
last CLS; |
1172 |
|
|
} else { |
1173 |
|
|
$class = \$self; |
1174 |
wakaba |
1.1 |
} |
1175 |
|
|
|
1176 |
|
|
my $nsuri; |
1177 |
|
|
|
1178 |
|
|
|
1179 |
|
|
{ |
1180 |
|
|
|
1181 |
|
|
|
1182 |
|
|
$nsuri = $obj->{ |
1183 |
|
|
'b' |
1184 |
|
|
}->{${$obj->{ |
1185 |
|
|
'id' |
1186 |
|
|
}}} |
1187 |
|
|
->{'ns'}; |
1188 |
|
|
|
1189 |
|
|
|
1190 |
wakaba |
1.3 |
} |
1191 |
wakaba |
1.1 |
|
1192 |
|
|
; |
1193 |
|
|
$nsuri = \'' unless defined $nsuri; |
1194 |
|
|
my $ln; |
1195 |
|
|
|
1196 |
|
|
|
1197 |
|
|
{ |
1198 |
|
|
|
1199 |
|
|
|
1200 |
|
|
$ln = $obj->{ |
1201 |
|
|
'b' |
1202 |
|
|
}->{${$obj->{ |
1203 |
|
|
'id' |
1204 |
|
|
}}} |
1205 |
|
|
->{'ln'}; |
1206 |
|
|
|
1207 |
|
|
|
1208 |
wakaba |
1.3 |
} |
1209 |
wakaba |
1.1 |
|
1210 |
|
|
; |
1211 |
|
|
|
1212 |
wakaba |
1.9 |
## Use cases: |
1213 |
|
|
## - |html5:a| element type |
1214 |
|
|
## - |html5:*| element types |
1215 |
|
|
A: for my $nm ( |
1216 |
|
|
[$nsuri, $ln], |
1217 |
|
|
[$nsuri, \'*'], |
1218 |
|
|
) { |
1219 |
|
|
unless ($Message::DOM::Element::ElementClass |
1220 |
|
|
->{${$nm->[0]}}->{${$nm->[1]}}) { |
1221 |
|
|
if ($Message::Util::AutoLoad::Registry::ElementType |
1222 |
wakaba |
1.7 |
->{${$nm->[0]}}->{${$nm->[1]}}) { |
1223 |
wakaba |
1.9 |
eval qq{require |
1224 |
|
|
$Message::Util::AutoLoad::Registry::ElementType->{ |
1225 |
|
|
${$nm->[0]}}->{${$nm->[1]}}->{module}}; |
1226 |
|
|
die $@ if $@; |
1227 |
wakaba |
1.7 |
} |
1228 |
wakaba |
1.9 |
} |
1229 |
wakaba |
1.7 |
|
1230 |
wakaba |
1.9 |
if ($Message::DOM::Element::ElementClass |
1231 |
|
|
->{${$nm->[0]}}->{${$nm->[1]}}) { |
1232 |
|
|
$class = \($Message::DOM::Element::ElementClass |
1233 |
wakaba |
1.7 |
->{${$nm->[0]}}->{${$nm->[1]}}); |
1234 |
wakaba |
1.9 |
last A; |
1235 |
wakaba |
1.1 |
} |
1236 |
|
|
} # A |
1237 |
|
|
|
1238 |
|
|
|
1239 |
|
|
|
1240 |
|
|
{ |
1241 |
|
|
|
1242 |
|
|
|
1243 |
|
|
$obj->{ |
1244 |
|
|
'b' |
1245 |
|
|
}->{${$obj->{ |
1246 |
|
|
'id' |
1247 |
|
|
}}} |
1248 |
|
|
->{'dnrcls'} = $class; |
1249 |
|
|
|
1250 |
|
|
|
1251 |
wakaba |
1.3 |
} |
1252 |
wakaba |
1.1 |
|
1253 |
|
|
; |
1254 |
|
|
} # CLS |
1255 |
|
|
$r = bless $obj, $$class; |
1256 |
|
|
|
1257 |
|
|
|
1258 |
wakaba |
1.3 |
} |
1259 |
wakaba |
1.1 |
$r} |
1260 |
|
|
sub node_type ($;$) { |
1261 |
|
|
if (@_ == 1) {my ($self) = @_; |
1262 |
|
|
my $r; |
1263 |
wakaba |
1.6 |
$r = 1; |
1264 |
wakaba |
1.1 |
$r; |
1265 |
|
|
} else {my ($self) = @_; |
1266 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
1267 |
|
|
} |
1268 |
|
|
} |
1269 |
|
|
sub prefix ($;$) { |
1270 |
|
|
if (@_ == 1) {my ($self) = @_; |
1271 |
|
|
my $r = ''; |
1272 |
|
|
|
1273 |
|
|
{ |
1274 |
|
|
|
1275 |
|
|
my |
1276 |
|
|
$v; |
1277 |
|
|
|
1278 |
|
|
|
1279 |
|
|
{ |
1280 |
|
|
|
1281 |
|
|
|
1282 |
|
|
$v = $self->{ |
1283 |
|
|
'b' |
1284 |
|
|
}->{${$self->{ |
1285 |
|
|
'id' |
1286 |
|
|
}}} |
1287 |
|
|
->{'pfx'}; |
1288 |
|
|
|
1289 |
|
|
|
1290 |
wakaba |
1.3 |
} |
1291 |
wakaba |
1.1 |
|
1292 |
|
|
; |
1293 |
|
|
$r = defined $v ? $$v : |
1294 |
|
|
undef |
1295 |
|
|
; |
1296 |
|
|
|
1297 |
|
|
|
1298 |
wakaba |
1.3 |
} |
1299 |
wakaba |
1.1 |
$r; |
1300 |
|
|
} else {my ($self, $given) = @_; |
1301 |
|
|
|
1302 |
|
|
{ |
1303 |
|
|
|
1304 |
|
|
my |
1305 |
|
|
$od = $self-> |
1306 |
|
|
owner_document |
1307 |
|
|
; |
1308 |
|
|
if ($od-> |
1309 |
|
|
strict_error_checking |
1310 |
|
|
) { |
1311 |
|
|
|
1312 |
|
|
|
1313 |
|
|
{ |
1314 |
|
|
|
1315 |
|
|
if |
1316 |
|
|
($self-> |
1317 |
|
|
manakai_read_only |
1318 |
|
|
) { |
1319 |
|
|
|
1320 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
1321 |
|
|
|
1322 |
|
|
; |
1323 |
|
|
} |
1324 |
|
|
|
1325 |
|
|
|
1326 |
wakaba |
1.3 |
} |
1327 |
wakaba |
1.1 |
|
1328 |
|
|
; |
1329 |
|
|
my $nsuri; |
1330 |
|
|
|
1331 |
|
|
|
1332 |
|
|
{ |
1333 |
|
|
|
1334 |
|
|
|
1335 |
|
|
$nsuri = $self->{ |
1336 |
|
|
'b' |
1337 |
|
|
}->{${$self->{ |
1338 |
|
|
'id' |
1339 |
|
|
}}} |
1340 |
|
|
->{'ns'}; |
1341 |
|
|
|
1342 |
|
|
|
1343 |
wakaba |
1.3 |
} |
1344 |
wakaba |
1.1 |
|
1345 |
|
|
; |
1346 |
|
|
if (not defined $nsuri) { |
1347 |
|
|
|
1348 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => undef, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://www.w3.org/2001/04/infoset#prefix' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_PREFIX_WITH_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'prefix'; |
1349 |
|
|
|
1350 |
|
|
; |
1351 |
|
|
} elsif ($$nsuri ne |
1352 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
1353 |
|
|
|
1354 |
|
|
defined $given and $given eq 'xml') { |
1355 |
|
|
|
1356 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $self->namespace_uri, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://www.w3.org/2001/04/infoset#prefix' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XML_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'prefix'; |
1357 |
|
|
|
1358 |
|
|
; |
1359 |
|
|
} |
1360 |
|
|
my $version = $od-> |
1361 |
|
|
xml_version |
1362 |
|
|
; |
1363 |
|
|
|
1364 |
|
|
|
1365 |
|
|
{ |
1366 |
|
|
|
1367 |
|
|
if |
1368 |
|
|
(defined $given and $given eq '') { |
1369 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
1370 |
wakaba |
1.1 |
|
1371 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-prefix', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureNamespacePrefix+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
1372 |
|
|
|
1373 |
|
|
; |
1374 |
|
|
undef $given; |
1375 |
|
|
} |
1376 |
|
|
if (defined $given) { |
1377 |
|
|
if (($version eq '1.0' and |
1378 |
|
|
not |
1379 |
|
|
($given =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
1380 |
|
|
) or |
1381 |
|
|
($version eq '1.1' and |
1382 |
|
|
not |
1383 |
|
|
($given =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
1384 |
|
|
)) { |
1385 |
|
|
|
1386 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://www.w3.org/2001/04/infoset#name' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureNamespacePrefix+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
1387 |
|
|
|
1388 |
|
|
; |
1389 |
|
|
} elsif (index ($given, ':') > -1) { |
1390 |
|
|
|
1391 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#name' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_BAD_NCNAME', 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureNamespacePrefix+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
1392 |
|
|
|
1393 |
|
|
; |
1394 |
|
|
} |
1395 |
|
|
} # has prefix |
1396 |
|
|
|
1397 |
|
|
|
1398 |
wakaba |
1.3 |
} |
1399 |
wakaba |
1.1 |
|
1400 |
|
|
; |
1401 |
|
|
} # strict |
1402 |
|
|
my $v = defined $given ? \$given : |
1403 |
|
|
undef |
1404 |
|
|
; |
1405 |
|
|
|
1406 |
|
|
|
1407 |
|
|
{ |
1408 |
|
|
|
1409 |
|
|
|
1410 |
|
|
$self->{ |
1411 |
|
|
'b' |
1412 |
|
|
}->{${$self->{ |
1413 |
|
|
'id' |
1414 |
|
|
}}} |
1415 |
|
|
->{'pfx'} = $v; |
1416 |
|
|
|
1417 |
|
|
|
1418 |
wakaba |
1.3 |
} |
1419 |
wakaba |
1.1 |
|
1420 |
|
|
; |
1421 |
|
|
|
1422 |
|
|
|
1423 |
wakaba |
1.3 |
} |
1424 |
wakaba |
1.1 |
} |
1425 |
|
|
} |
1426 |
|
|
sub append_child ($$) { |
1427 |
|
|
my ($self, $newChild) = @_; |
1428 |
|
|
my $r; |
1429 |
|
|
|
1430 |
|
|
{ |
1431 |
|
|
|
1432 |
|
|
my |
1433 |
|
|
$self_od = $self-> |
1434 |
|
|
owner_document |
1435 |
|
|
; |
1436 |
|
|
if ($self_od-> |
1437 |
|
|
strict_error_checking |
1438 |
|
|
) { |
1439 |
|
|
my $anode = $self; |
1440 |
|
|
while (defined $anode) { |
1441 |
|
|
if ($anode eq $newChild) { |
1442 |
|
|
|
1443 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_ANCESTOR_OR_SELF', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1444 |
|
|
|
1445 |
|
|
; |
1446 |
|
|
} |
1447 |
|
|
$anode = $anode-> |
1448 |
|
|
parent_node |
1449 |
|
|
; |
1450 |
|
|
} |
1451 |
|
|
} |
1452 |
|
|
my $child_od = $newChild-> |
1453 |
|
|
owner_document |
1454 |
|
|
; |
1455 |
|
|
my $child_nt = $newChild-> |
1456 |
|
|
node_type |
1457 |
|
|
; |
1458 |
|
|
|
1459 |
|
|
|
1460 |
|
|
{ |
1461 |
|
|
|
1462 |
|
|
|
1463 |
|
|
{ |
1464 |
|
|
|
1465 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1466 |
|
|
|
1467 |
|
|
{ |
1468 |
|
|
|
1469 |
|
|
|
1470 |
|
|
my |
1471 |
|
|
$strict = $self_od-> |
1472 |
|
|
strict_error_checking |
1473 |
|
|
; |
1474 |
|
|
|
1475 |
|
|
## -- Node Type check |
1476 |
|
|
my @new_child; |
1477 |
|
|
if ({ |
1478 |
wakaba |
1.6 |
3 => 1, |
1479 |
|
|
5 => 1, |
1480 |
|
|
1 => 1, |
1481 |
|
|
4 => 1, |
1482 |
|
|
7 => 1, |
1483 |
|
|
8 => 1, |
1484 |
wakaba |
1.1 |
}->{$child_nt}) { |
1485 |
|
|
push @new_child, $newChild; |
1486 |
|
|
} elsif ($child_nt == |
1487 |
wakaba |
1.6 |
11 |
1488 |
wakaba |
1.1 |
) { |
1489 |
|
|
for my $cn (@{$newChild-> |
1490 |
|
|
child_nodes |
1491 |
|
|
}) { |
1492 |
|
|
unless ({ |
1493 |
wakaba |
1.6 |
3 => 1, |
1494 |
|
|
5 => 1, |
1495 |
|
|
1 => 1, |
1496 |
|
|
4 => 1, |
1497 |
|
|
7 => 1, |
1498 |
|
|
8 => 1, |
1499 |
wakaba |
1.1 |
}->{$cn-> |
1500 |
|
|
node_type |
1501 |
|
|
}) { |
1502 |
|
|
|
1503 |
|
|
|
1504 |
|
|
{ |
1505 |
|
|
|
1506 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1507 |
|
|
|
1508 |
|
|
{ |
1509 |
|
|
|
1510 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1511 |
|
|
|
1512 |
|
|
|
1513 |
wakaba |
1.3 |
} |
1514 |
wakaba |
1.1 |
|
1515 |
|
|
|
1516 |
|
|
;} |
1517 |
|
|
|
1518 |
|
|
; |
1519 |
|
|
} |
1520 |
|
|
push @new_child, $cn; |
1521 |
|
|
} |
1522 |
|
|
} else { |
1523 |
|
|
|
1524 |
|
|
|
1525 |
|
|
{ |
1526 |
|
|
|
1527 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1528 |
|
|
|
1529 |
|
|
{ |
1530 |
|
|
|
1531 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1532 |
|
|
|
1533 |
|
|
|
1534 |
wakaba |
1.3 |
} |
1535 |
wakaba |
1.1 |
|
1536 |
|
|
|
1537 |
|
|
;} |
1538 |
|
|
|
1539 |
|
|
; |
1540 |
|
|
} |
1541 |
|
|
|
1542 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
1543 |
|
|
parent_node |
1544 |
|
|
: |
1545 |
|
|
|
1546 |
|
|
undef |
1547 |
|
|
; |
1548 |
|
|
if ($strict) { |
1549 |
|
|
## -- Wrong-document check |
1550 |
|
|
unless ($self_od eq $child_od) { |
1551 |
|
|
|
1552 |
|
|
|
1553 |
|
|
{ |
1554 |
|
|
|
1555 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1556 |
|
|
|
1557 |
|
|
{ |
1558 |
|
|
|
1559 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1560 |
|
|
|
1561 |
|
|
|
1562 |
wakaba |
1.3 |
} |
1563 |
wakaba |
1.1 |
|
1564 |
|
|
|
1565 |
|
|
;} |
1566 |
|
|
|
1567 |
|
|
; |
1568 |
|
|
} |
1569 |
|
|
|
1570 |
|
|
## -- Read-onlyness check |
1571 |
|
|
if ($self-> |
1572 |
|
|
manakai_read_only |
1573 |
|
|
) { |
1574 |
|
|
|
1575 |
|
|
|
1576 |
|
|
{ |
1577 |
|
|
|
1578 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1579 |
|
|
|
1580 |
|
|
{ |
1581 |
|
|
|
1582 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
1583 |
|
|
|
1584 |
|
|
|
1585 |
wakaba |
1.3 |
} |
1586 |
wakaba |
1.1 |
|
1587 |
|
|
|
1588 |
|
|
;} |
1589 |
|
|
|
1590 |
|
|
; |
1591 |
|
|
} |
1592 |
|
|
if (@new_child) { |
1593 |
|
|
if ($nc_parent and |
1594 |
|
|
$nc_parent-> |
1595 |
|
|
manakai_read_only |
1596 |
|
|
) { |
1597 |
|
|
|
1598 |
|
|
|
1599 |
|
|
{ |
1600 |
|
|
|
1601 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1602 |
|
|
|
1603 |
|
|
{ |
1604 |
|
|
|
1605 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
1606 |
|
|
|
1607 |
|
|
|
1608 |
wakaba |
1.3 |
} |
1609 |
wakaba |
1.1 |
|
1610 |
|
|
|
1611 |
|
|
;} |
1612 |
|
|
|
1613 |
|
|
; |
1614 |
|
|
} |
1615 |
|
|
} |
1616 |
|
|
} |
1617 |
|
|
|
1618 |
|
|
## -- Insert at... |
1619 |
|
|
my $index = -1; # last |
1620 |
|
|
|
1621 |
|
|
|
1622 |
|
|
; # FOR !tc:ForAppendChild |
1623 |
|
|
|
1624 |
|
|
## -- Removes from parent |
1625 |
|
|
if ($nc_parent) { |
1626 |
|
|
if ($child_nt == |
1627 |
wakaba |
1.6 |
11 |
1628 |
wakaba |
1.1 |
) { |
1629 |
|
|
|
1630 |
|
|
|
1631 |
|
|
{ |
1632 |
|
|
|
1633 |
|
|
|
1634 |
|
|
$newChild->{ |
1635 |
|
|
'b' |
1636 |
|
|
}->{${$newChild->{ |
1637 |
|
|
'id' |
1638 |
|
|
}}} |
1639 |
|
|
->{'child'} = []; |
1640 |
|
|
|
1641 |
|
|
|
1642 |
wakaba |
1.3 |
} |
1643 |
wakaba |
1.1 |
|
1644 |
|
|
; |
1645 |
|
|
} else { |
1646 |
|
|
my $v; |
1647 |
|
|
|
1648 |
|
|
|
1649 |
|
|
{ |
1650 |
|
|
|
1651 |
|
|
|
1652 |
|
|
$v = $nc_parent->{ |
1653 |
|
|
'b' |
1654 |
|
|
}->{${$nc_parent->{ |
1655 |
|
|
'id' |
1656 |
|
|
}}} |
1657 |
|
|
->{'child'}; |
1658 |
|
|
|
1659 |
|
|
|
1660 |
wakaba |
1.3 |
} |
1661 |
wakaba |
1.1 |
|
1662 |
|
|
; |
1663 |
|
|
RP: for my $i (0..$#$v) { |
1664 |
|
|
my $nodeid = $v->[$i]; |
1665 |
|
|
if ( |
1666 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
1667 |
|
|
) { |
1668 |
|
|
splice @$v, $i, 1, (); |
1669 |
|
|
last RP; |
1670 |
|
|
} |
1671 |
|
|
} # RP |
1672 |
|
|
} |
1673 |
|
|
} |
1674 |
|
|
|
1675 |
|
|
## -- Rewrite the |parentNode| properties |
1676 |
|
|
for my $nc (@new_child) { |
1677 |
|
|
|
1678 |
|
|
|
1679 |
|
|
{ |
1680 |
|
|
|
1681 |
|
|
|
1682 |
|
|
$nc->{ |
1683 |
|
|
'b' |
1684 |
|
|
}->{${$nc->{ |
1685 |
|
|
'id' |
1686 |
|
|
}}} |
1687 |
|
|
->{'parent'} = $self->{ |
1688 |
|
|
'id' |
1689 |
|
|
}; |
1690 |
|
|
|
1691 |
|
|
|
1692 |
wakaba |
1.3 |
} |
1693 |
wakaba |
1.1 |
|
1694 |
|
|
; |
1695 |
|
|
} |
1696 |
|
|
|
1697 |
|
|
my $children; |
1698 |
|
|
|
1699 |
|
|
|
1700 |
|
|
{ |
1701 |
|
|
|
1702 |
|
|
|
1703 |
|
|
$children = $self->{ |
1704 |
|
|
'b' |
1705 |
|
|
}->{${$self->{ |
1706 |
|
|
'id' |
1707 |
|
|
}}} |
1708 |
|
|
->{'child'}; |
1709 |
|
|
|
1710 |
|
|
|
1711 |
wakaba |
1.3 |
} |
1712 |
wakaba |
1.1 |
|
1713 |
|
|
; |
1714 |
|
|
|
1715 |
|
|
|
1716 |
|
|
|
1717 |
|
|
{ |
1718 |
|
|
|
1719 |
|
|
|
1720 |
|
|
## -- Adds to children list |
1721 |
|
|
push @$children, map { |
1722 |
|
|
|
1723 |
|
|
$_->{'id'} |
1724 |
|
|
|
1725 |
|
|
} @new_child; |
1726 |
|
|
$r = $newChild; |
1727 |
|
|
|
1728 |
|
|
|
1729 |
|
|
|
1730 |
wakaba |
1.3 |
} |
1731 |
wakaba |
1.1 |
|
1732 |
|
|
; |
1733 |
|
|
|
1734 |
|
|
|
1735 |
|
|
|
1736 |
|
|
; |
1737 |
|
|
|
1738 |
|
|
|
1739 |
|
|
|
1740 |
|
|
; |
1741 |
|
|
|
1742 |
|
|
|
1743 |
|
|
|
1744 |
wakaba |
1.3 |
} |
1745 |
wakaba |
1.1 |
|
1746 |
|
|
|
1747 |
|
|
;} |
1748 |
|
|
|
1749 |
|
|
; |
1750 |
|
|
|
1751 |
|
|
|
1752 |
wakaba |
1.3 |
} |
1753 |
wakaba |
1.1 |
|
1754 |
|
|
; |
1755 |
|
|
|
1756 |
|
|
|
1757 |
wakaba |
1.3 |
} |
1758 |
wakaba |
1.1 |
$r} |
1759 |
|
|
sub insert_before ($$;$) { |
1760 |
|
|
my ($self, $newChild, $refChild) = @_; |
1761 |
|
|
my $r; |
1762 |
|
|
|
1763 |
|
|
{ |
1764 |
|
|
|
1765 |
|
|
my |
1766 |
|
|
$self_od = $self-> |
1767 |
|
|
owner_document |
1768 |
|
|
; |
1769 |
|
|
if ($self_od-> |
1770 |
|
|
strict_error_checking |
1771 |
|
|
) { |
1772 |
|
|
my $anode = $self; |
1773 |
|
|
while (defined $anode) { |
1774 |
|
|
if ($anode eq $newChild) { |
1775 |
|
|
|
1776 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_ANCESTOR_OR_SELF', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1777 |
|
|
|
1778 |
|
|
; |
1779 |
|
|
} |
1780 |
|
|
$anode = $anode-> |
1781 |
|
|
parent_node |
1782 |
|
|
; |
1783 |
|
|
} |
1784 |
|
|
} |
1785 |
|
|
my $child_od = $newChild-> |
1786 |
|
|
owner_document |
1787 |
|
|
; |
1788 |
|
|
my $child_nt = $newChild-> |
1789 |
|
|
node_type |
1790 |
|
|
; |
1791 |
|
|
|
1792 |
|
|
|
1793 |
|
|
{ |
1794 |
|
|
|
1795 |
|
|
|
1796 |
|
|
{ |
1797 |
|
|
|
1798 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1799 |
|
|
|
1800 |
|
|
{ |
1801 |
|
|
|
1802 |
|
|
|
1803 |
|
|
my |
1804 |
|
|
$strict = $self_od-> |
1805 |
|
|
strict_error_checking |
1806 |
|
|
; |
1807 |
|
|
|
1808 |
|
|
## -- Node Type check |
1809 |
|
|
my @new_child; |
1810 |
|
|
if ({ |
1811 |
wakaba |
1.6 |
3 => 1, |
1812 |
|
|
5 => 1, |
1813 |
|
|
1 => 1, |
1814 |
|
|
4 => 1, |
1815 |
|
|
7 => 1, |
1816 |
|
|
8 => 1, |
1817 |
wakaba |
1.1 |
}->{$child_nt}) { |
1818 |
|
|
push @new_child, $newChild; |
1819 |
|
|
} elsif ($child_nt == |
1820 |
wakaba |
1.6 |
11 |
1821 |
wakaba |
1.1 |
) { |
1822 |
|
|
for my $cn (@{$newChild-> |
1823 |
|
|
child_nodes |
1824 |
|
|
}) { |
1825 |
|
|
unless ({ |
1826 |
wakaba |
1.6 |
3 => 1, |
1827 |
|
|
5 => 1, |
1828 |
|
|
1 => 1, |
1829 |
|
|
4 => 1, |
1830 |
|
|
7 => 1, |
1831 |
|
|
8 => 1, |
1832 |
wakaba |
1.1 |
}->{$cn-> |
1833 |
|
|
node_type |
1834 |
|
|
}) { |
1835 |
|
|
|
1836 |
|
|
|
1837 |
|
|
{ |
1838 |
|
|
|
1839 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1840 |
|
|
|
1841 |
|
|
{ |
1842 |
|
|
|
1843 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1844 |
|
|
|
1845 |
|
|
|
1846 |
wakaba |
1.3 |
} |
1847 |
wakaba |
1.1 |
|
1848 |
|
|
|
1849 |
|
|
;} |
1850 |
|
|
|
1851 |
|
|
; |
1852 |
|
|
} |
1853 |
|
|
push @new_child, $cn; |
1854 |
|
|
} |
1855 |
|
|
} else { |
1856 |
|
|
|
1857 |
|
|
|
1858 |
|
|
{ |
1859 |
|
|
|
1860 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1861 |
|
|
|
1862 |
|
|
{ |
1863 |
|
|
|
1864 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1865 |
|
|
|
1866 |
|
|
|
1867 |
wakaba |
1.3 |
} |
1868 |
wakaba |
1.1 |
|
1869 |
|
|
|
1870 |
|
|
;} |
1871 |
|
|
|
1872 |
|
|
; |
1873 |
|
|
} |
1874 |
|
|
|
1875 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
1876 |
|
|
parent_node |
1877 |
|
|
: |
1878 |
|
|
|
1879 |
|
|
undef |
1880 |
|
|
; |
1881 |
|
|
if ($strict) { |
1882 |
|
|
## -- Wrong-document check |
1883 |
|
|
unless ($self_od eq $child_od) { |
1884 |
|
|
|
1885 |
|
|
|
1886 |
|
|
{ |
1887 |
|
|
|
1888 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1889 |
|
|
|
1890 |
|
|
{ |
1891 |
|
|
|
1892 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1893 |
|
|
|
1894 |
|
|
|
1895 |
wakaba |
1.3 |
} |
1896 |
wakaba |
1.1 |
|
1897 |
|
|
|
1898 |
|
|
;} |
1899 |
|
|
|
1900 |
|
|
; |
1901 |
|
|
} |
1902 |
|
|
|
1903 |
|
|
## -- Read-onlyness check |
1904 |
|
|
if ($self-> |
1905 |
|
|
manakai_read_only |
1906 |
|
|
) { |
1907 |
|
|
|
1908 |
|
|
|
1909 |
|
|
{ |
1910 |
|
|
|
1911 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1912 |
|
|
|
1913 |
|
|
{ |
1914 |
|
|
|
1915 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
1916 |
|
|
|
1917 |
|
|
|
1918 |
wakaba |
1.3 |
} |
1919 |
wakaba |
1.1 |
|
1920 |
|
|
|
1921 |
|
|
;} |
1922 |
|
|
|
1923 |
|
|
; |
1924 |
|
|
} |
1925 |
|
|
if (@new_child) { |
1926 |
|
|
if ($nc_parent and |
1927 |
|
|
$nc_parent-> |
1928 |
|
|
manakai_read_only |
1929 |
|
|
) { |
1930 |
|
|
|
1931 |
|
|
|
1932 |
|
|
{ |
1933 |
|
|
|
1934 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1935 |
|
|
|
1936 |
|
|
{ |
1937 |
|
|
|
1938 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
1939 |
|
|
|
1940 |
|
|
|
1941 |
wakaba |
1.3 |
} |
1942 |
wakaba |
1.1 |
|
1943 |
|
|
|
1944 |
|
|
;} |
1945 |
|
|
|
1946 |
|
|
; |
1947 |
|
|
} |
1948 |
|
|
} |
1949 |
|
|
} |
1950 |
|
|
|
1951 |
|
|
## -- Insert at... |
1952 |
|
|
my $index = -1; # last |
1953 |
|
|
|
1954 |
|
|
|
1955 |
|
|
{ |
1956 |
|
|
|
1957 |
|
|
|
1958 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
1959 |
|
|
if (defined $refChild) { |
1960 |
|
|
if ($refChild eq $newChild) { |
1961 |
|
|
|
1962 |
|
|
|
1963 |
|
|
{ |
1964 |
|
|
|
1965 |
|
|
|
1966 |
|
|
{ |
1967 |
|
|
|
1968 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1969 |
|
|
|
1970 |
|
|
{ |
1971 |
|
|
|
1972 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#insert-before-itself', 'rdata' => $refChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
1973 |
|
|
|
1974 |
|
|
|
1975 |
wakaba |
1.3 |
} |
1976 |
wakaba |
1.1 |
|
1977 |
|
|
|
1978 |
|
|
;} |
1979 |
|
|
|
1980 |
|
|
; |
1981 |
|
|
|
1982 |
|
|
|
1983 |
|
|
|
1984 |
wakaba |
1.3 |
} |
1985 |
wakaba |
1.1 |
|
1986 |
|
|
; |
1987 |
|
|
|
1988 |
|
|
|
1989 |
|
|
; |
1990 |
|
|
} |
1991 |
|
|
|
1992 |
|
|
my $cns = $self-> |
1993 |
|
|
child_nodes |
1994 |
|
|
; |
1995 |
|
|
my $cnsl = @$cns; |
1996 |
|
|
C: { |
1997 |
|
|
$index = 0; |
1998 |
|
|
for my $i (0..($cnsl-1)) { |
1999 |
|
|
my $cn = $cns->[$i]; |
2000 |
|
|
if ($cn eq $refChild) { |
2001 |
|
|
$index += $i; |
2002 |
|
|
last C; |
2003 |
|
|
} elsif ($cn eq $newChild) { |
2004 |
|
|
$index = -1; # offset |
2005 |
|
|
} |
2006 |
|
|
} |
2007 |
|
|
|
2008 |
|
|
|
2009 |
|
|
{ |
2010 |
|
|
|
2011 |
|
|
|
2012 |
|
|
{ |
2013 |
|
|
|
2014 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2015 |
|
|
|
2016 |
|
|
{ |
2017 |
|
|
|
2018 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'refChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $refChild; |
2019 |
|
|
|
2020 |
|
|
|
2021 |
wakaba |
1.3 |
} |
2022 |
wakaba |
1.1 |
|
2023 |
|
|
|
2024 |
|
|
;} |
2025 |
|
|
|
2026 |
|
|
; |
2027 |
|
|
|
2028 |
|
|
|
2029 |
|
|
|
2030 |
wakaba |
1.3 |
} |
2031 |
wakaba |
1.1 |
|
2032 |
|
|
; |
2033 |
|
|
|
2034 |
|
|
|
2035 |
|
|
; |
2036 |
|
|
} # C |
2037 |
|
|
} else { # |oldChild| is not defined |
2038 |
|
|
|
2039 |
|
|
|
2040 |
|
|
; |
2041 |
|
|
} |
2042 |
|
|
|
2043 |
|
|
|
2044 |
|
|
|
2045 |
wakaba |
1.3 |
} |
2046 |
wakaba |
1.1 |
|
2047 |
|
|
; # FOR !tc:ForAppendChild |
2048 |
|
|
|
2049 |
|
|
## -- Removes from parent |
2050 |
|
|
if ($nc_parent) { |
2051 |
|
|
if ($child_nt == |
2052 |
wakaba |
1.6 |
11 |
2053 |
wakaba |
1.1 |
) { |
2054 |
|
|
|
2055 |
|
|
|
2056 |
|
|
{ |
2057 |
|
|
|
2058 |
|
|
|
2059 |
|
|
$newChild->{ |
2060 |
|
|
'b' |
2061 |
|
|
}->{${$newChild->{ |
2062 |
|
|
'id' |
2063 |
|
|
}}} |
2064 |
|
|
->{'child'} = []; |
2065 |
|
|
|
2066 |
|
|
|
2067 |
wakaba |
1.3 |
} |
2068 |
wakaba |
1.1 |
|
2069 |
|
|
; |
2070 |
|
|
} else { |
2071 |
|
|
my $v; |
2072 |
|
|
|
2073 |
|
|
|
2074 |
|
|
{ |
2075 |
|
|
|
2076 |
|
|
|
2077 |
|
|
$v = $nc_parent->{ |
2078 |
|
|
'b' |
2079 |
|
|
}->{${$nc_parent->{ |
2080 |
|
|
'id' |
2081 |
|
|
}}} |
2082 |
|
|
->{'child'}; |
2083 |
|
|
|
2084 |
|
|
|
2085 |
wakaba |
1.3 |
} |
2086 |
wakaba |
1.1 |
|
2087 |
|
|
; |
2088 |
|
|
RP: for my $i (0..$#$v) { |
2089 |
|
|
my $nodeid = $v->[$i]; |
2090 |
|
|
if ( |
2091 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
2092 |
|
|
) { |
2093 |
|
|
splice @$v, $i, 1, (); |
2094 |
|
|
last RP; |
2095 |
|
|
} |
2096 |
|
|
} # RP |
2097 |
|
|
} |
2098 |
|
|
} |
2099 |
|
|
|
2100 |
|
|
## -- Rewrite the |parentNode| properties |
2101 |
|
|
for my $nc (@new_child) { |
2102 |
|
|
|
2103 |
|
|
|
2104 |
|
|
{ |
2105 |
|
|
|
2106 |
|
|
|
2107 |
|
|
$nc->{ |
2108 |
|
|
'b' |
2109 |
|
|
}->{${$nc->{ |
2110 |
|
|
'id' |
2111 |
|
|
}}} |
2112 |
|
|
->{'parent'} = $self->{ |
2113 |
|
|
'id' |
2114 |
|
|
}; |
2115 |
|
|
|
2116 |
|
|
|
2117 |
wakaba |
1.3 |
} |
2118 |
wakaba |
1.1 |
|
2119 |
|
|
; |
2120 |
|
|
} |
2121 |
|
|
|
2122 |
|
|
my $children; |
2123 |
|
|
|
2124 |
|
|
|
2125 |
|
|
{ |
2126 |
|
|
|
2127 |
|
|
|
2128 |
|
|
$children = $self->{ |
2129 |
|
|
'b' |
2130 |
|
|
}->{${$self->{ |
2131 |
|
|
'id' |
2132 |
|
|
}}} |
2133 |
|
|
->{'child'}; |
2134 |
|
|
|
2135 |
|
|
|
2136 |
wakaba |
1.3 |
} |
2137 |
wakaba |
1.1 |
|
2138 |
|
|
; |
2139 |
|
|
|
2140 |
|
|
|
2141 |
|
|
|
2142 |
|
|
; |
2143 |
|
|
|
2144 |
|
|
|
2145 |
|
|
|
2146 |
|
|
{ |
2147 |
|
|
|
2148 |
|
|
|
2149 |
|
|
## -- Adds to children list |
2150 |
|
|
if ($index == -1) { |
2151 |
|
|
push @$children, map { |
2152 |
|
|
|
2153 |
|
|
$_->{'id'} |
2154 |
|
|
|
2155 |
|
|
} @new_child; |
2156 |
|
|
} else { |
2157 |
|
|
splice @$children, $index, 0, map { |
2158 |
|
|
|
2159 |
|
|
$_->{'id'} |
2160 |
|
|
|
2161 |
|
|
} @new_child; |
2162 |
|
|
} |
2163 |
|
|
$r = $newChild; |
2164 |
|
|
|
2165 |
|
|
|
2166 |
|
|
|
2167 |
wakaba |
1.3 |
} |
2168 |
wakaba |
1.1 |
|
2169 |
|
|
; |
2170 |
|
|
|
2171 |
|
|
|
2172 |
|
|
|
2173 |
|
|
; |
2174 |
|
|
|
2175 |
|
|
|
2176 |
|
|
|
2177 |
wakaba |
1.3 |
} |
2178 |
wakaba |
1.1 |
|
2179 |
|
|
|
2180 |
|
|
;} |
2181 |
|
|
|
2182 |
|
|
; |
2183 |
|
|
|
2184 |
|
|
|
2185 |
wakaba |
1.3 |
} |
2186 |
wakaba |
1.1 |
|
2187 |
|
|
; |
2188 |
|
|
|
2189 |
|
|
|
2190 |
wakaba |
1.3 |
} |
2191 |
wakaba |
1.1 |
$r} |
2192 |
|
|
sub replace_child ($$$) { |
2193 |
|
|
my ($self, $newChild, $oldChild) = @_; |
2194 |
|
|
my $r; |
2195 |
|
|
|
2196 |
|
|
{ |
2197 |
|
|
|
2198 |
|
|
my |
2199 |
|
|
$self_od = $self-> |
2200 |
|
|
owner_document |
2201 |
|
|
; |
2202 |
|
|
if ($self_od-> |
2203 |
|
|
strict_error_checking |
2204 |
|
|
) { |
2205 |
|
|
my $anode = $self; |
2206 |
|
|
while (defined $anode) { |
2207 |
|
|
if ($anode eq $newChild) { |
2208 |
|
|
|
2209 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_ANCESTOR_OR_SELF', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
2210 |
|
|
|
2211 |
|
|
; |
2212 |
|
|
} |
2213 |
|
|
$anode = $anode-> |
2214 |
|
|
parent_node |
2215 |
|
|
; |
2216 |
|
|
} |
2217 |
|
|
} |
2218 |
|
|
my $child_od = $newChild-> |
2219 |
|
|
owner_document |
2220 |
|
|
; |
2221 |
|
|
my $child_nt = $newChild-> |
2222 |
|
|
node_type |
2223 |
|
|
; |
2224 |
|
|
|
2225 |
|
|
|
2226 |
|
|
{ |
2227 |
|
|
|
2228 |
|
|
|
2229 |
|
|
{ |
2230 |
|
|
|
2231 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2232 |
|
|
|
2233 |
|
|
{ |
2234 |
|
|
|
2235 |
|
|
|
2236 |
|
|
my |
2237 |
|
|
$strict = $self_od-> |
2238 |
|
|
strict_error_checking |
2239 |
|
|
; |
2240 |
|
|
|
2241 |
|
|
## -- Node Type check |
2242 |
|
|
my @new_child; |
2243 |
|
|
if ({ |
2244 |
wakaba |
1.6 |
3 => 1, |
2245 |
|
|
5 => 1, |
2246 |
|
|
1 => 1, |
2247 |
|
|
4 => 1, |
2248 |
|
|
7 => 1, |
2249 |
|
|
8 => 1, |
2250 |
wakaba |
1.1 |
}->{$child_nt}) { |
2251 |
|
|
push @new_child, $newChild; |
2252 |
|
|
} elsif ($child_nt == |
2253 |
wakaba |
1.6 |
11 |
2254 |
wakaba |
1.1 |
) { |
2255 |
|
|
for my $cn (@{$newChild-> |
2256 |
|
|
child_nodes |
2257 |
|
|
}) { |
2258 |
|
|
unless ({ |
2259 |
wakaba |
1.6 |
3 => 1, |
2260 |
|
|
5 => 1, |
2261 |
|
|
1 => 1, |
2262 |
|
|
4 => 1, |
2263 |
|
|
7 => 1, |
2264 |
|
|
8 => 1, |
2265 |
wakaba |
1.1 |
}->{$cn-> |
2266 |
|
|
node_type |
2267 |
|
|
}) { |
2268 |
|
|
|
2269 |
|
|
|
2270 |
|
|
{ |
2271 |
|
|
|
2272 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2273 |
|
|
|
2274 |
|
|
{ |
2275 |
|
|
|
2276 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
2277 |
|
|
|
2278 |
|
|
|
2279 |
wakaba |
1.3 |
} |
2280 |
wakaba |
1.1 |
|
2281 |
|
|
|
2282 |
|
|
;} |
2283 |
|
|
|
2284 |
|
|
; |
2285 |
|
|
} |
2286 |
|
|
push @new_child, $cn; |
2287 |
|
|
} |
2288 |
|
|
} else { |
2289 |
|
|
|
2290 |
|
|
|
2291 |
|
|
{ |
2292 |
|
|
|
2293 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2294 |
|
|
|
2295 |
|
|
{ |
2296 |
|
|
|
2297 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
2298 |
|
|
|
2299 |
|
|
|
2300 |
wakaba |
1.3 |
} |
2301 |
wakaba |
1.1 |
|
2302 |
|
|
|
2303 |
|
|
;} |
2304 |
|
|
|
2305 |
|
|
; |
2306 |
|
|
} |
2307 |
|
|
|
2308 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
2309 |
|
|
parent_node |
2310 |
|
|
: |
2311 |
|
|
|
2312 |
|
|
undef |
2313 |
|
|
; |
2314 |
|
|
if ($strict) { |
2315 |
|
|
## -- Wrong-document check |
2316 |
|
|
unless ($self_od eq $child_od) { |
2317 |
|
|
|
2318 |
|
|
|
2319 |
|
|
{ |
2320 |
|
|
|
2321 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2322 |
|
|
|
2323 |
|
|
{ |
2324 |
|
|
|
2325 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
2326 |
|
|
|
2327 |
|
|
|
2328 |
wakaba |
1.3 |
} |
2329 |
wakaba |
1.1 |
|
2330 |
|
|
|
2331 |
|
|
;} |
2332 |
|
|
|
2333 |
|
|
; |
2334 |
|
|
} |
2335 |
|
|
|
2336 |
|
|
## -- Read-onlyness check |
2337 |
|
|
if ($self-> |
2338 |
|
|
manakai_read_only |
2339 |
|
|
) { |
2340 |
|
|
|
2341 |
|
|
|
2342 |
|
|
{ |
2343 |
|
|
|
2344 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2345 |
|
|
|
2346 |
|
|
{ |
2347 |
|
|
|
2348 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
2349 |
|
|
|
2350 |
|
|
|
2351 |
wakaba |
1.3 |
} |
2352 |
wakaba |
1.1 |
|
2353 |
|
|
|
2354 |
|
|
;} |
2355 |
|
|
|
2356 |
|
|
; |
2357 |
|
|
} |
2358 |
|
|
if (@new_child) { |
2359 |
|
|
if ($nc_parent and |
2360 |
|
|
$nc_parent-> |
2361 |
|
|
manakai_read_only |
2362 |
|
|
) { |
2363 |
|
|
|
2364 |
|
|
|
2365 |
|
|
{ |
2366 |
|
|
|
2367 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2368 |
|
|
|
2369 |
|
|
{ |
2370 |
|
|
|
2371 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
2372 |
|
|
|
2373 |
|
|
|
2374 |
wakaba |
1.3 |
} |
2375 |
wakaba |
1.1 |
|
2376 |
|
|
|
2377 |
|
|
;} |
2378 |
|
|
|
2379 |
|
|
; |
2380 |
|
|
} |
2381 |
|
|
} |
2382 |
|
|
} |
2383 |
|
|
|
2384 |
|
|
## -- Insert at... |
2385 |
|
|
my $index = -1; # last |
2386 |
|
|
|
2387 |
|
|
|
2388 |
|
|
{ |
2389 |
|
|
|
2390 |
|
|
|
2391 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
2392 |
|
|
if (defined $oldChild) { |
2393 |
|
|
if ($oldChild eq $newChild) { |
2394 |
|
|
|
2395 |
|
|
|
2396 |
|
|
; |
2397 |
|
|
|
2398 |
|
|
|
2399 |
|
|
{ |
2400 |
|
|
|
2401 |
|
|
|
2402 |
|
|
{ |
2403 |
|
|
|
2404 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2405 |
|
|
|
2406 |
|
|
{ |
2407 |
|
|
|
2408 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#replace-by-itself', 'rdata' => $oldChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
2409 |
|
|
|
2410 |
|
|
|
2411 |
wakaba |
1.3 |
} |
2412 |
wakaba |
1.1 |
|
2413 |
|
|
|
2414 |
|
|
;} |
2415 |
|
|
|
2416 |
|
|
; |
2417 |
|
|
|
2418 |
|
|
|
2419 |
|
|
|
2420 |
wakaba |
1.3 |
} |
2421 |
wakaba |
1.1 |
|
2422 |
|
|
; |
2423 |
|
|
} |
2424 |
|
|
|
2425 |
|
|
my $cns = $self-> |
2426 |
|
|
child_nodes |
2427 |
|
|
; |
2428 |
|
|
my $cnsl = @$cns; |
2429 |
|
|
C: { |
2430 |
|
|
$index = 0; |
2431 |
|
|
for my $i (0..($cnsl-1)) { |
2432 |
|
|
my $cn = $cns->[$i]; |
2433 |
|
|
if ($cn eq $oldChild) { |
2434 |
|
|
$index += $i; |
2435 |
|
|
last C; |
2436 |
|
|
} elsif ($cn eq $newChild) { |
2437 |
|
|
$index = -1; # offset |
2438 |
|
|
} |
2439 |
|
|
} |
2440 |
|
|
|
2441 |
|
|
|
2442 |
|
|
; |
2443 |
|
|
|
2444 |
|
|
|
2445 |
|
|
{ |
2446 |
|
|
|
2447 |
|
|
|
2448 |
|
|
{ |
2449 |
|
|
|
2450 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2451 |
|
|
|
2452 |
|
|
{ |
2453 |
|
|
|
2454 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
2455 |
|
|
|
2456 |
|
|
|
2457 |
wakaba |
1.3 |
} |
2458 |
wakaba |
1.1 |
|
2459 |
|
|
|
2460 |
|
|
;} |
2461 |
|
|
|
2462 |
|
|
; |
2463 |
|
|
|
2464 |
|
|
|
2465 |
|
|
|
2466 |
wakaba |
1.3 |
} |
2467 |
wakaba |
1.1 |
|
2468 |
|
|
; |
2469 |
|
|
} # C |
2470 |
|
|
} else { # |oldChild| is not defined |
2471 |
|
|
|
2472 |
|
|
|
2473 |
|
|
{ |
2474 |
|
|
|
2475 |
|
|
|
2476 |
|
|
{ |
2477 |
|
|
|
2478 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2479 |
|
|
|
2480 |
|
|
{ |
2481 |
|
|
|
2482 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
2483 |
|
|
|
2484 |
|
|
|
2485 |
wakaba |
1.3 |
} |
2486 |
wakaba |
1.1 |
|
2487 |
|
|
|
2488 |
|
|
;} |
2489 |
|
|
|
2490 |
|
|
; |
2491 |
|
|
|
2492 |
|
|
|
2493 |
|
|
|
2494 |
wakaba |
1.3 |
} |
2495 |
wakaba |
1.1 |
|
2496 |
|
|
; |
2497 |
|
|
} |
2498 |
|
|
|
2499 |
|
|
|
2500 |
|
|
|
2501 |
wakaba |
1.3 |
} |
2502 |
wakaba |
1.1 |
|
2503 |
|
|
; # FOR !tc:ForAppendChild |
2504 |
|
|
|
2505 |
|
|
## -- Removes from parent |
2506 |
|
|
if ($nc_parent) { |
2507 |
|
|
if ($child_nt == |
2508 |
wakaba |
1.6 |
11 |
2509 |
wakaba |
1.1 |
) { |
2510 |
|
|
|
2511 |
|
|
|
2512 |
|
|
{ |
2513 |
|
|
|
2514 |
|
|
|
2515 |
|
|
$newChild->{ |
2516 |
|
|
'b' |
2517 |
|
|
}->{${$newChild->{ |
2518 |
|
|
'id' |
2519 |
|
|
}}} |
2520 |
|
|
->{'child'} = []; |
2521 |
|
|
|
2522 |
|
|
|
2523 |
wakaba |
1.3 |
} |
2524 |
wakaba |
1.1 |
|
2525 |
|
|
; |
2526 |
|
|
} else { |
2527 |
|
|
my $v; |
2528 |
|
|
|
2529 |
|
|
|
2530 |
|
|
{ |
2531 |
|
|
|
2532 |
|
|
|
2533 |
|
|
$v = $nc_parent->{ |
2534 |
|
|
'b' |
2535 |
|
|
}->{${$nc_parent->{ |
2536 |
|
|
'id' |
2537 |
|
|
}}} |
2538 |
|
|
->{'child'}; |
2539 |
|
|
|
2540 |
|
|
|
2541 |
wakaba |
1.3 |
} |
2542 |
wakaba |
1.1 |
|
2543 |
|
|
; |
2544 |
|
|
RP: for my $i (0..$#$v) { |
2545 |
|
|
my $nodeid = $v->[$i]; |
2546 |
|
|
if ( |
2547 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
2548 |
|
|
) { |
2549 |
|
|
splice @$v, $i, 1, (); |
2550 |
|
|
last RP; |
2551 |
|
|
} |
2552 |
|
|
} # RP |
2553 |
|
|
} |
2554 |
|
|
} |
2555 |
|
|
|
2556 |
|
|
## -- Rewrite the |parentNode| properties |
2557 |
|
|
for my $nc (@new_child) { |
2558 |
|
|
|
2559 |
|
|
|
2560 |
|
|
{ |
2561 |
|
|
|
2562 |
|
|
|
2563 |
|
|
$nc->{ |
2564 |
|
|
'b' |
2565 |
|
|
}->{${$nc->{ |
2566 |
|
|
'id' |
2567 |
|
|
}}} |
2568 |
|
|
->{'parent'} = $self->{ |
2569 |
|
|
'id' |
2570 |
|
|
}; |
2571 |
|
|
|
2572 |
|
|
|
2573 |
wakaba |
1.3 |
} |
2574 |
wakaba |
1.1 |
|
2575 |
|
|
; |
2576 |
|
|
} |
2577 |
|
|
|
2578 |
|
|
my $children; |
2579 |
|
|
|
2580 |
|
|
|
2581 |
|
|
{ |
2582 |
|
|
|
2583 |
|
|
|
2584 |
|
|
$children = $self->{ |
2585 |
|
|
'b' |
2586 |
|
|
}->{${$self->{ |
2587 |
|
|
'id' |
2588 |
|
|
}}} |
2589 |
|
|
->{'child'}; |
2590 |
|
|
|
2591 |
|
|
|
2592 |
wakaba |
1.3 |
} |
2593 |
wakaba |
1.1 |
|
2594 |
|
|
; |
2595 |
|
|
|
2596 |
|
|
|
2597 |
|
|
|
2598 |
|
|
; |
2599 |
|
|
|
2600 |
|
|
|
2601 |
|
|
|
2602 |
|
|
; |
2603 |
|
|
|
2604 |
|
|
|
2605 |
|
|
|
2606 |
|
|
{ |
2607 |
|
|
|
2608 |
|
|
|
2609 |
|
|
## -- Replaces the node |
2610 |
|
|
splice @$children, $index, 1, map { |
2611 |
|
|
|
2612 |
|
|
$_->{'id'} |
2613 |
|
|
|
2614 |
|
|
} @new_child; |
2615 |
|
|
|
2616 |
|
|
|
2617 |
|
|
{ |
2618 |
|
|
|
2619 |
|
|
CORE::delete |
2620 |
|
|
$oldChild->{ |
2621 |
|
|
'b' |
2622 |
|
|
}->{${$oldChild->{ |
2623 |
|
|
'id' |
2624 |
|
|
}}} |
2625 |
|
|
->{'parent'}; |
2626 |
|
|
|
2627 |
|
|
|
2628 |
wakaba |
1.3 |
} |
2629 |
wakaba |
1.1 |
|
2630 |
|
|
; |
2631 |
|
|
$r = $oldChild; |
2632 |
|
|
|
2633 |
|
|
|
2634 |
|
|
|
2635 |
wakaba |
1.3 |
} |
2636 |
wakaba |
1.1 |
|
2637 |
|
|
; |
2638 |
|
|
|
2639 |
|
|
|
2640 |
|
|
|
2641 |
wakaba |
1.3 |
} |
2642 |
wakaba |
1.1 |
|
2643 |
|
|
|
2644 |
|
|
;} |
2645 |
|
|
|
2646 |
|
|
; |
2647 |
|
|
|
2648 |
|
|
|
2649 |
wakaba |
1.3 |
} |
2650 |
wakaba |
1.1 |
|
2651 |
|
|
; |
2652 |
|
|
|
2653 |
|
|
|
2654 |
wakaba |
1.3 |
} |
2655 |
wakaba |
1.1 |
$r} |
2656 |
|
|
sub attributes ($;$) { |
2657 |
|
|
if (@_ == 1) {my ($self) = @_; |
2658 |
|
|
my $r; |
2659 |
|
|
|
2660 |
|
|
{ |
2661 |
|
|
|
2662 |
|
|
|
2663 |
|
|
{ |
2664 |
|
|
|
2665 |
|
|
|
2666 |
|
|
$r = bless \\($self), |
2667 |
|
|
'Message::DOM::TreeCore::ManakaiDOMAttrMap' |
2668 |
|
|
; |
2669 |
|
|
|
2670 |
|
|
|
2671 |
|
|
{ |
2672 |
|
|
|
2673 |
|
|
|
2674 |
|
|
$self->{ |
2675 |
|
|
'b' |
2676 |
|
|
}->{${$self->{ |
2677 |
|
|
'id' |
2678 |
|
|
}}} |
2679 |
|
|
->{'hpos'} ||= -1; |
2680 |
|
|
|
2681 |
|
|
|
2682 |
wakaba |
1.3 |
} |
2683 |
wakaba |
1.1 |
|
2684 |
|
|
; |
2685 |
|
|
|
2686 |
|
|
|
2687 |
wakaba |
1.3 |
} |
2688 |
wakaba |
1.1 |
|
2689 |
|
|
; |
2690 |
|
|
|
2691 |
|
|
|
2692 |
wakaba |
1.3 |
} |
2693 |
wakaba |
1.1 |
$r; |
2694 |
|
|
} else {my ($self) = @_; |
2695 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'attributes'; |
2696 |
|
|
} |
2697 |
|
|
} |
2698 |
|
|
sub node_name ($;$) { |
2699 |
|
|
if (@_ == 1) {my ($self) = @_; |
2700 |
|
|
my $r = ''; |
2701 |
|
|
|
2702 |
|
|
{ |
2703 |
|
|
|
2704 |
|
|
my |
2705 |
|
|
$prefix; |
2706 |
|
|
|
2707 |
|
|
|
2708 |
|
|
{ |
2709 |
|
|
|
2710 |
|
|
|
2711 |
|
|
$prefix = $self->{ |
2712 |
|
|
'b' |
2713 |
|
|
}->{${$self->{ |
2714 |
|
|
'id' |
2715 |
|
|
}}} |
2716 |
|
|
->{'pfx'}; |
2717 |
|
|
|
2718 |
|
|
|
2719 |
wakaba |
1.3 |
} |
2720 |
wakaba |
1.1 |
|
2721 |
|
|
; |
2722 |
|
|
my $lname; |
2723 |
|
|
|
2724 |
|
|
|
2725 |
|
|
{ |
2726 |
|
|
|
2727 |
|
|
|
2728 |
|
|
$lname = $self->{ |
2729 |
|
|
'b' |
2730 |
|
|
}->{${$self->{ |
2731 |
|
|
'id' |
2732 |
|
|
}}} |
2733 |
|
|
->{'ln'}; |
2734 |
|
|
|
2735 |
|
|
|
2736 |
wakaba |
1.3 |
} |
2737 |
wakaba |
1.1 |
|
2738 |
|
|
; |
2739 |
|
|
$r = defined $prefix ? $$prefix.':'.$$lname : $$lname; |
2740 |
|
|
|
2741 |
|
|
|
2742 |
wakaba |
1.3 |
} |
2743 |
wakaba |
1.1 |
$r; |
2744 |
|
|
} else {my ($self) = @_; |
2745 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
2746 |
|
|
} |
2747 |
|
|
} |
2748 |
|
|
sub tag_name ($;$) { |
2749 |
|
|
if (@_ == 1) {my ($self) = @_; |
2750 |
|
|
my $r = ''; |
2751 |
|
|
|
2752 |
|
|
{ |
2753 |
|
|
|
2754 |
|
|
my |
2755 |
|
|
$prefix; |
2756 |
|
|
|
2757 |
|
|
|
2758 |
|
|
{ |
2759 |
|
|
|
2760 |
|
|
|
2761 |
|
|
$prefix = $self->{ |
2762 |
|
|
'b' |
2763 |
|
|
}->{${$self->{ |
2764 |
|
|
'id' |
2765 |
|
|
}}} |
2766 |
|
|
->{'pfx'}; |
2767 |
|
|
|
2768 |
|
|
|
2769 |
wakaba |
1.3 |
} |
2770 |
wakaba |
1.1 |
|
2771 |
|
|
; |
2772 |
|
|
my $lname; |
2773 |
|
|
|
2774 |
|
|
|
2775 |
|
|
{ |
2776 |
|
|
|
2777 |
|
|
|
2778 |
|
|
$lname = $self->{ |
2779 |
|
|
'b' |
2780 |
|
|
}->{${$self->{ |
2781 |
|
|
'id' |
2782 |
|
|
}}} |
2783 |
|
|
->{'ln'}; |
2784 |
|
|
|
2785 |
|
|
|
2786 |
wakaba |
1.3 |
} |
2787 |
wakaba |
1.1 |
|
2788 |
|
|
; |
2789 |
|
|
$r = defined $prefix ? $$prefix.':'.$$lname : $$lname; |
2790 |
|
|
|
2791 |
|
|
|
2792 |
wakaba |
1.3 |
} |
2793 |
wakaba |
1.1 |
$r; |
2794 |
|
|
} else {my ($self) = @_; |
2795 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'tag_name'; |
2796 |
|
|
} |
2797 |
|
|
} |
2798 |
|
|
sub manakai_append_text ($$) { |
2799 |
|
|
my ($self, $string) = @_; |
2800 |
|
|
my $r; |
2801 |
|
|
|
2802 |
|
|
{ |
2803 |
|
|
|
2804 |
|
|
|
2805 |
|
|
{ |
2806 |
|
|
|
2807 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2808 |
|
|
|
2809 |
|
|
{ |
2810 |
|
|
|
2811 |
|
|
|
2812 |
|
|
my |
2813 |
|
|
$lc = $self-> |
2814 |
|
|
last_child |
2815 |
|
|
; |
2816 |
|
|
if (defined $lc and |
2817 |
|
|
$lc-> |
2818 |
|
|
node_type |
2819 |
|
|
== |
2820 |
wakaba |
1.6 |
3 |
2821 |
wakaba |
1.1 |
) { |
2822 |
|
|
$lc-> |
2823 |
|
|
manakai_append_text |
2824 |
|
|
|
2825 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
2826 |
|
|
} else { |
2827 |
|
|
my $text = $self-> |
2828 |
|
|
owner_document |
2829 |
|
|
|
2830 |
|
|
-> |
2831 |
|
|
create_text_node |
2832 |
|
|
|
2833 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
2834 |
|
|
$self-> |
2835 |
|
|
append_child |
2836 |
|
|
($text); |
2837 |
|
|
} |
2838 |
|
|
$r = $self; |
2839 |
|
|
|
2840 |
|
|
|
2841 |
|
|
|
2842 |
wakaba |
1.3 |
} |
2843 |
wakaba |
1.1 |
|
2844 |
|
|
|
2845 |
|
|
;} |
2846 |
|
|
|
2847 |
|
|
; |
2848 |
|
|
|
2849 |
|
|
|
2850 |
wakaba |
1.3 |
} |
2851 |
wakaba |
1.1 |
$r} |
2852 |
|
|
sub get_feature ($$$) { |
2853 |
|
|
my ($self, $feature, $version) = @_; |
2854 |
|
|
|
2855 |
|
|
{ |
2856 |
|
|
|
2857 |
|
|
|
2858 |
|
|
$feature = lc $feature; |
2859 |
|
|
|
2860 |
|
|
|
2861 |
wakaba |
1.3 |
} |
2862 |
wakaba |
1.1 |
|
2863 |
|
|
{ |
2864 |
|
|
|
2865 |
|
|
|
2866 |
|
|
$version = '' unless defined $version; |
2867 |
|
|
|
2868 |
|
|
|
2869 |
wakaba |
1.3 |
} |
2870 |
wakaba |
1.1 |
my $r; |
2871 |
|
|
|
2872 |
|
|
{ |
2873 |
|
|
|
2874 |
|
|
|
2875 |
|
|
$feature =~ s/^\+//; |
2876 |
|
|
|
2877 |
|
|
|
2878 |
|
|
{ |
2879 |
|
|
|
2880 |
|
|
if |
2881 |
wakaba |
1.9 |
($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { |
2882 |
wakaba |
1.1 |
$r = $self; |
2883 |
|
|
} |
2884 |
|
|
|
2885 |
|
|
|
2886 |
wakaba |
1.3 |
} |
2887 |
wakaba |
1.1 |
|
2888 |
|
|
; |
2889 |
|
|
unless (defined $r) { |
2890 |
|
|
|
2891 |
|
|
|
2892 |
|
|
{ |
2893 |
|
|
|
2894 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2895 |
|
|
|
2896 |
|
|
{ |
2897 |
|
|
|
2898 |
|
|
|
2899 |
|
|
|
2900 |
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
2901 |
|
|
|
2902 |
|
|
|
2903 |
|
|
|
2904 |
wakaba |
1.3 |
} |
2905 |
wakaba |
1.1 |
|
2906 |
|
|
|
2907 |
|
|
;} |
2908 |
|
|
|
2909 |
|
|
; |
2910 |
|
|
} |
2911 |
|
|
|
2912 |
|
|
|
2913 |
wakaba |
1.3 |
} |
2914 |
wakaba |
1.1 |
$r} |
2915 |
|
|
sub base_uri ($;$) { |
2916 |
|
|
if (@_ == 1) {my ($self) = @_; |
2917 |
|
|
my $r = ''; |
2918 |
|
|
|
2919 |
|
|
{ |
2920 |
|
|
|
2921 |
|
|
|
2922 |
|
|
{ |
2923 |
|
|
|
2924 |
|
|
|
2925 |
|
|
$r = $self->{ |
2926 |
|
|
'b' |
2927 |
|
|
}->{${$self->{ |
2928 |
|
|
'id' |
2929 |
|
|
}}} |
2930 |
|
|
->{'buri'}; |
2931 |
|
|
|
2932 |
|
|
|
2933 |
wakaba |
1.3 |
} |
2934 |
wakaba |
1.1 |
|
2935 |
|
|
; |
2936 |
|
|
unless (defined $r) { |
2937 |
|
|
|
2938 |
|
|
|
2939 |
|
|
{ |
2940 |
|
|
|
2941 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2942 |
|
|
|
2943 |
|
|
{ |
2944 |
|
|
|
2945 |
|
|
|
2946 |
|
|
my |
2947 |
|
|
$xb = $self-> |
2948 |
|
|
get_attribute_node_ns |
2949 |
|
|
|
2950 |
|
|
( |
2951 |
|
|
'http://www.w3.org/XML/1998/namespace' |
2952 |
|
|
, 'base'); |
2953 |
|
|
unless (defined $xb) { |
2954 |
|
|
$xb = $self-> |
2955 |
|
|
get_attribute_node_ns |
2956 |
|
|
|
2957 |
|
|
( |
2958 |
|
|
undef |
2959 |
|
|
, 'xml:base'); |
2960 |
|
|
} |
2961 |
|
|
if ($xb) { |
2962 |
|
|
$r = $xb-> |
2963 |
|
|
value |
2964 |
|
|
; |
2965 |
|
|
if ( |
2966 |
|
|
($r !~ m!\A[^:/?#]+:!) |
2967 |
|
|
) { |
2968 |
|
|
my $xbbase = $xb-> |
2969 |
|
|
base_uri |
2970 |
|
|
; |
2971 |
|
|
$r = $self-> |
2972 |
|
|
owner_document |
2973 |
|
|
|
2974 |
|
|
-> |
2975 |
|
|
implementation |
2976 |
|
|
|
2977 |
|
|
-> |
2978 |
|
|
create_uri_reference |
2979 |
|
|
|
2980 |
|
|
($r) |
2981 |
|
|
-> |
2982 |
|
|
get_absolute_reference |
2983 |
|
|
|
2984 |
|
|
($xbbase) |
2985 |
|
|
-> |
2986 |
|
|
uri_reference |
2987 |
|
|
if |
2988 |
|
|
defined $xbbase; |
2989 |
|
|
} |
2990 |
|
|
} else { |
2991 |
|
|
my $pe = $self-> |
2992 |
|
|
parent_node |
2993 |
|
|
; |
2994 |
|
|
W: { |
2995 |
|
|
while (defined $pe) { |
2996 |
|
|
my $nt = $pe-> |
2997 |
|
|
node_type |
2998 |
|
|
; |
2999 |
|
|
if ($nt == |
3000 |
wakaba |
1.6 |
1 or |
3001 |
wakaba |
1.1 |
|
3002 |
|
|
$nt == |
3003 |
wakaba |
1.6 |
9 or |
3004 |
wakaba |
1.1 |
|
3005 |
|
|
$nt == |
3006 |
wakaba |
1.6 |
11 or |
3007 |
wakaba |
1.1 |
|
3008 |
|
|
$nt == |
3009 |
wakaba |
1.6 |
6 |
3010 |
wakaba |
1.1 |
) { |
3011 |
|
|
$r = $pe-> |
3012 |
|
|
base_uri |
3013 |
|
|
; |
3014 |
|
|
last W; |
3015 |
|
|
} elsif ($nt == |
3016 |
wakaba |
1.6 |
5 |
3017 |
wakaba |
1.1 |
) { |
3018 |
|
|
if ($pe-> |
3019 |
|
|
manakai_external |
3020 |
|
|
) { |
3021 |
|
|
$r = $pe-> |
3022 |
|
|
manakai_entity_base_uri |
3023 |
|
|
; |
3024 |
|
|
last W; |
3025 |
|
|
} |
3026 |
|
|
} |
3027 |
|
|
$pe = $pe-> |
3028 |
|
|
parent_node |
3029 |
|
|
; |
3030 |
|
|
} |
3031 |
|
|
if ($pe) { |
3032 |
|
|
$r = $pe-> |
3033 |
|
|
base_uri |
3034 |
|
|
; |
3035 |
|
|
} else { |
3036 |
|
|
$r = $self-> |
3037 |
|
|
owner_document |
3038 |
|
|
-> |
3039 |
|
|
base_uri |
3040 |
|
|
; |
3041 |
|
|
} |
3042 |
|
|
} # W |
3043 |
|
|
} |
3044 |
|
|
|
3045 |
|
|
|
3046 |
|
|
|
3047 |
wakaba |
1.3 |
} |
3048 |
wakaba |
1.1 |
|
3049 |
|
|
|
3050 |
|
|
;} |
3051 |
|
|
|
3052 |
|
|
; |
3053 |
|
|
} |
3054 |
|
|
|
3055 |
|
|
|
3056 |
wakaba |
1.3 |
} |
3057 |
wakaba |
1.1 |
$r; |
3058 |
|
|
} else {my ($self) = @_; |
3059 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
3060 |
|
|
} |
3061 |
|
|
} |
3062 |
|
|
sub get_attribute ($$) { |
3063 |
|
|
my ($self, $name) = @_; |
3064 |
|
|
my $r = ''; |
3065 |
|
|
|
3066 |
|
|
{ |
3067 |
|
|
|
3068 |
|
|
my |
3069 |
|
|
$node; |
3070 |
|
|
|
3071 |
|
|
|
3072 |
|
|
{ |
3073 |
|
|
|
3074 |
|
|
my |
3075 |
|
|
$__attr; |
3076 |
|
|
|
3077 |
|
|
|
3078 |
|
|
{ |
3079 |
|
|
|
3080 |
|
|
|
3081 |
|
|
$__attr = $self->{ |
3082 |
|
|
'b' |
3083 |
|
|
}->{${$self->{ |
3084 |
|
|
'id' |
3085 |
|
|
}}} |
3086 |
|
|
->{'attr'}; |
3087 |
|
|
|
3088 |
|
|
|
3089 |
wakaba |
1.3 |
} |
3090 |
wakaba |
1.1 |
|
3091 |
|
|
; |
3092 |
|
|
|
3093 |
|
|
## Note that we no longer support DOM Level 1 nodes. |
3094 |
|
|
|
3095 |
|
|
## If an attribute's qualified name is equal to |
3096 |
|
|
## the requested name, then the node is the answer. |
3097 |
|
|
|
3098 |
|
|
## Note that if there is a namespace ill-formed attribute, |
3099 |
|
|
## the result is not the expected one. For example, |
3100 |
|
|
## if an |xmlns| attribute in the |http://www.w3.org/2000/xmlns/| |
3101 |
|
|
## namespace has non-NULL |prefix|, a request to get |xmlns| |
3102 |
|
|
## attribute will not return that node. |
3103 |
|
|
|
3104 |
|
|
## |sort|ing is required so that every |getAttribute|, |setAttribute|, |
3105 |
|
|
## |hasAttribute|, |removeAttribute|, or any other namespace unaware |
3106 |
|
|
## methods operates on the same node even if there is |
3107 |
|
|
## multiple nodes with the same qualified name. |
3108 |
|
|
|
3109 |
|
|
NS: for my $__ns (sort {$a cmp $b} keys %$__attr) { |
3110 |
|
|
for my $__ln (sort {$a cmp $b} keys %{$__attr->{$__ns}}) { |
3111 |
|
|
my $__node; |
3112 |
|
|
|
3113 |
|
|
|
3114 |
|
|
{ |
3115 |
|
|
|
3116 |
|
|
|
3117 |
|
|
$__node = ${($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
3118 |
|
|
'cls' |
3119 |
|
|
}}->___create_node_ref ({ |
3120 |
|
|
|
3121 |
|
|
'id' |
3122 |
|
|
=> $__attr->{$__ns}->{$__ln}, |
3123 |
|
|
|
3124 |
|
|
'b' |
3125 |
|
|
=> ($self->{'b'}), |
3126 |
|
|
}, { |
3127 |
|
|
}); |
3128 |
|
|
($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
3129 |
|
|
'rc' |
3130 |
|
|
}++; |
3131 |
|
|
|
3132 |
|
|
|
3133 |
wakaba |
1.3 |
} |
3134 |
wakaba |
1.1 |
|
3135 |
|
|
; |
3136 |
|
|
if ($__node-> |
3137 |
|
|
node_name eq |
3138 |
|
|
$name) { |
3139 |
|
|
|
3140 |
|
|
|
3141 |
|
|
{ |
3142 |
|
|
|
3143 |
|
|
|
3144 |
|
|
$node = $__node; |
3145 |
|
|
|
3146 |
|
|
|
3147 |
|
|
|
3148 |
wakaba |
1.3 |
} |
3149 |
wakaba |
1.1 |
|
3150 |
|
|
; |
3151 |
|
|
|
3152 |
|
|
|
3153 |
|
|
; |
3154 |
|
|
last NS; |
3155 |
|
|
} |
3156 |
|
|
} # ln |
3157 |
|
|
} # NS |
3158 |
|
|
|
3159 |
|
|
|
3160 |
wakaba |
1.3 |
} |
3161 |
wakaba |
1.1 |
|
3162 |
|
|
; |
3163 |
|
|
if (defined $node) { |
3164 |
|
|
$r = $node-> |
3165 |
|
|
value |
3166 |
|
|
; |
3167 |
|
|
} else { |
3168 |
|
|
$r = |
3169 |
|
|
undef |
3170 |
|
|
; |
3171 |
|
|
} |
3172 |
|
|
|
3173 |
|
|
|
3174 |
wakaba |
1.3 |
} |
3175 |
wakaba |
1.1 |
$r} |
3176 |
|
|
sub get_attribute_ns ($$$) { |
3177 |
|
|
my ($self, $namespaceURI, $localName) = @_; |
3178 |
|
|
|
3179 |
|
|
{ |
3180 |
|
|
|
3181 |
|
|
if |
3182 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
3183 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
3184 |
wakaba |
1.1 |
|
3185 |
wakaba |
1.9 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3186 |
wakaba |
1.1 |
|
3187 |
|
|
; |
3188 |
|
|
|
3189 |
|
|
|
3190 |
|
|
|
3191 |
|
|
{ |
3192 |
|
|
|
3193 |
|
|
|
3194 |
|
|
$namespaceURI = undef; |
3195 |
|
|
|
3196 |
|
|
|
3197 |
|
|
|
3198 |
wakaba |
1.3 |
} |
3199 |
wakaba |
1.1 |
|
3200 |
|
|
; |
3201 |
|
|
} |
3202 |
|
|
|
3203 |
|
|
|
3204 |
wakaba |
1.3 |
} |
3205 |
wakaba |
1.1 |
my $r = ''; |
3206 |
|
|
|
3207 |
|
|
{ |
3208 |
|
|
|
3209 |
|
|
my |
3210 |
|
|
$node; |
3211 |
|
|
|
3212 |
|
|
|
3213 |
|
|
{ |
3214 |
|
|
|
3215 |
|
|
my |
3216 |
|
|
$__attrs; |
3217 |
|
|
|
3218 |
|
|
|
3219 |
|
|
{ |
3220 |
|
|
|
3221 |
|
|
|
3222 |
|
|
$__attrs = $self->{ |
3223 |
|
|
'b' |
3224 |
|
|
}->{${$self->{ |
3225 |
|
|
'id' |
3226 |
|
|
}}} |
3227 |
|
|
->{'attr'}; |
3228 |
|
|
|
3229 |
|
|
|
3230 |
wakaba |
1.3 |
} |
3231 |
wakaba |
1.1 |
|
3232 |
|
|
; |
3233 |
|
|
if (defined $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3234 |
|
|
->{$localName}) { |
3235 |
|
|
|
3236 |
|
|
|
3237 |
|
|
{ |
3238 |
|
|
|
3239 |
|
|
|
3240 |
|
|
$node = ${($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3241 |
|
|
->{$localName}}}->{ |
3242 |
|
|
'cls' |
3243 |
|
|
}}->___create_node_ref ({ |
3244 |
|
|
|
3245 |
|
|
'id' |
3246 |
|
|
=> $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3247 |
|
|
->{$localName}, |
3248 |
|
|
|
3249 |
|
|
'b' |
3250 |
|
|
=> ($self->{'b'}), |
3251 |
|
|
}, { |
3252 |
|
|
}); |
3253 |
|
|
($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3254 |
|
|
->{$localName}}}->{ |
3255 |
|
|
'rc' |
3256 |
|
|
}++; |
3257 |
|
|
|
3258 |
|
|
|
3259 |
wakaba |
1.3 |
} |
3260 |
wakaba |
1.1 |
|
3261 |
|
|
; |
3262 |
|
|
} |
3263 |
|
|
|
3264 |
|
|
|
3265 |
wakaba |
1.3 |
} |
3266 |
wakaba |
1.1 |
|
3267 |
|
|
; |
3268 |
|
|
if (defined $node) { |
3269 |
|
|
$r = $node-> |
3270 |
|
|
value |
3271 |
|
|
; |
3272 |
|
|
} else { |
3273 |
|
|
$r = |
3274 |
|
|
undef |
3275 |
|
|
; |
3276 |
|
|
} |
3277 |
|
|
|
3278 |
|
|
|
3279 |
wakaba |
1.3 |
} |
3280 |
wakaba |
1.1 |
$r} |
3281 |
|
|
sub get_attribute_node ($$) { |
3282 |
|
|
my ($self, $name) = @_; |
3283 |
|
|
my $r; |
3284 |
|
|
|
3285 |
|
|
{ |
3286 |
|
|
|
3287 |
|
|
|
3288 |
|
|
{ |
3289 |
|
|
|
3290 |
|
|
my |
3291 |
|
|
$__attr; |
3292 |
|
|
|
3293 |
|
|
|
3294 |
|
|
{ |
3295 |
|
|
|
3296 |
|
|
|
3297 |
|
|
$__attr = $self->{ |
3298 |
|
|
'b' |
3299 |
|
|
}->{${$self->{ |
3300 |
|
|
'id' |
3301 |
|
|
}}} |
3302 |
|
|
->{'attr'}; |
3303 |
|
|
|
3304 |
|
|
|
3305 |
wakaba |
1.3 |
} |
3306 |
wakaba |
1.1 |
|
3307 |
|
|
; |
3308 |
|
|
|
3309 |
|
|
## Note that we no longer support DOM Level 1 nodes. |
3310 |
|
|
|
3311 |
|
|
## If an attribute's qualified name is equal to |
3312 |
|
|
## the requested name, then the node is the answer. |
3313 |
|
|
|
3314 |
|
|
## Note that if there is a namespace ill-formed attribute, |
3315 |
|
|
## the result is not the expected one. For example, |
3316 |
|
|
## if an |xmlns| attribute in the |http://www.w3.org/2000/xmlns/| |
3317 |
|
|
## namespace has non-NULL |prefix|, a request to get |xmlns| |
3318 |
|
|
## attribute will not return that node. |
3319 |
|
|
|
3320 |
|
|
## |sort|ing is required so that every |getAttribute|, |setAttribute|, |
3321 |
|
|
## |hasAttribute|, |removeAttribute|, or any other namespace unaware |
3322 |
|
|
## methods operates on the same node even if there is |
3323 |
|
|
## multiple nodes with the same qualified name. |
3324 |
|
|
|
3325 |
|
|
NS: for my $__ns (sort {$a cmp $b} keys %$__attr) { |
3326 |
|
|
for my $__ln (sort {$a cmp $b} keys %{$__attr->{$__ns}}) { |
3327 |
|
|
my $__node; |
3328 |
|
|
|
3329 |
|
|
|
3330 |
|
|
{ |
3331 |
|
|
|
3332 |
|
|
|
3333 |
|
|
$__node = ${($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
3334 |
|
|
'cls' |
3335 |
|
|
}}->___create_node_ref ({ |
3336 |
|
|
|
3337 |
|
|
'id' |
3338 |
|
|
=> $__attr->{$__ns}->{$__ln}, |
3339 |
|
|
|
3340 |
|
|
'b' |
3341 |
|
|
=> ($self->{'b'}), |
3342 |
|
|
}, { |
3343 |
|
|
}); |
3344 |
|
|
($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
3345 |
|
|
'rc' |
3346 |
|
|
}++; |
3347 |
|
|
|
3348 |
|
|
|
3349 |
wakaba |
1.3 |
} |
3350 |
wakaba |
1.1 |
|
3351 |
|
|
; |
3352 |
|
|
if ($__node-> |
3353 |
|
|
node_name eq |
3354 |
|
|
$name) { |
3355 |
|
|
|
3356 |
|
|
|
3357 |
|
|
{ |
3358 |
|
|
|
3359 |
|
|
|
3360 |
|
|
$r = $__node; |
3361 |
|
|
|
3362 |
|
|
|
3363 |
|
|
|
3364 |
wakaba |
1.3 |
} |
3365 |
wakaba |
1.1 |
|
3366 |
|
|
; |
3367 |
|
|
|
3368 |
|
|
|
3369 |
|
|
; |
3370 |
|
|
last NS; |
3371 |
|
|
} |
3372 |
|
|
} # ln |
3373 |
|
|
} # NS |
3374 |
|
|
|
3375 |
|
|
|
3376 |
wakaba |
1.3 |
} |
3377 |
wakaba |
1.1 |
|
3378 |
|
|
; |
3379 |
|
|
|
3380 |
|
|
|
3381 |
wakaba |
1.3 |
} |
3382 |
wakaba |
1.1 |
$r} |
3383 |
|
|
sub get_attribute_node_ns ($$$) { |
3384 |
|
|
my ($self, $namespaceURI, $localName) = @_; |
3385 |
|
|
|
3386 |
|
|
{ |
3387 |
|
|
|
3388 |
|
|
if |
3389 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
3390 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
3391 |
wakaba |
1.1 |
|
3392 |
wakaba |
1.9 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3393 |
wakaba |
1.1 |
|
3394 |
|
|
; |
3395 |
|
|
|
3396 |
|
|
|
3397 |
|
|
|
3398 |
|
|
{ |
3399 |
|
|
|
3400 |
|
|
|
3401 |
|
|
$namespaceURI = undef; |
3402 |
|
|
|
3403 |
|
|
|
3404 |
|
|
|
3405 |
wakaba |
1.3 |
} |
3406 |
wakaba |
1.1 |
|
3407 |
|
|
; |
3408 |
|
|
} |
3409 |
|
|
|
3410 |
|
|
|
3411 |
wakaba |
1.3 |
} |
3412 |
wakaba |
1.1 |
my $r; |
3413 |
|
|
|
3414 |
|
|
{ |
3415 |
|
|
|
3416 |
|
|
|
3417 |
|
|
{ |
3418 |
|
|
|
3419 |
|
|
my |
3420 |
|
|
$__attrs; |
3421 |
|
|
|
3422 |
|
|
|
3423 |
|
|
{ |
3424 |
|
|
|
3425 |
|
|
|
3426 |
|
|
$__attrs = $self->{ |
3427 |
|
|
'b' |
3428 |
|
|
}->{${$self->{ |
3429 |
|
|
'id' |
3430 |
|
|
}}} |
3431 |
|
|
->{'attr'}; |
3432 |
|
|
|
3433 |
|
|
|
3434 |
wakaba |
1.3 |
} |
3435 |
wakaba |
1.1 |
|
3436 |
|
|
; |
3437 |
|
|
if (defined $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3438 |
|
|
->{$localName}) { |
3439 |
|
|
|
3440 |
|
|
|
3441 |
|
|
{ |
3442 |
|
|
|
3443 |
|
|
|
3444 |
|
|
$r = ${($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3445 |
|
|
->{$localName}}}->{ |
3446 |
|
|
'cls' |
3447 |
|
|
}}->___create_node_ref ({ |
3448 |
|
|
|
3449 |
|
|
'id' |
3450 |
|
|
=> $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3451 |
|
|
->{$localName}, |
3452 |
|
|
|
3453 |
|
|
'b' |
3454 |
|
|
=> ($self->{'b'}), |
3455 |
|
|
}, { |
3456 |
|
|
}); |
3457 |
|
|
($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3458 |
|
|
->{$localName}}}->{ |
3459 |
|
|
'rc' |
3460 |
|
|
}++; |
3461 |
|
|
|
3462 |
|
|
|
3463 |
wakaba |
1.3 |
} |
3464 |
wakaba |
1.1 |
|
3465 |
|
|
; |
3466 |
|
|
} |
3467 |
|
|
|
3468 |
|
|
|
3469 |
wakaba |
1.3 |
} |
3470 |
wakaba |
1.1 |
|
3471 |
|
|
; |
3472 |
|
|
|
3473 |
|
|
|
3474 |
wakaba |
1.3 |
} |
3475 |
wakaba |
1.1 |
$r} |
3476 |
|
|
sub has_attribute ($$) { |
3477 |
|
|
my ($self, $name) = @_; |
3478 |
|
|
my $r = 0; |
3479 |
|
|
|
3480 |
|
|
{ |
3481 |
|
|
|
3482 |
|
|
my |
3483 |
|
|
$node; |
3484 |
|
|
|
3485 |
|
|
|
3486 |
|
|
{ |
3487 |
|
|
|
3488 |
|
|
my |
3489 |
|
|
$__attr; |
3490 |
|
|
|
3491 |
|
|
|
3492 |
|
|
{ |
3493 |
|
|
|
3494 |
|
|
|
3495 |
|
|
$__attr = $self->{ |
3496 |
|
|
'b' |
3497 |
|
|
}->{${$self->{ |
3498 |
|
|
'id' |
3499 |
|
|
}}} |
3500 |
|
|
->{'attr'}; |
3501 |
|
|
|
3502 |
|
|
|
3503 |
wakaba |
1.3 |
} |
3504 |
wakaba |
1.1 |
|
3505 |
|
|
; |
3506 |
|
|
|
3507 |
|
|
## Note that we no longer support DOM Level 1 nodes. |
3508 |
|
|
|
3509 |
|
|
## If an attribute's qualified name is equal to |
3510 |
|
|
## the requested name, then the node is the answer. |
3511 |
|
|
|
3512 |
|
|
## Note that if there is a namespace ill-formed attribute, |
3513 |
|
|
## the result is not the expected one. For example, |
3514 |
|
|
## if an |xmlns| attribute in the |http://www.w3.org/2000/xmlns/| |
3515 |
|
|
## namespace has non-NULL |prefix|, a request to get |xmlns| |
3516 |
|
|
## attribute will not return that node. |
3517 |
|
|
|
3518 |
|
|
## |sort|ing is required so that every |getAttribute|, |setAttribute|, |
3519 |
|
|
## |hasAttribute|, |removeAttribute|, or any other namespace unaware |
3520 |
|
|
## methods operates on the same node even if there is |
3521 |
|
|
## multiple nodes with the same qualified name. |
3522 |
|
|
|
3523 |
|
|
NS: for my $__ns (sort {$a cmp $b} keys %$__attr) { |
3524 |
|
|
for my $__ln (sort {$a cmp $b} keys %{$__attr->{$__ns}}) { |
3525 |
|
|
my $__node; |
3526 |
|
|
|
3527 |
|
|
|
3528 |
|
|
{ |
3529 |
|
|
|
3530 |
|
|
|
3531 |
|
|
$__node = ${($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
3532 |
|
|
'cls' |
3533 |
|
|
}}->___create_node_ref ({ |
3534 |
|
|
|
3535 |
|
|
'id' |
3536 |
|
|
=> $__attr->{$__ns}->{$__ln}, |
3537 |
|
|
|
3538 |
|
|
'b' |
3539 |
|
|
=> ($self->{'b'}), |
3540 |
|
|
}, { |
3541 |
|
|
}); |
3542 |
|
|
($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
3543 |
|
|
'rc' |
3544 |
|
|
}++; |
3545 |
|
|
|
3546 |
|
|
|
3547 |
wakaba |
1.3 |
} |
3548 |
wakaba |
1.1 |
|
3549 |
|
|
; |
3550 |
|
|
if ($__node-> |
3551 |
|
|
node_name eq |
3552 |
|
|
$name) { |
3553 |
|
|
|
3554 |
|
|
|
3555 |
|
|
{ |
3556 |
|
|
|
3557 |
|
|
|
3558 |
|
|
$node = $__node; |
3559 |
|
|
|
3560 |
|
|
|
3561 |
|
|
|
3562 |
wakaba |
1.3 |
} |
3563 |
wakaba |
1.1 |
|
3564 |
|
|
; |
3565 |
|
|
|
3566 |
|
|
|
3567 |
|
|
; |
3568 |
|
|
last NS; |
3569 |
|
|
} |
3570 |
|
|
} # ln |
3571 |
|
|
} # NS |
3572 |
|
|
|
3573 |
|
|
|
3574 |
wakaba |
1.3 |
} |
3575 |
wakaba |
1.1 |
|
3576 |
|
|
; |
3577 |
|
|
$r = defined $node; |
3578 |
|
|
|
3579 |
|
|
|
3580 |
wakaba |
1.3 |
} |
3581 |
wakaba |
1.1 |
$r} |
3582 |
|
|
sub has_attribute_ns ($$$) { |
3583 |
|
|
my ($self, $namespaceURI, $localName) = @_; |
3584 |
|
|
|
3585 |
|
|
{ |
3586 |
|
|
|
3587 |
|
|
if |
3588 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
3589 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
3590 |
wakaba |
1.1 |
|
3591 |
wakaba |
1.9 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3592 |
wakaba |
1.1 |
|
3593 |
|
|
; |
3594 |
|
|
|
3595 |
|
|
|
3596 |
|
|
|
3597 |
|
|
{ |
3598 |
|
|
|
3599 |
|
|
|
3600 |
|
|
$namespaceURI = undef; |
3601 |
|
|
|
3602 |
|
|
|
3603 |
|
|
|
3604 |
wakaba |
1.3 |
} |
3605 |
wakaba |
1.1 |
|
3606 |
|
|
; |
3607 |
|
|
} |
3608 |
|
|
|
3609 |
|
|
|
3610 |
wakaba |
1.3 |
} |
3611 |
wakaba |
1.1 |
my $r = 0; |
3612 |
|
|
|
3613 |
|
|
{ |
3614 |
|
|
|
3615 |
|
|
my |
3616 |
|
|
$node; |
3617 |
|
|
|
3618 |
|
|
|
3619 |
|
|
{ |
3620 |
|
|
|
3621 |
|
|
my |
3622 |
|
|
$__attrs; |
3623 |
|
|
|
3624 |
|
|
|
3625 |
|
|
{ |
3626 |
|
|
|
3627 |
|
|
|
3628 |
|
|
$__attrs = $self->{ |
3629 |
|
|
'b' |
3630 |
|
|
}->{${$self->{ |
3631 |
|
|
'id' |
3632 |
|
|
}}} |
3633 |
|
|
->{'attr'}; |
3634 |
|
|
|
3635 |
|
|
|
3636 |
wakaba |
1.3 |
} |
3637 |
wakaba |
1.1 |
|
3638 |
|
|
; |
3639 |
|
|
if (defined $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3640 |
|
|
->{$localName}) { |
3641 |
|
|
|
3642 |
|
|
|
3643 |
|
|
{ |
3644 |
|
|
|
3645 |
|
|
|
3646 |
|
|
$node = ${($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3647 |
|
|
->{$localName}}}->{ |
3648 |
|
|
'cls' |
3649 |
|
|
}}->___create_node_ref ({ |
3650 |
|
|
|
3651 |
|
|
'id' |
3652 |
|
|
=> $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3653 |
|
|
->{$localName}, |
3654 |
|
|
|
3655 |
|
|
'b' |
3656 |
|
|
=> ($self->{'b'}), |
3657 |
|
|
}, { |
3658 |
|
|
}); |
3659 |
|
|
($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
3660 |
|
|
->{$localName}}}->{ |
3661 |
|
|
'rc' |
3662 |
|
|
}++; |
3663 |
|
|
|
3664 |
|
|
|
3665 |
wakaba |
1.3 |
} |
3666 |
wakaba |
1.1 |
|
3667 |
|
|
; |
3668 |
|
|
} |
3669 |
|
|
|
3670 |
|
|
|
3671 |
wakaba |
1.3 |
} |
3672 |
wakaba |
1.1 |
|
3673 |
|
|
; |
3674 |
|
|
$r = defined $node; |
3675 |
|
|
|
3676 |
|
|
|
3677 |
wakaba |
1.3 |
} |
3678 |
wakaba |
1.1 |
$r} |
3679 |
|
|
sub set_attribute ($$$) { |
3680 |
|
|
my ($self, $name, $value) = @_; |
3681 |
|
|
|
3682 |
|
|
{ |
3683 |
|
|
|
3684 |
|
|
my |
3685 |
|
|
$od = $self-> |
3686 |
|
|
owner_document |
3687 |
|
|
; |
3688 |
|
|
if ($od-> |
3689 |
|
|
strict_error_checking |
3690 |
|
|
) { |
3691 |
|
|
if ($self-> |
3692 |
|
|
manakai_read_only |
3693 |
|
|
) { |
3694 |
|
|
|
3695 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
3696 |
|
|
|
3697 |
|
|
; |
3698 |
|
|
} |
3699 |
|
|
my $version = $od-> |
3700 |
|
|
xml_version |
3701 |
|
|
; |
3702 |
|
|
|
3703 |
|
|
|
3704 |
|
|
{ |
3705 |
|
|
|
3706 |
|
|
if |
3707 |
|
|
(defined $name) { |
3708 |
|
|
|
3709 |
|
|
|
3710 |
|
|
{ |
3711 |
|
|
|
3712 |
|
|
if |
3713 |
|
|
(((not defined $version or $version eq '1.0') and |
3714 |
|
|
not |
3715 |
|
|
($name =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
3716 |
|
|
) or |
3717 |
|
|
(defined $version and $version eq '1.1' and |
3718 |
|
|
not |
3719 |
|
|
($name =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
3720 |
|
|
)) { |
3721 |
|
|
|
3722 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $name, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
3723 |
|
|
|
3724 |
|
|
; |
3725 |
|
|
} |
3726 |
|
|
|
3727 |
|
|
|
3728 |
|
|
|
3729 |
wakaba |
1.3 |
} |
3730 |
wakaba |
1.1 |
|
3731 |
|
|
; |
3732 |
|
|
|
3733 |
|
|
|
3734 |
|
|
; |
3735 |
|
|
} |
3736 |
|
|
|
3737 |
|
|
|
3738 |
wakaba |
1.3 |
} |
3739 |
wakaba |
1.1 |
|
3740 |
|
|
; |
3741 |
|
|
} |
3742 |
|
|
|
3743 |
|
|
my $__anode; |
3744 |
|
|
|
3745 |
|
|
|
3746 |
|
|
{ |
3747 |
|
|
|
3748 |
|
|
my |
3749 |
|
|
$__attr; |
3750 |
|
|
|
3751 |
|
|
|
3752 |
|
|
{ |
3753 |
|
|
|
3754 |
|
|
|
3755 |
|
|
$__attr = $self->{ |
3756 |
|
|
'b' |
3757 |
|
|
}->{${$self->{ |
3758 |
|
|
'id' |
3759 |
|
|
}}} |
3760 |
|
|
->{'attr'}; |
3761 |
|
|
|
3762 |
|
|
|
3763 |
wakaba |
1.3 |
} |
3764 |
wakaba |
1.1 |
|
3765 |
|
|
; |
3766 |
|
|
|
3767 |
|
|
## Note that we no longer support DOM Level 1 nodes. |
3768 |
|
|
|
3769 |
|
|
## If an attribute's qualified name is equal to |
3770 |
|
|
## the requested name, then the node is the answer. |
3771 |
|
|
|
3772 |
|
|
## Note that if there is a namespace ill-formed attribute, |
3773 |
|
|
## the result is not the expected one. For example, |
3774 |
|
|
## if an |xmlns| attribute in the |http://www.w3.org/2000/xmlns/| |
3775 |
|
|
## namespace has non-NULL |prefix|, a request to get |xmlns| |
3776 |
|
|
## attribute will not return that node. |
3777 |
|
|
|
3778 |
|
|
## |sort|ing is required so that every |getAttribute|, |setAttribute|, |
3779 |
|
|
## |hasAttribute|, |removeAttribute|, or any other namespace unaware |
3780 |
|
|
## methods operates on the same node even if there is |
3781 |
|
|
## multiple nodes with the same qualified name. |
3782 |
|
|
|
3783 |
|
|
NS: for my $__ns (sort {$a cmp $b} keys %$__attr) { |
3784 |
|
|
for my $__ln (sort {$a cmp $b} keys %{$__attr->{$__ns}}) { |
3785 |
|
|
my $__node; |
3786 |
|
|
|
3787 |
|
|
|
3788 |
|
|
{ |
3789 |
|
|
|
3790 |
|
|
|
3791 |
|
|
$__node = ${($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
3792 |
|
|
'cls' |
3793 |
|
|
}}->___create_node_ref ({ |
3794 |
|
|
|
3795 |
|
|
'id' |
3796 |
|
|
=> $__attr->{$__ns}->{$__ln}, |
3797 |
|
|
|
3798 |
|
|
'b' |
3799 |
|
|
=> ($self->{'b'}), |
3800 |
|
|
}, { |
3801 |
|
|
}); |
3802 |
|
|
($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
3803 |
|
|
'rc' |
3804 |
|
|
}++; |
3805 |
|
|
|
3806 |
|
|
|
3807 |
wakaba |
1.3 |
} |
3808 |
wakaba |
1.1 |
|
3809 |
|
|
; |
3810 |
|
|
if ($__node-> |
3811 |
|
|
node_name eq |
3812 |
|
|
$name) { |
3813 |
|
|
|
3814 |
|
|
|
3815 |
|
|
{ |
3816 |
|
|
|
3817 |
|
|
|
3818 |
|
|
$__anode = $__node; |
3819 |
|
|
|
3820 |
|
|
|
3821 |
|
|
|
3822 |
wakaba |
1.3 |
} |
3823 |
wakaba |
1.1 |
|
3824 |
|
|
; |
3825 |
|
|
|
3826 |
|
|
|
3827 |
|
|
; |
3828 |
|
|
last NS; |
3829 |
|
|
} |
3830 |
|
|
} # ln |
3831 |
|
|
} # NS |
3832 |
|
|
|
3833 |
|
|
|
3834 |
wakaba |
1.3 |
} |
3835 |
wakaba |
1.1 |
|
3836 |
|
|
; |
3837 |
|
|
if (defined $__anode) { ## There is already a node with such a |name| |
3838 |
|
|
if ($__anode-> |
3839 |
|
|
manakai_read_only |
3840 |
|
|
) { |
3841 |
|
|
|
3842 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_ATTR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'name', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $__anode; |
3843 |
|
|
|
3844 |
|
|
; |
3845 |
|
|
} |
3846 |
|
|
} else { ## There is no such attribute |
3847 |
|
|
|
3848 |
|
|
|
3849 |
|
|
{ |
3850 |
|
|
|
3851 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3852 |
|
|
|
3853 |
|
|
{ |
3854 |
|
|
|
3855 |
|
|
|
3856 |
|
|
|
3857 |
|
|
$__anode = $od-> |
3858 |
|
|
create_attribute |
3859 |
|
|
($name); |
3860 |
|
|
my $__attrs; |
3861 |
|
|
|
3862 |
|
|
|
3863 |
|
|
{ |
3864 |
|
|
|
3865 |
|
|
|
3866 |
|
|
$__attrs = $self->{ |
3867 |
|
|
'b' |
3868 |
|
|
}->{${$self->{ |
3869 |
|
|
'id' |
3870 |
|
|
}}} |
3871 |
|
|
->{'attr'}; |
3872 |
|
|
|
3873 |
|
|
|
3874 |
wakaba |
1.3 |
} |
3875 |
wakaba |
1.1 |
|
3876 |
|
|
; |
3877 |
|
|
$__attrs->{''}->{$name} |
3878 |
|
|
= |
3879 |
|
|
$__anode->{'id'} |
3880 |
|
|
; |
3881 |
|
|
|
3882 |
|
|
|
3883 |
|
|
{ |
3884 |
|
|
|
3885 |
|
|
|
3886 |
|
|
$__anode->{ |
3887 |
|
|
'b' |
3888 |
|
|
}->{${$__anode->{ |
3889 |
|
|
'id' |
3890 |
|
|
}}} |
3891 |
|
|
->{'owner'} = $self->{ |
3892 |
|
|
'id' |
3893 |
|
|
}; |
3894 |
|
|
|
3895 |
|
|
|
3896 |
wakaba |
1.3 |
} |
3897 |
wakaba |
1.1 |
|
3898 |
|
|
; |
3899 |
|
|
|
3900 |
|
|
|
3901 |
|
|
|
3902 |
wakaba |
1.3 |
} |
3903 |
wakaba |
1.1 |
|
3904 |
|
|
|
3905 |
|
|
;} |
3906 |
|
|
|
3907 |
|
|
; |
3908 |
|
|
|
3909 |
|
|
|
3910 |
|
|
{ |
3911 |
|
|
|
3912 |
|
|
|
3913 |
|
|
## NOTE: The |cfg:xml-id| configuration parameter does not matter |
3914 |
|
|
## since it can be typed in the |createAttribute| method. |
3915 |
|
|
|
3916 |
|
|
|
3917 |
|
|
|
3918 |
|
|
{ |
3919 |
|
|
|
3920 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3921 |
|
|
|
3922 |
|
|
{ |
3923 |
|
|
|
3924 |
|
|
|
3925 |
wakaba |
1.3 |
if |
3926 |
|
|
($od-> |
3927 |
|
|
dom_config |
3928 |
|
|
|
3929 |
|
|
-> |
3930 |
|
|
get_parameter |
3931 |
|
|
|
3932 |
|
|
( |
3933 |
|
|
'http://suika.fam.cx/www/2006/dom-config/dtd-attribute-type' |
3934 |
|
|
)) { |
3935 |
|
|
my $__st_doctype = $od-> |
3936 |
wakaba |
1.1 |
doctype |
3937 |
|
|
; |
3938 |
wakaba |
1.3 |
$__st_doctype = $__st_doctype-> |
3939 |
wakaba |
1.1 |
get_feature |
3940 |
|
|
|
3941 |
wakaba |
1.3 |
( |
3942 |
wakaba |
1.1 |
'http://suika.fam.cx/www/2006/feature/XDoctype' |
3943 |
|
|
=> '3.0') |
3944 |
wakaba |
1.3 |
if defined $__st_doctype; |
3945 |
|
|
if (defined $__st_doctype) { |
3946 |
|
|
my $__st_et = $__st_doctype-> |
3947 |
wakaba |
1.1 |
get_element_type_definition_node |
3948 |
|
|
|
3949 |
wakaba |
1.3 |
($self-> |
3950 |
wakaba |
1.1 |
node_name |
3951 |
|
|
); |
3952 |
wakaba |
1.3 |
if (defined $__st_et) { |
3953 |
|
|
my $__st_at = $__st_et-> |
3954 |
wakaba |
1.1 |
get_attribute_definition_node |
3955 |
|
|
|
3956 |
wakaba |
1.3 |
($name); |
3957 |
|
|
if (defined $__st_at) { |
3958 |
|
|
$__anode-> |
3959 |
wakaba |
1.1 |
manakai_attribute_type |
3960 |
|
|
|
3961 |
wakaba |
1.3 |
($__st_at-> |
3962 |
wakaba |
1.1 |
declared_type |
3963 |
|
|
); |
3964 |
wakaba |
1.3 |
} |
3965 |
wakaba |
1.1 |
} |
3966 |
|
|
} |
3967 |
|
|
} |
3968 |
|
|
|
3969 |
|
|
|
3970 |
|
|
|
3971 |
wakaba |
1.3 |
} |
3972 |
wakaba |
1.1 |
|
3973 |
|
|
|
3974 |
|
|
;} |
3975 |
|
|
|
3976 |
|
|
; |
3977 |
|
|
|
3978 |
|
|
|
3979 |
wakaba |
1.3 |
} |
3980 |
wakaba |
1.1 |
|
3981 |
|
|
; |
3982 |
|
|
} |
3983 |
|
|
|
3984 |
|
|
|
3985 |
|
|
{ |
3986 |
|
|
|
3987 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3988 |
|
|
|
3989 |
|
|
{ |
3990 |
|
|
|
3991 |
|
|
|
3992 |
|
|
|
3993 |
|
|
$__anode-> |
3994 |
|
|
value |
3995 |
|
|
($value); |
3996 |
|
|
$__anode-> |
3997 |
|
|
specified |
3998 |
|
|
( |
3999 |
|
|
1 |
4000 |
|
|
); |
4001 |
|
|
|
4002 |
|
|
|
4003 |
|
|
|
4004 |
wakaba |
1.3 |
} |
4005 |
wakaba |
1.1 |
|
4006 |
|
|
|
4007 |
|
|
;} |
4008 |
|
|
|
4009 |
|
|
; |
4010 |
|
|
|
4011 |
|
|
|
4012 |
wakaba |
1.3 |
} |
4013 |
wakaba |
1.1 |
} |
4014 |
|
|
sub set_attribute_ns ($$$$) { |
4015 |
|
|
my ($self, $namespaceURI, $qualifiedName, $value) = @_; |
4016 |
|
|
|
4017 |
|
|
{ |
4018 |
|
|
|
4019 |
|
|
if |
4020 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
4021 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
4022 |
wakaba |
1.1 |
|
4023 |
wakaba |
1.9 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
4024 |
wakaba |
1.1 |
|
4025 |
|
|
; |
4026 |
|
|
|
4027 |
|
|
|
4028 |
|
|
|
4029 |
|
|
{ |
4030 |
|
|
|
4031 |
|
|
|
4032 |
|
|
$namespaceURI = undef; |
4033 |
|
|
|
4034 |
|
|
|
4035 |
|
|
|
4036 |
wakaba |
1.3 |
} |
4037 |
wakaba |
1.1 |
|
4038 |
|
|
; |
4039 |
|
|
} |
4040 |
|
|
|
4041 |
|
|
|
4042 |
wakaba |
1.3 |
} |
4043 |
wakaba |
1.1 |
|
4044 |
|
|
{ |
4045 |
|
|
|
4046 |
|
|
my |
4047 |
|
|
($prefix, $localName) = ref $qualifiedName eq 'ARRAY' |
4048 |
|
|
? @$qualifiedName |
4049 |
|
|
: split /:/, $qualifiedName, 2; |
4050 |
|
|
($prefix, $localName) = ( |
4051 |
|
|
undef |
4052 |
|
|
, $prefix) unless defined $localName; |
4053 |
|
|
|
4054 |
|
|
my $od = $self-> |
4055 |
|
|
owner_document |
4056 |
|
|
; |
4057 |
|
|
if ($od-> |
4058 |
|
|
strict_error_checking |
4059 |
|
|
) { |
4060 |
|
|
if ($self-> |
4061 |
|
|
manakai_read_only |
4062 |
|
|
) { |
4063 |
|
|
|
4064 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_ns', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
4065 |
|
|
|
4066 |
|
|
; |
4067 |
|
|
} |
4068 |
|
|
my $version = $od-> |
4069 |
|
|
xml_version |
4070 |
|
|
; |
4071 |
|
|
$qualifiedName = defined $prefix ? $prefix.':'.$localName |
4072 |
|
|
: $localName; |
4073 |
|
|
|
4074 |
|
|
|
4075 |
|
|
{ |
4076 |
|
|
|
4077 |
|
|
if |
4078 |
|
|
(defined $version and $version eq '1.1') { |
4079 |
|
|
unless ( |
4080 |
|
|
($qualifiedName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
4081 |
|
|
) { |
4082 |
|
|
|
4083 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
4084 |
|
|
|
4085 |
|
|
; |
4086 |
|
|
} |
4087 |
|
|
unless ( |
4088 |
|
|
($qualifiedName =~ /\A\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*(?::\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*)?\z/) |
4089 |
|
|
) { |
4090 |
|
|
|
4091 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
4092 |
|
|
|
4093 |
|
|
; |
4094 |
|
|
} |
4095 |
|
|
} else { |
4096 |
|
|
unless ( |
4097 |
|
|
($qualifiedName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
4098 |
|
|
) { |
4099 |
|
|
|
4100 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
4101 |
|
|
|
4102 |
|
|
; |
4103 |
|
|
} |
4104 |
|
|
unless ( |
4105 |
|
|
($qualifiedName =~ /\A\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*(?::\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*)?\z/) |
4106 |
|
|
) { |
4107 |
|
|
|
4108 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
4109 |
|
|
|
4110 |
|
|
; |
4111 |
|
|
} |
4112 |
|
|
} |
4113 |
|
|
|
4114 |
|
|
|
4115 |
wakaba |
1.3 |
} |
4116 |
wakaba |
1.1 |
|
4117 |
|
|
; |
4118 |
|
|
|
4119 |
|
|
|
4120 |
|
|
{ |
4121 |
|
|
|
4122 |
|
|
if |
4123 |
|
|
(defined $prefix) { |
4124 |
|
|
if (not defined $namespaceURI) { |
4125 |
|
|
|
4126 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_PREFIX_WITH_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
4127 |
|
|
|
4128 |
|
|
; |
4129 |
|
|
} elsif ($prefix eq 'xml' and $namespaceURI ne |
4130 |
|
|
'http://www.w3.org/XML/1998/namespace' |
4131 |
|
|
) { |
4132 |
|
|
|
4133 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XML_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
4134 |
|
|
|
4135 |
|
|
; |
4136 |
|
|
} elsif ($prefix eq 'xmlns' and $namespaceURI ne |
4137 |
|
|
'http://www.w3.org/2000/xmlns/' |
4138 |
|
|
) { |
4139 |
|
|
|
4140 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XMLNS_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
4141 |
|
|
|
4142 |
|
|
; |
4143 |
|
|
} elsif ($namespaceURI eq |
4144 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
4145 |
|
|
$prefix ne 'xml') { |
4146 |
|
|
|
4147 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XML_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
4148 |
|
|
|
4149 |
|
|
; |
4150 |
|
|
} elsif ($namespaceURI eq |
4151 |
|
|
'http://www.w3.org/2000/xmlns/' and |
4152 |
|
|
$prefix ne 'xmlns') { |
4153 |
|
|
|
4154 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
4155 |
|
|
|
4156 |
|
|
; |
4157 |
|
|
} |
4158 |
|
|
} else { ## No prefix |
4159 |
|
|
if (not defined $namespaceURI) { |
4160 |
|
|
# |
4161 |
|
|
} elsif ($namespaceURI eq |
4162 |
|
|
'http://www.w3.org/2000/xmlns/' and |
4163 |
|
|
$localName ne 'xmlns') { |
4164 |
|
|
|
4165 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => undef, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
4166 |
|
|
|
4167 |
|
|
; |
4168 |
|
|
} |
4169 |
|
|
} |
4170 |
|
|
|
4171 |
|
|
|
4172 |
wakaba |
1.3 |
} |
4173 |
wakaba |
1.1 |
|
4174 |
|
|
; |
4175 |
|
|
} |
4176 |
|
|
|
4177 |
|
|
|
4178 |
|
|
{ |
4179 |
|
|
|
4180 |
|
|
my |
4181 |
|
|
$__anode; |
4182 |
|
|
|
4183 |
|
|
|
4184 |
|
|
{ |
4185 |
|
|
|
4186 |
|
|
my |
4187 |
|
|
$__attrs; |
4188 |
|
|
|
4189 |
|
|
|
4190 |
|
|
{ |
4191 |
|
|
|
4192 |
|
|
|
4193 |
|
|
$__attrs = $self->{ |
4194 |
|
|
'b' |
4195 |
|
|
}->{${$self->{ |
4196 |
|
|
'id' |
4197 |
|
|
}}} |
4198 |
|
|
->{'attr'}; |
4199 |
|
|
|
4200 |
|
|
|
4201 |
wakaba |
1.3 |
} |
4202 |
wakaba |
1.1 |
|
4203 |
|
|
; |
4204 |
|
|
if (defined $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
4205 |
|
|
->{$localName}) { |
4206 |
|
|
|
4207 |
|
|
|
4208 |
|
|
{ |
4209 |
|
|
|
4210 |
|
|
|
4211 |
|
|
$__anode = ${($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
4212 |
|
|
->{$localName}}}->{ |
4213 |
|
|
'cls' |
4214 |
|
|
}}->___create_node_ref ({ |
4215 |
|
|
|
4216 |
|
|
'id' |
4217 |
|
|
=> $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
4218 |
|
|
->{$localName}, |
4219 |
|
|
|
4220 |
|
|
'b' |
4221 |
|
|
=> ($self->{'b'}), |
4222 |
|
|
}, { |
4223 |
|
|
}); |
4224 |
|
|
($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
4225 |
|
|
->{$localName}}}->{ |
4226 |
|
|
'rc' |
4227 |
|
|
}++; |
4228 |
|
|
|
4229 |
|
|
|
4230 |
wakaba |
1.3 |
} |
4231 |
wakaba |
1.1 |
|
4232 |
|
|
; |
4233 |
|
|
} |
4234 |
|
|
|
4235 |
|
|
|
4236 |
wakaba |
1.3 |
} |
4237 |
wakaba |
1.1 |
|
4238 |
|
|
; |
4239 |
|
|
if (defined $__anode) { ## There is already a node with such a |name| |
4240 |
|
|
if ($__anode-> |
4241 |
|
|
manakai_read_only |
4242 |
|
|
) { |
4243 |
|
|
|
4244 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_ATTR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/setAttrValueNS+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $__anode; |
4245 |
|
|
|
4246 |
|
|
; |
4247 |
|
|
} |
4248 |
|
|
$__anode-> |
4249 |
|
|
prefix |
4250 |
|
|
($prefix) if defined $prefix; |
4251 |
|
|
## ISSUE: Should NULL be allowed here with |strictErrorChecking| off? |
4252 |
|
|
} else { ## There is no such attribute |
4253 |
|
|
|
4254 |
|
|
|
4255 |
|
|
{ |
4256 |
|
|
|
4257 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4258 |
|
|
|
4259 |
|
|
{ |
4260 |
|
|
|
4261 |
|
|
|
4262 |
|
|
|
4263 |
|
|
$__anode = $od-> |
4264 |
|
|
create_attribute_ns |
4265 |
|
|
|
4266 |
|
|
($namespaceURI, [$prefix, $localName]); |
4267 |
|
|
my $__attrs; |
4268 |
|
|
|
4269 |
|
|
|
4270 |
|
|
{ |
4271 |
|
|
|
4272 |
|
|
|
4273 |
|
|
$__attrs = $self->{ |
4274 |
|
|
'b' |
4275 |
|
|
}->{${$self->{ |
4276 |
|
|
'id' |
4277 |
|
|
}}} |
4278 |
|
|
->{'attr'}; |
4279 |
|
|
|
4280 |
|
|
|
4281 |
wakaba |
1.3 |
} |
4282 |
wakaba |
1.1 |
|
4283 |
|
|
; |
4284 |
|
|
$__attrs->{defined $namespaceURI ? $namespaceURI : ''}->{$localName} |
4285 |
|
|
= |
4286 |
|
|
$__anode->{'id'} |
4287 |
|
|
; |
4288 |
|
|
|
4289 |
|
|
|
4290 |
|
|
{ |
4291 |
|
|
|
4292 |
|
|
|
4293 |
|
|
$__anode->{ |
4294 |
|
|
'b' |
4295 |
|
|
}->{${$__anode->{ |
4296 |
|
|
'id' |
4297 |
|
|
}}} |
4298 |
|
|
->{'owner'} = $self->{ |
4299 |
|
|
'id' |
4300 |
|
|
}; |
4301 |
|
|
|
4302 |
|
|
|
4303 |
wakaba |
1.3 |
} |
4304 |
wakaba |
1.1 |
|
4305 |
|
|
; |
4306 |
|
|
|
4307 |
|
|
|
4308 |
|
|
|
4309 |
wakaba |
1.3 |
} |
4310 |
wakaba |
1.1 |
|
4311 |
|
|
|
4312 |
|
|
;} |
4313 |
|
|
|
4314 |
|
|
; |
4315 |
|
|
|
4316 |
|
|
|
4317 |
|
|
{ |
4318 |
|
|
|
4319 |
|
|
|
4320 |
|
|
## NOTE: The |cfg:xml-id| configuration parameter does not matter |
4321 |
|
|
## since it can be typed in the |createAttribute| method. |
4322 |
|
|
|
4323 |
|
|
|
4324 |
|
|
|
4325 |
|
|
{ |
4326 |
|
|
|
4327 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4328 |
|
|
|
4329 |
|
|
{ |
4330 |
|
|
|
4331 |
|
|
|
4332 |
wakaba |
1.3 |
if |
4333 |
|
|
($od-> |
4334 |
|
|
dom_config |
4335 |
|
|
|
4336 |
|
|
-> |
4337 |
|
|
get_parameter |
4338 |
|
|
|
4339 |
|
|
( |
4340 |
|
|
'http://suika.fam.cx/www/2006/dom-config/dtd-attribute-type' |
4341 |
|
|
)) { |
4342 |
|
|
my $__st_doctype = $od-> |
4343 |
wakaba |
1.1 |
doctype |
4344 |
|
|
; |
4345 |
wakaba |
1.3 |
$__st_doctype = $__st_doctype-> |
4346 |
wakaba |
1.1 |
get_feature |
4347 |
|
|
|
4348 |
wakaba |
1.3 |
( |
4349 |
wakaba |
1.1 |
'http://suika.fam.cx/www/2006/feature/XDoctype' |
4350 |
|
|
=> '3.0') |
4351 |
wakaba |
1.3 |
if defined $__st_doctype; |
4352 |
|
|
if (defined $__st_doctype) { |
4353 |
|
|
my $__st_et = $__st_doctype-> |
4354 |
wakaba |
1.1 |
get_element_type_definition_node |
4355 |
|
|
|
4356 |
wakaba |
1.3 |
($self-> |
4357 |
wakaba |
1.1 |
node_name |
4358 |
|
|
); |
4359 |
wakaba |
1.3 |
if (defined $__st_et) { |
4360 |
|
|
my $__st_at = $__st_et-> |
4361 |
wakaba |
1.1 |
get_attribute_definition_node |
4362 |
|
|
|
4363 |
wakaba |
1.3 |
(defined $prefix ? $prefix.':'.$localName |
4364 |
wakaba |
1.1 |
: $localName); |
4365 |
wakaba |
1.3 |
if (defined $__st_at) { |
4366 |
|
|
$__anode-> |
4367 |
wakaba |
1.1 |
manakai_attribute_type |
4368 |
|
|
|
4369 |
wakaba |
1.3 |
($__st_at-> |
4370 |
wakaba |
1.1 |
declared_type |
4371 |
|
|
); |
4372 |
wakaba |
1.3 |
} |
4373 |
wakaba |
1.1 |
} |
4374 |
|
|
} |
4375 |
|
|
} |
4376 |
|
|
|
4377 |
|
|
|
4378 |
|
|
|
4379 |
wakaba |
1.3 |
} |
4380 |
wakaba |
1.1 |
|
4381 |
|
|
|
4382 |
|
|
;} |
4383 |
|
|
|
4384 |
|
|
; |
4385 |
|
|
|
4386 |
|
|
|
4387 |
wakaba |
1.3 |
} |
4388 |
wakaba |
1.1 |
|
4389 |
|
|
; |
4390 |
|
|
} |
4391 |
|
|
|
4392 |
|
|
|
4393 |
|
|
{ |
4394 |
|
|
|
4395 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4396 |
|
|
|
4397 |
|
|
{ |
4398 |
|
|
|
4399 |
|
|
|
4400 |
|
|
|
4401 |
|
|
$__anode-> |
4402 |
|
|
value |
4403 |
|
|
(defined $value ? $value : ''); |
4404 |
|
|
$__anode-> |
4405 |
|
|
specified |
4406 |
|
|
( |
4407 |
|
|
1 |
4408 |
|
|
); |
4409 |
|
|
|
4410 |
|
|
|
4411 |
|
|
|
4412 |
wakaba |
1.3 |
} |
4413 |
wakaba |
1.1 |
|
4414 |
|
|
|
4415 |
|
|
;} |
4416 |
|
|
|
4417 |
|
|
; |
4418 |
|
|
|
4419 |
|
|
|
4420 |
wakaba |
1.3 |
} |
4421 |
wakaba |
1.1 |
|
4422 |
|
|
; |
4423 |
|
|
|
4424 |
|
|
|
4425 |
wakaba |
1.3 |
} |
4426 |
wakaba |
1.1 |
} |
4427 |
|
|
sub set_attribute_node ($$) { |
4428 |
|
|
my ($self, $newAttr) = @_; |
4429 |
|
|
my $r; |
4430 |
|
|
|
4431 |
|
|
{ |
4432 |
|
|
|
4433 |
|
|
my |
4434 |
|
|
$self_od = $self-> |
4435 |
|
|
owner_document |
4436 |
|
|
; |
4437 |
|
|
my $strict = $self_od-> |
4438 |
|
|
strict_error_checking |
4439 |
|
|
; |
4440 |
|
|
if ($strict and |
4441 |
|
|
not $self_od eq $newAttr-> |
4442 |
|
|
owner_document |
4443 |
|
|
) { |
4444 |
|
|
|
4445 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newAttr; |
4446 |
|
|
|
4447 |
|
|
; |
4448 |
|
|
} |
4449 |
|
|
|
4450 |
|
|
my $nsuri = $newAttr-> |
4451 |
|
|
namespace_uri |
4452 |
|
|
; |
4453 |
|
|
$nsuri = '' unless defined $nsuri; |
4454 |
|
|
my $ln = $newAttr-> |
4455 |
|
|
local_name |
4456 |
|
|
; |
4457 |
|
|
my $attrs; |
4458 |
|
|
|
4459 |
|
|
|
4460 |
|
|
{ |
4461 |
|
|
|
4462 |
|
|
|
4463 |
|
|
$attrs = $self->{ |
4464 |
|
|
'b' |
4465 |
|
|
}->{${$self->{ |
4466 |
|
|
'id' |
4467 |
|
|
}}} |
4468 |
|
|
->{'attr'}; |
4469 |
|
|
|
4470 |
|
|
|
4471 |
wakaba |
1.3 |
} |
4472 |
wakaba |
1.1 |
|
4473 |
|
|
; |
4474 |
|
|
my $current; |
4475 |
|
|
if (defined $attrs->{$nsuri}->{$ln}) { |
4476 |
|
|
|
4477 |
|
|
|
4478 |
|
|
{ |
4479 |
|
|
|
4480 |
|
|
|
4481 |
|
|
$current = ${($self->{'b'})->{${$attrs->{$nsuri}->{$ln}}}->{ |
4482 |
|
|
'cls' |
4483 |
|
|
}}->___create_node_ref ({ |
4484 |
|
|
|
4485 |
|
|
'id' |
4486 |
|
|
=> $attrs->{$nsuri}->{$ln}, |
4487 |
|
|
|
4488 |
|
|
'b' |
4489 |
|
|
=> ($self->{'b'}), |
4490 |
|
|
}, { |
4491 |
|
|
}); |
4492 |
|
|
($self->{'b'})->{${$attrs->{$nsuri}->{$ln}}}->{ |
4493 |
|
|
'rc' |
4494 |
|
|
}++; |
4495 |
|
|
|
4496 |
|
|
|
4497 |
wakaba |
1.3 |
} |
4498 |
wakaba |
1.1 |
|
4499 |
|
|
; |
4500 |
|
|
} |
4501 |
|
|
|
4502 |
|
|
if (defined $newAttr-> |
4503 |
|
|
owner_element |
4504 |
|
|
) { |
4505 |
|
|
if (defined $current and $current eq $newAttr) { |
4506 |
|
|
|
4507 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#replace-by-itself', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_node', 'rdata' => $newAttr, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
4508 |
|
|
|
4509 |
|
|
; |
4510 |
|
|
## No return value |
4511 |
|
|
} else { |
4512 |
|
|
|
4513 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INUSE_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newAttr; |
4514 |
|
|
|
4515 |
|
|
; |
4516 |
|
|
} |
4517 |
|
|
} else { # not in use |
4518 |
|
|
if ($strict and $self-> |
4519 |
|
|
manakai_read_only |
4520 |
|
|
) { |
4521 |
|
|
|
4522 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
4523 |
|
|
|
4524 |
|
|
; |
4525 |
|
|
} |
4526 |
|
|
|
4527 |
|
|
$attrs->{$nsuri}->{$ln} = |
4528 |
|
|
$newAttr->{'id'} |
4529 |
|
|
; |
4530 |
|
|
|
4531 |
|
|
|
4532 |
|
|
{ |
4533 |
|
|
|
4534 |
|
|
|
4535 |
|
|
$newAttr->{ |
4536 |
|
|
'b' |
4537 |
|
|
}->{${$newAttr->{ |
4538 |
|
|
'id' |
4539 |
|
|
}}} |
4540 |
|
|
->{'owner'} = $self->{ |
4541 |
|
|
'id' |
4542 |
|
|
}; |
4543 |
|
|
|
4544 |
|
|
|
4545 |
wakaba |
1.3 |
} |
4546 |
wakaba |
1.1 |
|
4547 |
|
|
; |
4548 |
|
|
$newAttr-> |
4549 |
|
|
specified |
4550 |
|
|
( |
4551 |
|
|
1 |
4552 |
|
|
); |
4553 |
|
|
|
4554 |
|
|
if (defined $current) { |
4555 |
|
|
|
4556 |
|
|
|
4557 |
|
|
{ |
4558 |
|
|
|
4559 |
|
|
CORE::delete |
4560 |
|
|
$current->{ |
4561 |
|
|
'b' |
4562 |
|
|
}->{${$current->{ |
4563 |
|
|
'id' |
4564 |
|
|
}}} |
4565 |
|
|
->{'owner'}; |
4566 |
|
|
|
4567 |
|
|
|
4568 |
wakaba |
1.3 |
} |
4569 |
wakaba |
1.1 |
|
4570 |
|
|
; |
4571 |
|
|
$r = $current; |
4572 |
|
|
} |
4573 |
|
|
} |
4574 |
|
|
|
4575 |
|
|
|
4576 |
wakaba |
1.3 |
} |
4577 |
wakaba |
1.1 |
$r} |
4578 |
|
|
sub set_attribute_node_ns ($$) { |
4579 |
|
|
my ($self, $newAttr) = @_; |
4580 |
|
|
my $r; |
4581 |
|
|
|
4582 |
|
|
{ |
4583 |
|
|
|
4584 |
|
|
my |
4585 |
|
|
$self_od = $self-> |
4586 |
|
|
owner_document |
4587 |
|
|
; |
4588 |
|
|
my $strict = $self_od-> |
4589 |
|
|
strict_error_checking |
4590 |
|
|
; |
4591 |
|
|
if ($strict and |
4592 |
|
|
not $self_od eq $newAttr-> |
4593 |
|
|
owner_document |
4594 |
|
|
) { |
4595 |
|
|
|
4596 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newAttr; |
4597 |
|
|
|
4598 |
|
|
; |
4599 |
|
|
} |
4600 |
|
|
|
4601 |
|
|
my $nsuri = $newAttr-> |
4602 |
|
|
namespace_uri |
4603 |
|
|
; |
4604 |
|
|
$nsuri = '' unless defined $nsuri; |
4605 |
|
|
my $ln = $newAttr-> |
4606 |
|
|
local_name |
4607 |
|
|
; |
4608 |
|
|
my $attrs; |
4609 |
|
|
|
4610 |
|
|
|
4611 |
|
|
{ |
4612 |
|
|
|
4613 |
|
|
|
4614 |
|
|
$attrs = $self->{ |
4615 |
|
|
'b' |
4616 |
|
|
}->{${$self->{ |
4617 |
|
|
'id' |
4618 |
|
|
}}} |
4619 |
|
|
->{'attr'}; |
4620 |
|
|
|
4621 |
|
|
|
4622 |
wakaba |
1.3 |
} |
4623 |
wakaba |
1.1 |
|
4624 |
|
|
; |
4625 |
|
|
my $current; |
4626 |
|
|
if (defined $attrs->{$nsuri}->{$ln}) { |
4627 |
|
|
|
4628 |
|
|
|
4629 |
|
|
{ |
4630 |
|
|
|
4631 |
|
|
|
4632 |
|
|
$current = ${($self->{'b'})->{${$attrs->{$nsuri}->{$ln}}}->{ |
4633 |
|
|
'cls' |
4634 |
|
|
}}->___create_node_ref ({ |
4635 |
|
|
|
4636 |
|
|
'id' |
4637 |
|
|
=> $attrs->{$nsuri}->{$ln}, |
4638 |
|
|
|
4639 |
|
|
'b' |
4640 |
|
|
=> ($self->{'b'}), |
4641 |
|
|
}, { |
4642 |
|
|
}); |
4643 |
|
|
($self->{'b'})->{${$attrs->{$nsuri}->{$ln}}}->{ |
4644 |
|
|
'rc' |
4645 |
|
|
}++; |
4646 |
|
|
|
4647 |
|
|
|
4648 |
wakaba |
1.3 |
} |
4649 |
wakaba |
1.1 |
|
4650 |
|
|
; |
4651 |
|
|
} |
4652 |
|
|
|
4653 |
|
|
if (defined $newAttr-> |
4654 |
|
|
owner_element |
4655 |
|
|
) { |
4656 |
|
|
if (defined $current and $current eq $newAttr) { |
4657 |
|
|
|
4658 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#replace-by-itself', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_node', 'rdata' => $newAttr, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
4659 |
|
|
|
4660 |
|
|
; |
4661 |
|
|
## No return value |
4662 |
|
|
} else { |
4663 |
|
|
|
4664 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INUSE_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newAttr; |
4665 |
|
|
|
4666 |
|
|
; |
4667 |
|
|
} |
4668 |
|
|
} else { # not in use |
4669 |
|
|
if ($strict and $self-> |
4670 |
|
|
manakai_read_only |
4671 |
|
|
) { |
4672 |
|
|
|
4673 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
4674 |
|
|
|
4675 |
|
|
; |
4676 |
|
|
} |
4677 |
|
|
|
4678 |
|
|
$attrs->{$nsuri}->{$ln} = |
4679 |
|
|
$newAttr->{'id'} |
4680 |
|
|
; |
4681 |
|
|
|
4682 |
|
|
|
4683 |
|
|
{ |
4684 |
|
|
|
4685 |
|
|
|
4686 |
|
|
$newAttr->{ |
4687 |
|
|
'b' |
4688 |
|
|
}->{${$newAttr->{ |
4689 |
|
|
'id' |
4690 |
|
|
}}} |
4691 |
|
|
->{'owner'} = $self->{ |
4692 |
|
|
'id' |
4693 |
|
|
}; |
4694 |
|
|
|
4695 |
|
|
|
4696 |
wakaba |
1.3 |
} |
4697 |
wakaba |
1.1 |
|
4698 |
|
|
; |
4699 |
|
|
$newAttr-> |
4700 |
|
|
specified |
4701 |
|
|
( |
4702 |
|
|
1 |
4703 |
|
|
); |
4704 |
|
|
|
4705 |
|
|
if (defined $current) { |
4706 |
|
|
|
4707 |
|
|
|
4708 |
|
|
{ |
4709 |
|
|
|
4710 |
|
|
CORE::delete |
4711 |
|
|
$current->{ |
4712 |
|
|
'b' |
4713 |
|
|
}->{${$current->{ |
4714 |
|
|
'id' |
4715 |
|
|
}}} |
4716 |
|
|
->{'owner'}; |
4717 |
|
|
|
4718 |
|
|
|
4719 |
wakaba |
1.3 |
} |
4720 |
wakaba |
1.1 |
|
4721 |
|
|
; |
4722 |
|
|
$r = $current; |
4723 |
|
|
} |
4724 |
|
|
} |
4725 |
|
|
|
4726 |
|
|
|
4727 |
wakaba |
1.3 |
} |
4728 |
wakaba |
1.1 |
$r} |
4729 |
|
|
sub remove_attribute ($$) { |
4730 |
|
|
my ($self, $name) = @_; |
4731 |
|
|
|
4732 |
|
|
{ |
4733 |
|
|
|
4734 |
|
|
my |
4735 |
|
|
$list; |
4736 |
|
|
my $key; |
4737 |
|
|
my $attr; |
4738 |
|
|
|
4739 |
|
|
|
4740 |
|
|
{ |
4741 |
|
|
|
4742 |
|
|
my |
4743 |
|
|
$__attr; |
4744 |
|
|
|
4745 |
|
|
|
4746 |
|
|
{ |
4747 |
|
|
|
4748 |
|
|
|
4749 |
|
|
$__attr = $self->{ |
4750 |
|
|
'b' |
4751 |
|
|
}->{${$self->{ |
4752 |
|
|
'id' |
4753 |
|
|
}}} |
4754 |
|
|
->{'attr'}; |
4755 |
|
|
|
4756 |
|
|
|
4757 |
wakaba |
1.3 |
} |
4758 |
wakaba |
1.1 |
|
4759 |
|
|
; |
4760 |
|
|
|
4761 |
|
|
## Note that we no longer support DOM Level 1 nodes. |
4762 |
|
|
|
4763 |
|
|
## If an attribute's qualified name is equal to |
4764 |
|
|
## the requested name, then the node is the answer. |
4765 |
|
|
|
4766 |
|
|
## Note that if there is a namespace ill-formed attribute, |
4767 |
|
|
## the result is not the expected one. For example, |
4768 |
|
|
## if an |xmlns| attribute in the |http://www.w3.org/2000/xmlns/| |
4769 |
|
|
## namespace has non-NULL |prefix|, a request to get |xmlns| |
4770 |
|
|
## attribute will not return that node. |
4771 |
|
|
|
4772 |
|
|
## |sort|ing is required so that every |getAttribute|, |setAttribute|, |
4773 |
|
|
## |hasAttribute|, |removeAttribute|, or any other namespace unaware |
4774 |
|
|
## methods operates on the same node even if there is |
4775 |
|
|
## multiple nodes with the same qualified name. |
4776 |
|
|
|
4777 |
|
|
NS: for my $__ns (sort {$a cmp $b} keys %$__attr) { |
4778 |
|
|
for my $__ln (sort {$a cmp $b} keys %{$__attr->{$__ns}}) { |
4779 |
|
|
my $__node; |
4780 |
|
|
|
4781 |
|
|
|
4782 |
|
|
{ |
4783 |
|
|
|
4784 |
|
|
|
4785 |
|
|
$__node = ${($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
4786 |
|
|
'cls' |
4787 |
|
|
}}->___create_node_ref ({ |
4788 |
|
|
|
4789 |
|
|
'id' |
4790 |
|
|
=> $__attr->{$__ns}->{$__ln}, |
4791 |
|
|
|
4792 |
|
|
'b' |
4793 |
|
|
=> ($self->{'b'}), |
4794 |
|
|
}, { |
4795 |
|
|
}); |
4796 |
|
|
($self->{'b'})->{${$__attr->{$__ns}->{$__ln}}}->{ |
4797 |
|
|
'rc' |
4798 |
|
|
}++; |
4799 |
|
|
|
4800 |
|
|
|
4801 |
wakaba |
1.3 |
} |
4802 |
wakaba |
1.1 |
|
4803 |
|
|
; |
4804 |
|
|
if ($__node-> |
4805 |
|
|
node_name eq |
4806 |
|
|
$name) { |
4807 |
|
|
|
4808 |
|
|
|
4809 |
|
|
; |
4810 |
|
|
|
4811 |
|
|
|
4812 |
|
|
{ |
4813 |
|
|
|
4814 |
|
|
|
4815 |
|
|
$attr = $__node; |
4816 |
|
|
$list = $__attr->{$__ns}; |
4817 |
|
|
$key = $__ln; |
4818 |
|
|
|
4819 |
|
|
|
4820 |
|
|
|
4821 |
wakaba |
1.3 |
} |
4822 |
wakaba |
1.1 |
|
4823 |
|
|
; |
4824 |
|
|
last NS; |
4825 |
|
|
} |
4826 |
|
|
} # ln |
4827 |
|
|
} # NS |
4828 |
|
|
|
4829 |
|
|
|
4830 |
wakaba |
1.3 |
} |
4831 |
wakaba |
1.1 |
|
4832 |
|
|
; |
4833 |
|
|
if (defined $attr) { |
4834 |
|
|
if ($self-> |
4835 |
|
|
manakai_read_only |
4836 |
|
|
) { |
4837 |
|
|
|
4838 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'remove_attribute', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
4839 |
|
|
|
4840 |
|
|
; |
4841 |
|
|
} |
4842 |
|
|
|
4843 |
|
|
## Remove the attribute node |
4844 |
|
|
CORE::delete $list->{$key}; |
4845 |
|
|
|
4846 |
|
|
|
4847 |
|
|
{ |
4848 |
|
|
|
4849 |
|
|
CORE::delete |
4850 |
|
|
$attr->{ |
4851 |
|
|
'b' |
4852 |
|
|
}->{${$attr->{ |
4853 |
|
|
'id' |
4854 |
|
|
}}} |
4855 |
|
|
->{'owner'}; |
4856 |
|
|
|
4857 |
|
|
|
4858 |
wakaba |
1.3 |
} |
4859 |
wakaba |
1.1 |
|
4860 |
|
|
; |
4861 |
|
|
|
4862 |
|
|
## Default attribute |
4863 |
|
|
my $doc = $self-> |
4864 |
|
|
owner_document |
4865 |
|
|
; |
4866 |
wakaba |
1.3 |
my $doc_cfg = $doc-> |
4867 |
|
|
dom_config |
4868 |
|
|
; |
4869 |
|
|
if ($doc_cfg-> |
4870 |
|
|
get_parameter |
4871 |
|
|
|
4872 |
|
|
( |
4873 |
|
|
'http://suika.fam.cx/www/2006/dom-config/dtd-default-attribute' |
4874 |
|
|
)) { |
4875 |
|
|
my $prefix; |
4876 |
|
|
|
4877 |
wakaba |
1.1 |
|
4878 |
|
|
{ |
4879 |
|
|
|
4880 |
|
|
|
4881 |
|
|
{ |
4882 |
|
|
|
4883 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4884 |
|
|
|
4885 |
|
|
{ |
4886 |
|
|
|
4887 |
|
|
|
4888 |
|
|
my |
4889 |
|
|
$__doctype = $doc-> |
4890 |
|
|
doctype |
4891 |
|
|
; |
4892 |
|
|
$__doctype = $__doctype-> |
4893 |
|
|
get_feature |
4894 |
|
|
( |
4895 |
|
|
'http://suika.fam.cx/www/2006/feature/XDoctype' |
4896 |
|
|
) |
4897 |
|
|
if $__doctype; |
4898 |
|
|
if (defined $__doctype) { |
4899 |
|
|
my $__et = $__doctype-> |
4900 |
|
|
get_element_type_definition_node |
4901 |
|
|
|
4902 |
|
|
($self->node_name); |
4903 |
|
|
if (defined $__et) { |
4904 |
|
|
my $__orig_strict = $doc-> |
4905 |
|
|
strict_error_checking |
4906 |
|
|
; |
4907 |
|
|
$doc-> |
4908 |
|
|
strict_error_checking |
4909 |
|
|
( |
4910 |
|
|
0 |
4911 |
|
|
); |
4912 |
|
|
|
4913 |
|
|
my $__at = $__et-> |
4914 |
|
|
get_attribute_definition_node |
4915 |
|
|
($name); |
4916 |
|
|
if (defined $__at) { |
4917 |
wakaba |
1.3 |
my $__copy_asis = $doc_cfg-> |
4918 |
wakaba |
1.1 |
get_parameter |
4919 |
|
|
|
4920 |
|
|
( |
4921 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
4922 |
|
|
); |
4923 |
wakaba |
1.3 |
$doc_cfg-> |
4924 |
wakaba |
1.1 |
set_parameter |
4925 |
|
|
|
4926 |
|
|
( |
4927 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
4928 |
|
|
=> |
4929 |
|
|
1 |
4930 |
|
|
); |
4931 |
|
|
ADD: { |
4932 |
|
|
my $__attr; |
4933 |
|
|
my $__attrs; |
4934 |
|
|
|
4935 |
|
|
|
4936 |
|
|
{ |
4937 |
|
|
|
4938 |
|
|
|
4939 |
|
|
$__attrs = $self->{ |
4940 |
|
|
'b' |
4941 |
|
|
}->{${$self->{ |
4942 |
|
|
'id' |
4943 |
|
|
}}} |
4944 |
|
|
->{'attr'}; |
4945 |
|
|
|
4946 |
|
|
|
4947 |
wakaba |
1.3 |
} |
4948 |
wakaba |
1.1 |
|
4949 |
|
|
; |
4950 |
|
|
if (defined $prefix) { ## prefixed attr |
4951 |
|
|
my $__nsuri = $self-> |
4952 |
|
|
lookup_namespace_uri |
4953 |
|
|
|
4954 |
|
|
($prefix); |
4955 |
|
|
unless (defined $__nsuri) { |
4956 |
|
|
## TODO: Namespace well-formedness error |
4957 |
|
|
} |
4958 |
|
|
if (defined $__attrs->{defined $__nsuri ? $__nsuri : ''} |
4959 |
|
|
->{$name}) { |
4960 |
|
|
## TODO: Namespace well-formedness warning? |
4961 |
|
|
last ADD; |
4962 |
|
|
} |
4963 |
|
|
$__attr = $doc-> |
4964 |
|
|
create_attribute_ns |
4965 |
|
|
|
4966 |
|
|
($__nsuri, [$prefix, $name]); |
4967 |
|
|
} else { ## local attr |
4968 |
|
|
if ($name eq 'xmlns') { |
4969 |
|
|
if (defined $__attrs->{ |
4970 |
|
|
'http://www.w3.org/2000/xmlns/' |
4971 |
|
|
}->{xmlns}) { |
4972 |
|
|
## TODO: Namespace well-formedness warning? |
4973 |
|
|
last ADD; |
4974 |
|
|
} |
4975 |
|
|
$__attr = $doc-> |
4976 |
|
|
create_attribute_ns |
4977 |
|
|
|
4978 |
|
|
( |
4979 |
|
|
'http://www.w3.org/2000/xmlns/' |
4980 |
|
|
, 'xmlns'); |
4981 |
|
|
} else { |
4982 |
|
|
if (defined $__attrs->{''}->{$name}) { |
4983 |
|
|
## TODO: Namespace well-formedness warning? |
4984 |
|
|
last ADD; |
4985 |
|
|
} |
4986 |
|
|
$__attr = $doc-> |
4987 |
|
|
create_attribute |
4988 |
|
|
($name); |
4989 |
|
|
} |
4990 |
|
|
} |
4991 |
|
|
for my $__at_child (@{$__at-> |
4992 |
|
|
child_nodes |
4993 |
|
|
}) { |
4994 |
|
|
$__attr-> |
4995 |
|
|
append_child |
4996 |
|
|
|
4997 |
|
|
($__at_child-> |
4998 |
|
|
clone_node |
4999 |
|
|
( |
5000 |
|
|
1 |
5001 |
|
|
)); |
5002 |
|
|
} |
5003 |
|
|
$__attr-> |
5004 |
|
|
manakai_attribute_type |
5005 |
|
|
|
5006 |
|
|
($__at-> |
5007 |
|
|
declared_type |
5008 |
|
|
); |
5009 |
|
|
$self-> |
5010 |
|
|
set_attribute_node_ns |
5011 |
|
|
($__attr); |
5012 |
|
|
## This method change the |specified| flag |
5013 |
|
|
$__attr-> |
5014 |
|
|
specified |
5015 |
|
|
( |
5016 |
|
|
0 |
5017 |
|
|
); |
5018 |
|
|
} # ADD |
5019 |
wakaba |
1.3 |
$doc_cfg-> |
5020 |
wakaba |
1.1 |
set_parameter |
5021 |
|
|
|
5022 |
|
|
( |
5023 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
5024 |
|
|
=> $__copy_asis); |
5025 |
|
|
} |
5026 |
|
|
$doc-> |
5027 |
|
|
strict_error_checking |
5028 |
|
|
($__orig_strict); |
5029 |
|
|
} # et |
5030 |
|
|
} # doctype |
5031 |
|
|
|
5032 |
|
|
|
5033 |
|
|
|
5034 |
wakaba |
1.3 |
} |
5035 |
wakaba |
1.1 |
|
5036 |
|
|
|
5037 |
|
|
;} |
5038 |
|
|
|
5039 |
|
|
; |
5040 |
|
|
|
5041 |
|
|
|
5042 |
wakaba |
1.3 |
} |
5043 |
wakaba |
1.1 |
|
5044 |
|
|
; |
5045 |
wakaba |
1.3 |
} |
5046 |
wakaba |
1.1 |
} # exists |
5047 |
|
|
|
5048 |
|
|
|
5049 |
wakaba |
1.3 |
} |
5050 |
wakaba |
1.1 |
} |
5051 |
|
|
sub remove_attribute_ns ($$$) { |
5052 |
|
|
my ($self, $namespaceURI, $localName) = @_; |
5053 |
|
|
|
5054 |
|
|
{ |
5055 |
|
|
|
5056 |
|
|
if |
5057 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
5058 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
5059 |
wakaba |
1.1 |
|
5060 |
wakaba |
1.9 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
5061 |
wakaba |
1.1 |
|
5062 |
|
|
; |
5063 |
|
|
|
5064 |
|
|
|
5065 |
|
|
|
5066 |
|
|
{ |
5067 |
|
|
|
5068 |
|
|
|
5069 |
|
|
$namespaceURI = undef; |
5070 |
|
|
|
5071 |
|
|
|
5072 |
|
|
|
5073 |
wakaba |
1.3 |
} |
5074 |
wakaba |
1.1 |
|
5075 |
|
|
; |
5076 |
|
|
} |
5077 |
|
|
|
5078 |
|
|
|
5079 |
wakaba |
1.3 |
} |
5080 |
wakaba |
1.1 |
|
5081 |
|
|
{ |
5082 |
|
|
|
5083 |
|
|
my |
5084 |
|
|
$list; |
5085 |
|
|
my $attr; |
5086 |
|
|
|
5087 |
|
|
|
5088 |
|
|
{ |
5089 |
|
|
|
5090 |
|
|
my |
5091 |
|
|
$__attrs; |
5092 |
|
|
|
5093 |
|
|
|
5094 |
|
|
{ |
5095 |
|
|
|
5096 |
|
|
|
5097 |
|
|
$__attrs = $self->{ |
5098 |
|
|
'b' |
5099 |
|
|
}->{${$self->{ |
5100 |
|
|
'id' |
5101 |
|
|
}}} |
5102 |
|
|
->{'attr'}; |
5103 |
|
|
|
5104 |
|
|
|
5105 |
wakaba |
1.3 |
} |
5106 |
wakaba |
1.1 |
|
5107 |
|
|
; |
5108 |
|
|
$list = $__attrs->{defined $namespaceURI ? $namespaceURI : ''}; |
5109 |
wakaba |
1.5 |
if (defined $list and defined $list->{$localName}) { |
5110 |
wakaba |
1.1 |
|
5111 |
|
|
|
5112 |
|
|
{ |
5113 |
|
|
|
5114 |
|
|
|
5115 |
|
|
$attr = ${($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
5116 |
|
|
->{$localName}}}->{ |
5117 |
|
|
'cls' |
5118 |
|
|
}}->___create_node_ref ({ |
5119 |
|
|
|
5120 |
|
|
'id' |
5121 |
|
|
=> $__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
5122 |
|
|
->{$localName}, |
5123 |
|
|
|
5124 |
|
|
'b' |
5125 |
|
|
=> ($self->{'b'}), |
5126 |
|
|
}, { |
5127 |
|
|
}); |
5128 |
|
|
($self->{'b'})->{${$__attrs->{defined $namespaceURI ? $namespaceURI : ''} |
5129 |
|
|
->{$localName}}}->{ |
5130 |
|
|
'rc' |
5131 |
|
|
}++; |
5132 |
|
|
|
5133 |
|
|
|
5134 |
wakaba |
1.3 |
} |
5135 |
wakaba |
1.1 |
|
5136 |
|
|
; |
5137 |
|
|
} |
5138 |
|
|
|
5139 |
|
|
|
5140 |
wakaba |
1.3 |
} |
5141 |
wakaba |
1.1 |
|
5142 |
|
|
; |
5143 |
|
|
if (defined $attr) { |
5144 |
|
|
if ($self-> |
5145 |
|
|
manakai_read_only |
5146 |
|
|
) { |
5147 |
|
|
|
5148 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'remove_attribute_ns', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
5149 |
|
|
|
5150 |
|
|
; |
5151 |
|
|
} |
5152 |
|
|
|
5153 |
|
|
## Removes the attribute node |
5154 |
|
|
CORE::delete $list->{$localName}; |
5155 |
|
|
|
5156 |
|
|
|
5157 |
|
|
{ |
5158 |
|
|
|
5159 |
|
|
CORE::delete |
5160 |
|
|
$attr->{ |
5161 |
|
|
'b' |
5162 |
|
|
}->{${$attr->{ |
5163 |
|
|
'id' |
5164 |
|
|
}}} |
5165 |
|
|
->{'owner'}; |
5166 |
|
|
|
5167 |
|
|
|
5168 |
wakaba |
1.3 |
} |
5169 |
wakaba |
1.1 |
|
5170 |
|
|
; |
5171 |
|
|
|
5172 |
|
|
## Default attribute |
5173 |
|
|
my $doc = $self-> |
5174 |
|
|
owner_document |
5175 |
|
|
; |
5176 |
wakaba |
1.3 |
my $doc_cfg = $doc-> |
5177 |
|
|
dom_config |
5178 |
|
|
; |
5179 |
|
|
if ($doc_cfg-> |
5180 |
|
|
get_parameter |
5181 |
|
|
|
5182 |
|
|
( |
5183 |
|
|
'http://suika.fam.cx/www/2006/dom-config/dtd-default-attribute' |
5184 |
|
|
)) { |
5185 |
|
|
my $pfx = $attr-> |
5186 |
|
|
prefix |
5187 |
|
|
; |
5188 |
|
|
my $name = defined $pfx ? $pfx.':'.$localName : $localName; |
5189 |
|
|
|
5190 |
wakaba |
1.1 |
|
5191 |
|
|
{ |
5192 |
|
|
|
5193 |
|
|
|
5194 |
|
|
{ |
5195 |
|
|
|
5196 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5197 |
|
|
|
5198 |
|
|
{ |
5199 |
|
|
|
5200 |
|
|
|
5201 |
|
|
my |
5202 |
|
|
$__doctype = $doc-> |
5203 |
|
|
doctype |
5204 |
|
|
; |
5205 |
|
|
$__doctype = $__doctype-> |
5206 |
|
|
get_feature |
5207 |
|
|
( |
5208 |
|
|
'http://suika.fam.cx/www/2006/feature/XDoctype' |
5209 |
|
|
) |
5210 |
|
|
if $__doctype; |
5211 |
|
|
if (defined $__doctype) { |
5212 |
|
|
my $__et = $__doctype-> |
5213 |
|
|
get_element_type_definition_node |
5214 |
|
|
|
5215 |
|
|
($self->node_name); |
5216 |
|
|
if (defined $__et) { |
5217 |
|
|
my $__orig_strict = $doc-> |
5218 |
|
|
strict_error_checking |
5219 |
|
|
; |
5220 |
|
|
$doc-> |
5221 |
|
|
strict_error_checking |
5222 |
|
|
( |
5223 |
|
|
0 |
5224 |
|
|
); |
5225 |
|
|
|
5226 |
|
|
my $__at = $__et-> |
5227 |
|
|
get_attribute_definition_node |
5228 |
|
|
($name); |
5229 |
|
|
if (defined $__at) { |
5230 |
wakaba |
1.3 |
my $__copy_asis = $doc_cfg-> |
5231 |
wakaba |
1.1 |
get_parameter |
5232 |
|
|
|
5233 |
|
|
( |
5234 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
5235 |
|
|
); |
5236 |
wakaba |
1.3 |
$doc_cfg-> |
5237 |
wakaba |
1.1 |
set_parameter |
5238 |
|
|
|
5239 |
|
|
( |
5240 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
5241 |
|
|
=> |
5242 |
|
|
1 |
5243 |
|
|
); |
5244 |
|
|
ADD: { |
5245 |
|
|
my $__attr; |
5246 |
|
|
my $__attrs; |
5247 |
|
|
|
5248 |
|
|
|
5249 |
|
|
{ |
5250 |
|
|
|
5251 |
|
|
|
5252 |
|
|
$__attrs = $self->{ |
5253 |
|
|
'b' |
5254 |
|
|
}->{${$self->{ |
5255 |
|
|
'id' |
5256 |
|
|
}}} |
5257 |
|
|
->{'attr'}; |
5258 |
|
|
|
5259 |
|
|
|
5260 |
wakaba |
1.3 |
} |
5261 |
wakaba |
1.1 |
|
5262 |
|
|
; |
5263 |
|
|
if (defined $pfx) { ## prefixed attr |
5264 |
|
|
my $__nsuri = $self-> |
5265 |
|
|
lookup_namespace_uri |
5266 |
|
|
|
5267 |
|
|
($pfx); |
5268 |
|
|
unless (defined $__nsuri) { |
5269 |
|
|
## TODO: Namespace well-formedness error |
5270 |
|
|
} |
5271 |
|
|
if (defined $__attrs->{defined $__nsuri ? $__nsuri : ''} |
5272 |
|
|
->{$localName}) { |
5273 |
|
|
## TODO: Namespace well-formedness warning? |
5274 |
|
|
last ADD; |
5275 |
|
|
} |
5276 |
|
|
$__attr = $doc-> |
5277 |
|
|
create_attribute_ns |
5278 |
|
|
|
5279 |
|
|
($__nsuri, [$pfx, $localName]); |
5280 |
|
|
} else { ## local attr |
5281 |
|
|
if ($name eq 'xmlns') { |
5282 |
|
|
if (defined $__attrs->{ |
5283 |
|
|
'http://www.w3.org/2000/xmlns/' |
5284 |
|
|
}->{xmlns}) { |
5285 |
|
|
## TODO: Namespace well-formedness warning? |
5286 |
|
|
last ADD; |
5287 |
|
|
} |
5288 |
|
|
$__attr = $doc-> |
5289 |
|
|
create_attribute_ns |
5290 |
|
|
|
5291 |
|
|
( |
5292 |
|
|
'http://www.w3.org/2000/xmlns/' |
5293 |
|
|
, 'xmlns'); |
5294 |
|
|
} else { |
5295 |
|
|
if (defined $__attrs->{''}->{$name}) { |
5296 |
|
|
## TODO: Namespace well-formedness warning? |
5297 |
|
|
last ADD; |
5298 |
|
|
} |
5299 |
|
|
$__attr = $doc-> |
5300 |
|
|
create_attribute |
5301 |
|
|
($name); |
5302 |
|
|
} |
5303 |
|
|
} |
5304 |
|
|
for my $__at_child (@{$__at-> |
5305 |
|
|
child_nodes |
5306 |
|
|
}) { |
5307 |
|
|
$__attr-> |
5308 |
|
|
append_child |
5309 |
|
|
|
5310 |
|
|
($__at_child-> |
5311 |
|
|
clone_node |
5312 |
|
|
( |
5313 |
|
|
1 |
5314 |
|
|
)); |
5315 |
|
|
} |
5316 |
|
|
$__attr-> |
5317 |
|
|
manakai_attribute_type |
5318 |
|
|
|
5319 |
|
|
($__at-> |
5320 |
|
|
declared_type |
5321 |
|
|
); |
5322 |
|
|
$self-> |
5323 |
|
|
set_attribute_node_ns |
5324 |
|
|
($__attr); |
5325 |
|
|
## This method change the |specified| flag |
5326 |
|
|
$__attr-> |
5327 |
|
|
specified |
5328 |
|
|
( |
5329 |
|
|
0 |
5330 |
|
|
); |
5331 |
|
|
} # ADD |
5332 |
wakaba |
1.3 |
$doc_cfg-> |
5333 |
wakaba |
1.1 |
set_parameter |
5334 |
|
|
|
5335 |
|
|
( |
5336 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
5337 |
|
|
=> $__copy_asis); |
5338 |
|
|
} |
5339 |
|
|
$doc-> |
5340 |
|
|
strict_error_checking |
5341 |
|
|
($__orig_strict); |
5342 |
|
|
} # et |
5343 |
|
|
} # doctype |
5344 |
|
|
|
5345 |
|
|
|
5346 |
|
|
|
5347 |
wakaba |
1.3 |
} |
5348 |
wakaba |
1.1 |
|
5349 |
|
|
|
5350 |
|
|
;} |
5351 |
|
|
|
5352 |
|
|
; |
5353 |
|
|
|
5354 |
|
|
|
5355 |
wakaba |
1.3 |
} |
5356 |
wakaba |
1.1 |
|
5357 |
|
|
; |
5358 |
wakaba |
1.3 |
} |
5359 |
wakaba |
1.1 |
} # exists |
5360 |
|
|
|
5361 |
|
|
|
5362 |
wakaba |
1.3 |
} |
5363 |
wakaba |
1.1 |
} |
5364 |
|
|
sub remove_attribute_node ($$) { |
5365 |
|
|
my ($self, $oldAttr) = @_; |
5366 |
|
|
my $r; |
5367 |
|
|
|
5368 |
|
|
{ |
5369 |
|
|
|
5370 |
|
|
my |
5371 |
|
|
$od = $self-> |
5372 |
|
|
owner_document |
5373 |
|
|
; |
5374 |
|
|
if ($od-> |
5375 |
|
|
strict_error_checking and |
5376 |
|
|
|
5377 |
|
|
$self-> |
5378 |
|
|
manakai_read_only |
5379 |
|
|
) { |
5380 |
|
|
|
5381 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'remove_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement'; |
5382 |
|
|
|
5383 |
|
|
; |
5384 |
|
|
} |
5385 |
|
|
|
5386 |
|
|
my $ln = $oldAttr-> |
5387 |
|
|
local_name |
5388 |
|
|
; |
5389 |
|
|
FIND: { |
5390 |
|
|
my $attrs; |
5391 |
|
|
|
5392 |
|
|
|
5393 |
|
|
{ |
5394 |
|
|
|
5395 |
|
|
|
5396 |
|
|
$attrs = $self->{ |
5397 |
|
|
'b' |
5398 |
|
|
}->{${$self->{ |
5399 |
|
|
'id' |
5400 |
|
|
}}} |
5401 |
|
|
->{'attr'}; |
5402 |
|
|
|
5403 |
|
|
|
5404 |
wakaba |
1.3 |
} |
5405 |
wakaba |
1.1 |
|
5406 |
|
|
; |
5407 |
|
|
my $nsuri = $oldAttr-> |
5408 |
|
|
namespace_uri |
5409 |
|
|
; |
5410 |
|
|
my $list = $attrs->{defined $nsuri ? $nsuri : ''}; |
5411 |
|
|
my $list_nid = $list->{$ln}; |
5412 |
|
|
if (defined $list_nid and |
5413 |
|
|
|
5414 |
|
|
(${$oldAttr->{'id'}} eq ${$list_nid}) |
5415 |
|
|
) { |
5416 |
|
|
CORE::delete $list->{$ln}; |
5417 |
|
|
last FIND; |
5418 |
|
|
} |
5419 |
|
|
|
5420 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'remove_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_ATTR_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldAttr; |
5421 |
|
|
|
5422 |
|
|
; |
5423 |
|
|
} # FIND |
5424 |
|
|
|
5425 |
|
|
|
5426 |
|
|
|
5427 |
|
|
{ |
5428 |
|
|
|
5429 |
|
|
CORE::delete |
5430 |
|
|
$oldAttr->{ |
5431 |
|
|
'b' |
5432 |
|
|
}->{${$oldAttr->{ |
5433 |
|
|
'id' |
5434 |
|
|
}}} |
5435 |
|
|
->{'owner'}; |
5436 |
|
|
|
5437 |
|
|
|
5438 |
wakaba |
1.3 |
} |
5439 |
wakaba |
1.1 |
|
5440 |
|
|
; |
5441 |
|
|
$r = $oldAttr; |
5442 |
|
|
|
5443 |
|
|
## Default attribute |
5444 |
wakaba |
1.3 |
my $doc_cfg = $od-> |
5445 |
|
|
dom_config |
5446 |
|
|
; |
5447 |
|
|
if ($doc_cfg-> |
5448 |
|
|
get_parameter |
5449 |
|
|
|
5450 |
|
|
( |
5451 |
|
|
'http://suika.fam.cx/www/2006/dom-config/dtd-default-attribute' |
5452 |
|
|
)) { |
5453 |
|
|
my $name = $oldAttr-> |
5454 |
wakaba |
1.1 |
node_name |
5455 |
|
|
; |
5456 |
wakaba |
1.3 |
my $pfx = $oldAttr-> |
5457 |
wakaba |
1.1 |
prefix |
5458 |
|
|
; |
5459 |
wakaba |
1.3 |
|
5460 |
wakaba |
1.1 |
|
5461 |
|
|
{ |
5462 |
|
|
|
5463 |
|
|
|
5464 |
|
|
{ |
5465 |
|
|
|
5466 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5467 |
|
|
|
5468 |
|
|
{ |
5469 |
|
|
|
5470 |
|
|
|
5471 |
|
|
my |
5472 |
|
|
$__doctype = $od-> |
5473 |
|
|
doctype |
5474 |
|
|
; |
5475 |
|
|
$__doctype = $__doctype-> |
5476 |
|
|
get_feature |
5477 |
|
|
( |
5478 |
|
|
'http://suika.fam.cx/www/2006/feature/XDoctype' |
5479 |
|
|
) |
5480 |
|
|
if $__doctype; |
5481 |
|
|
if (defined $__doctype) { |
5482 |
|
|
my $__et = $__doctype-> |
5483 |
|
|
get_element_type_definition_node |
5484 |
|
|
|
5485 |
|
|
($self->node_name); |
5486 |
|
|
if (defined $__et) { |
5487 |
|
|
my $__orig_strict = $od-> |
5488 |
|
|
strict_error_checking |
5489 |
|
|
; |
5490 |
|
|
$od-> |
5491 |
|
|
strict_error_checking |
5492 |
|
|
( |
5493 |
|
|
0 |
5494 |
|
|
); |
5495 |
|
|
|
5496 |
|
|
my $__at = $__et-> |
5497 |
|
|
get_attribute_definition_node |
5498 |
|
|
($name); |
5499 |
|
|
if (defined $__at) { |
5500 |
wakaba |
1.3 |
my $__copy_asis = $doc_cfg-> |
5501 |
wakaba |
1.1 |
get_parameter |
5502 |
|
|
|
5503 |
|
|
( |
5504 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
5505 |
|
|
); |
5506 |
wakaba |
1.3 |
$doc_cfg-> |
5507 |
wakaba |
1.1 |
set_parameter |
5508 |
|
|
|
5509 |
|
|
( |
5510 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
5511 |
|
|
=> |
5512 |
|
|
1 |
5513 |
|
|
); |
5514 |
|
|
ADD: { |
5515 |
|
|
my $__attr; |
5516 |
|
|
my $__attrs; |
5517 |
|
|
|
5518 |
|
|
|
5519 |
|
|
{ |
5520 |
|
|
|
5521 |
|
|
|
5522 |
|
|
$__attrs = $self->{ |
5523 |
|
|
'b' |
5524 |
|
|
}->{${$self->{ |
5525 |
|
|
'id' |
5526 |
|
|
}}} |
5527 |
|
|
->{'attr'}; |
5528 |
|
|
|
5529 |
|
|
|
5530 |
wakaba |
1.3 |
} |
5531 |
wakaba |
1.1 |
|
5532 |
|
|
; |
5533 |
|
|
if (defined $pfx) { ## prefixed attr |
5534 |
|
|
my $__nsuri = $self-> |
5535 |
|
|
lookup_namespace_uri |
5536 |
|
|
|
5537 |
|
|
($pfx); |
5538 |
|
|
unless (defined $__nsuri) { |
5539 |
|
|
## TODO: Namespace well-formedness error |
5540 |
|
|
} |
5541 |
|
|
if (defined $__attrs->{defined $__nsuri ? $__nsuri : ''} |
5542 |
|
|
->{$ln}) { |
5543 |
|
|
## TODO: Namespace well-formedness warning? |
5544 |
|
|
last ADD; |
5545 |
|
|
} |
5546 |
|
|
$__attr = $od-> |
5547 |
|
|
create_attribute_ns |
5548 |
|
|
|
5549 |
|
|
($__nsuri, [$pfx, $ln]); |
5550 |
|
|
} else { ## local attr |
5551 |
|
|
if ($name eq 'xmlns') { |
5552 |
|
|
if (defined $__attrs->{ |
5553 |
|
|
'http://www.w3.org/2000/xmlns/' |
5554 |
|
|
}->{xmlns}) { |
5555 |
|
|
## TODO: Namespace well-formedness warning? |
5556 |
|
|
last ADD; |
5557 |
|
|
} |
5558 |
|
|
$__attr = $od-> |
5559 |
|
|
create_attribute_ns |
5560 |
|
|
|
5561 |
|
|
( |
5562 |
|
|
'http://www.w3.org/2000/xmlns/' |
5563 |
|
|
, 'xmlns'); |
5564 |
|
|
} else { |
5565 |
|
|
if (defined $__attrs->{''}->{$name}) { |
5566 |
|
|
## TODO: Namespace well-formedness warning? |
5567 |
|
|
last ADD; |
5568 |
|
|
} |
5569 |
|
|
$__attr = $od-> |
5570 |
|
|
create_attribute |
5571 |
|
|
($name); |
5572 |
|
|
} |
5573 |
|
|
} |
5574 |
|
|
for my $__at_child (@{$__at-> |
5575 |
|
|
child_nodes |
5576 |
|
|
}) { |
5577 |
|
|
$__attr-> |
5578 |
|
|
append_child |
5579 |
|
|
|
5580 |
|
|
($__at_child-> |
5581 |
|
|
clone_node |
5582 |
|
|
( |
5583 |
|
|
1 |
5584 |
|
|
)); |
5585 |
|
|
} |
5586 |
|
|
$__attr-> |
5587 |
|
|
manakai_attribute_type |
5588 |
|
|
|
5589 |
|
|
($__at-> |
5590 |
|
|
declared_type |
5591 |
|
|
); |
5592 |
|
|
$self-> |
5593 |
|
|
set_attribute_node_ns |
5594 |
|
|
($__attr); |
5595 |
|
|
## This method change the |specified| flag |
5596 |
|
|
$__attr-> |
5597 |
|
|
specified |
5598 |
|
|
( |
5599 |
|
|
0 |
5600 |
|
|
); |
5601 |
|
|
} # ADD |
5602 |
wakaba |
1.3 |
$doc_cfg-> |
5603 |
wakaba |
1.1 |
set_parameter |
5604 |
|
|
|
5605 |
|
|
( |
5606 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
5607 |
|
|
=> $__copy_asis); |
5608 |
|
|
} |
5609 |
|
|
$od-> |
5610 |
|
|
strict_error_checking |
5611 |
|
|
($__orig_strict); |
5612 |
|
|
} # et |
5613 |
|
|
} # doctype |
5614 |
|
|
|
5615 |
|
|
|
5616 |
|
|
|
5617 |
wakaba |
1.3 |
} |
5618 |
wakaba |
1.1 |
|
5619 |
|
|
|
5620 |
|
|
;} |
5621 |
|
|
|
5622 |
|
|
; |
5623 |
|
|
|
5624 |
|
|
|
5625 |
wakaba |
1.3 |
} |
5626 |
wakaba |
1.1 |
|
5627 |
|
|
; |
5628 |
wakaba |
1.3 |
} |
5629 |
wakaba |
1.1 |
|
5630 |
|
|
|
5631 |
wakaba |
1.3 |
} |
5632 |
wakaba |
1.1 |
$r} |
5633 |
|
|
sub schema_type_info ($;$) { |
5634 |
|
|
if (@_ == 1) {my ($self) = @_; |
5635 |
|
|
my $r; |
5636 |
|
|
|
5637 |
|
|
{ |
5638 |
|
|
|
5639 |
|
|
|
5640 |
|
|
{ |
5641 |
|
|
|
5642 |
|
|
my |
5643 |
|
|
$v = 0 || 0; |
5644 |
|
|
$r = bless \$v, |
5645 |
|
|
'Message::DOM::DOMCore::ManakaiDOMDTDTypeInfo' |
5646 |
|
|
; |
5647 |
|
|
|
5648 |
|
|
|
5649 |
wakaba |
1.3 |
} |
5650 |
wakaba |
1.1 |
|
5651 |
|
|
; |
5652 |
|
|
|
5653 |
|
|
|
5654 |
wakaba |
1.3 |
} |
5655 |
wakaba |
1.1 |
$r; |
5656 |
|
|
} else {my ($self) = @_; |
5657 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'schema_type_info'; |
5658 |
|
|
} |
5659 |
|
|
} |
5660 |
|
|
sub get_elements_by_tag_name ($$) { |
5661 |
|
|
my ($self, $name) = @_; |
5662 |
|
|
my $r; |
5663 |
|
|
|
5664 |
|
|
{ |
5665 |
|
|
|
5666 |
|
|
|
5667 |
|
|
$name = "$name"; |
5668 |
|
|
my $chk; |
5669 |
|
|
if ($name eq '*') { |
5670 |
|
|
$chk = sub { |
5671 |
|
|
1 |
5672 |
|
|
}; |
5673 |
|
|
} else { |
5674 |
|
|
$chk = sub { |
5675 |
|
|
my $node = shift; |
5676 |
|
|
my $nodeName = $node-> |
5677 |
|
|
node_name |
5678 |
|
|
; |
5679 |
|
|
($nodeName eq $name); |
5680 |
|
|
}; |
5681 |
|
|
} |
5682 |
|
|
|
5683 |
|
|
|
5684 |
|
|
{ |
5685 |
|
|
|
5686 |
|
|
|
5687 |
|
|
$r = bless \[$self, $chk], |
5688 |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
5689 |
|
|
; |
5690 |
|
|
|
5691 |
|
|
|
5692 |
wakaba |
1.3 |
} |
5693 |
wakaba |
1.1 |
|
5694 |
|
|
; |
5695 |
|
|
|
5696 |
|
|
|
5697 |
wakaba |
1.3 |
} |
5698 |
wakaba |
1.1 |
$r} |
5699 |
|
|
sub get_elements_by_tag_name_ns ($$$) { |
5700 |
|
|
my ($self, $namespaceURI, $localName) = @_; |
5701 |
|
|
|
5702 |
|
|
{ |
5703 |
|
|
|
5704 |
|
|
if |
5705 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
5706 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
5707 |
wakaba |
1.1 |
|
5708 |
wakaba |
1.9 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
5709 |
wakaba |
1.1 |
|
5710 |
|
|
; |
5711 |
|
|
|
5712 |
|
|
|
5713 |
|
|
|
5714 |
|
|
{ |
5715 |
|
|
|
5716 |
|
|
|
5717 |
|
|
$namespaceURI = undef; |
5718 |
|
|
|
5719 |
|
|
|
5720 |
|
|
|
5721 |
wakaba |
1.3 |
} |
5722 |
wakaba |
1.1 |
|
5723 |
|
|
; |
5724 |
|
|
} |
5725 |
|
|
|
5726 |
|
|
|
5727 |
wakaba |
1.3 |
} |
5728 |
wakaba |
1.1 |
my $r; |
5729 |
|
|
|
5730 |
|
|
{ |
5731 |
|
|
|
5732 |
|
|
|
5733 |
|
|
$namespaceURI = "$namespaceURI" if defined $namespaceURI; |
5734 |
|
|
$localName = "$localName"; |
5735 |
|
|
my $chk; |
5736 |
|
|
if (not defined $namespaceURI) { |
5737 |
|
|
if ($localName eq '*') { |
5738 |
|
|
$chk = sub { |
5739 |
|
|
my $node = shift; |
5740 |
|
|
(not defined $node-> |
5741 |
|
|
namespace_uri |
5742 |
|
|
); |
5743 |
|
|
}; |
5744 |
|
|
} else { |
5745 |
|
|
$chk = sub { |
5746 |
|
|
my $node = shift; |
5747 |
|
|
(not defined $node-> |
5748 |
|
|
namespace_uri and |
5749 |
|
|
|
5750 |
|
|
$node-> |
5751 |
|
|
local_name eq |
5752 |
|
|
$localName); |
5753 |
|
|
}; |
5754 |
|
|
} |
5755 |
|
|
} elsif ($namespaceURI eq '*') { |
5756 |
|
|
if ($localName eq '*') { |
5757 |
|
|
$chk = sub { |
5758 |
|
|
1 |
5759 |
|
|
}; |
5760 |
|
|
} else { |
5761 |
|
|
$chk = sub { |
5762 |
|
|
my $node = shift; |
5763 |
|
|
($node-> |
5764 |
|
|
local_name eq |
5765 |
|
|
$localName); |
5766 |
|
|
}; |
5767 |
|
|
} |
5768 |
|
|
} else { |
5769 |
|
|
if ($localName eq '*') { |
5770 |
|
|
$chk = sub { |
5771 |
|
|
my $node = shift; |
5772 |
|
|
my $nsuri = $node-> |
5773 |
|
|
namespace_uri |
5774 |
|
|
; |
5775 |
|
|
(defined $nsuri and $nsuri eq $namespaceURI); |
5776 |
|
|
}; |
5777 |
|
|
} else { |
5778 |
|
|
$chk = sub { |
5779 |
|
|
my $node = shift; |
5780 |
|
|
my $nsuri = $node-> |
5781 |
|
|
namespace_uri |
5782 |
|
|
; |
5783 |
|
|
(defined $nsuri and $nsuri eq $namespaceURI and |
5784 |
|
|
$node-> |
5785 |
|
|
local_name eq |
5786 |
|
|
$localName); |
5787 |
|
|
}; |
5788 |
|
|
} |
5789 |
|
|
} |
5790 |
|
|
|
5791 |
|
|
|
5792 |
|
|
{ |
5793 |
|
|
|
5794 |
|
|
|
5795 |
|
|
$r = bless \[$self, $chk], |
5796 |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
5797 |
|
|
; |
5798 |
|
|
|
5799 |
|
|
|
5800 |
wakaba |
1.3 |
} |
5801 |
wakaba |
1.1 |
|
5802 |
|
|
; |
5803 |
|
|
|
5804 |
|
|
|
5805 |
wakaba |
1.3 |
} |
5806 |
wakaba |
1.1 |
$r} |
5807 |
|
|
sub manakai_base_uri ($;$) { |
5808 |
|
|
if (@_ == 1) {my ($self) = @_; |
5809 |
|
|
my $r = ''; |
5810 |
|
|
|
5811 |
|
|
{ |
5812 |
|
|
|
5813 |
|
|
|
5814 |
|
|
{ |
5815 |
|
|
|
5816 |
|
|
|
5817 |
wakaba |
1.2 |
$r = $self->{ |
5818 |
|
|
'b' |
5819 |
|
|
}->{${$self->{ |
5820 |
|
|
'id' |
5821 |
|
|
}}} |
5822 |
|
|
->{'buri'}; |
5823 |
wakaba |
1.1 |
|
5824 |
|
|
|
5825 |
wakaba |
1.3 |
} |
5826 |
wakaba |
1.1 |
|
5827 |
|
|
; |
5828 |
|
|
|
5829 |
|
|
|
5830 |
wakaba |
1.3 |
} |
5831 |
wakaba |
1.1 |
$r; |
5832 |
|
|
} else {my ($self, $given) = @_; |
5833 |
|
|
|
5834 |
|
|
{ |
5835 |
|
|
|
5836 |
|
|
|
5837 |
|
|
{ |
5838 |
|
|
|
5839 |
|
|
if |
5840 |
|
|
($self-> |
5841 |
|
|
manakai_read_only |
5842 |
|
|
) { |
5843 |
|
|
|
5844 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
5845 |
|
|
|
5846 |
|
|
; |
5847 |
|
|
} |
5848 |
|
|
|
5849 |
|
|
|
5850 |
wakaba |
1.3 |
} |
5851 |
wakaba |
1.1 |
|
5852 |
|
|
; |
5853 |
|
|
|
5854 |
|
|
|
5855 |
|
|
{ |
5856 |
|
|
|
5857 |
|
|
|
5858 |
|
|
$self->{ |
5859 |
|
|
'b' |
5860 |
|
|
}->{${$self->{ |
5861 |
|
|
'id' |
5862 |
|
|
}}} |
5863 |
|
|
->{'buri'} = $given; |
5864 |
|
|
|
5865 |
|
|
|
5866 |
wakaba |
1.3 |
} |
5867 |
wakaba |
1.1 |
|
5868 |
|
|
; |
5869 |
|
|
|
5870 |
|
|
|
5871 |
wakaba |
1.3 |
} |
5872 |
wakaba |
1.1 |
} |
5873 |
|
|
} |
5874 |
|
|
sub set_id_attribute ($$;$) { |
5875 |
|
|
my ($self, $name, $isId) = @_; |
5876 |
|
|
|
5877 |
|
|
{ |
5878 |
|
|
|
5879 |
|
|
|
5880 |
|
|
{ |
5881 |
|
|
|
5882 |
|
|
if |
5883 |
|
|
($self-> |
5884 |
|
|
manakai_read_only |
5885 |
|
|
) { |
5886 |
|
|
|
5887 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
5888 |
|
|
|
5889 |
|
|
; |
5890 |
|
|
} |
5891 |
|
|
|
5892 |
|
|
|
5893 |
wakaba |
1.3 |
} |
5894 |
wakaba |
1.1 |
|
5895 |
|
|
; |
5896 |
|
|
my $attr = $self-> |
5897 |
|
|
get_attribute_node |
5898 |
|
|
($name); |
5899 |
|
|
if (not defined $attr) { |
5900 |
|
|
|
5901 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_id_attribute', 'http://www.w3.org/2001/04/infoset#namespaceName' => undef, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NO_NAMED_NODE_NS_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'name', 'http://www.w3.org/2001/04/infoset#localName' => $name; |
5902 |
|
|
|
5903 |
|
|
; |
5904 |
|
|
} elsif ($attr-> |
5905 |
|
|
manakai_read_only |
5906 |
|
|
) { |
5907 |
|
|
|
5908 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_id_attribute', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_ATTR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'name', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $attr; |
5909 |
|
|
|
5910 |
|
|
; |
5911 |
|
|
} else { |
5912 |
|
|
$attr-> |
5913 |
|
|
is_id |
5914 |
|
|
($isId); |
5915 |
|
|
} |
5916 |
|
|
|
5917 |
|
|
|
5918 |
wakaba |
1.3 |
} |
5919 |
wakaba |
1.1 |
} |
5920 |
|
|
sub set_id_attribute_ns ($$$;$) { |
5921 |
|
|
my ($self, $namespaceURI, $localName, $isId) = @_; |
5922 |
|
|
|
5923 |
|
|
{ |
5924 |
|
|
|
5925 |
|
|
if |
5926 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
5927 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
5928 |
wakaba |
1.1 |
|
5929 |
wakaba |
1.9 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1162711890:16031:uDMne5008+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
5930 |
wakaba |
1.1 |
|
5931 |
|
|
; |
5932 |
|
|
|
5933 |
|
|
|
5934 |
|
|
|
5935 |
|
|
{ |
5936 |
|
|
|
5937 |
|
|
|
5938 |
|
|
$namespaceURI = undef; |
5939 |
|
|
|
5940 |
|
|
|
5941 |
|
|
|
5942 |
wakaba |
1.3 |
} |
5943 |
wakaba |
1.1 |
|
5944 |
|
|
; |
5945 |
|
|
} |
5946 |
|
|
|
5947 |
|
|
|
5948 |
wakaba |
1.3 |
} |
5949 |
wakaba |
1.1 |
|
5950 |
|
|
{ |
5951 |
|
|
|
5952 |
|
|
|
5953 |
|
|
{ |
5954 |
|
|
|
5955 |
|
|
if |
5956 |
|
|
($self-> |
5957 |
|
|
manakai_read_only |
5958 |
|
|
) { |
5959 |
|
|
|
5960 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
5961 |
|
|
|
5962 |
|
|
; |
5963 |
|
|
} |
5964 |
|
|
|
5965 |
|
|
|
5966 |
wakaba |
1.3 |
} |
5967 |
wakaba |
1.1 |
|
5968 |
|
|
; |
5969 |
|
|
my $attr = $self-> |
5970 |
|
|
get_attribute_node_ns |
5971 |
|
|
|
5972 |
|
|
($namespaceURI, $localName); |
5973 |
|
|
if (not defined $attr) { |
5974 |
|
|
|
5975 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_id_attribute_ns', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NO_NAMED_NODE_NS_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'name', 'http://www.w3.org/2001/04/infoset#localName' => $localName; |
5976 |
|
|
|
5977 |
|
|
; |
5978 |
|
|
} elsif ($attr-> |
5979 |
|
|
manakai_read_only |
5980 |
|
|
) { |
5981 |
|
|
|
5982 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_id_attribute_ns', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_ATTR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'name', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $attr; |
5983 |
|
|
|
5984 |
|
|
; |
5985 |
|
|
} else { |
5986 |
|
|
$attr-> |
5987 |
|
|
is_id |
5988 |
|
|
($isId); |
5989 |
|
|
} |
5990 |
|
|
|
5991 |
|
|
|
5992 |
wakaba |
1.3 |
} |
5993 |
wakaba |
1.1 |
} |
5994 |
|
|
sub set_id_attribute_node ($$;$) { |
5995 |
|
|
my ($self, $idAttr, $isId) = @_; |
5996 |
|
|
|
5997 |
|
|
{ |
5998 |
|
|
|
5999 |
|
|
|
6000 |
|
|
{ |
6001 |
|
|
|
6002 |
|
|
if |
6003 |
|
|
($self-> |
6004 |
|
|
manakai_read_only |
6005 |
|
|
) { |
6006 |
|
|
|
6007 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
6008 |
|
|
|
6009 |
|
|
; |
6010 |
|
|
} |
6011 |
|
|
|
6012 |
|
|
|
6013 |
wakaba |
1.3 |
} |
6014 |
wakaba |
1.1 |
|
6015 |
|
|
; |
6016 |
|
|
|
6017 |
|
|
my $owner = $idAttr-> |
6018 |
|
|
owner_element |
6019 |
|
|
; |
6020 |
|
|
if (not defined $owner or not $owner eq $self) { |
6021 |
|
|
|
6022 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_id_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_ATTR_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'idAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $idAttr; |
6023 |
|
|
|
6024 |
|
|
; |
6025 |
|
|
} elsif ($idAttr-> |
6026 |
|
|
manakai_read_only |
6027 |
|
|
) { |
6028 |
|
|
|
6029 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'set_id_attribute_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_ATTR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMElement', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'name', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $idAttr; |
6030 |
|
|
|
6031 |
|
|
; |
6032 |
|
|
} else { |
6033 |
|
|
$idAttr-> |
6034 |
|
|
is_id |
6035 |
|
|
($isId); |
6036 |
|
|
} |
6037 |
|
|
|
6038 |
|
|
|
6039 |
wakaba |
1.3 |
} |
6040 |
wakaba |
1.1 |
} |
6041 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMElement>}->{has_feature} = {'core', |
6042 |
|
|
{'', |
6043 |
|
|
'1', |
6044 |
|
|
'1.0', |
6045 |
|
|
'1', |
6046 |
|
|
'2.0', |
6047 |
|
|
'1', |
6048 |
|
|
'3.0', |
6049 |
|
|
'1'}, |
6050 |
|
|
'xml', |
6051 |
|
|
{'', |
6052 |
|
|
'1', |
6053 |
|
|
'1.0', |
6054 |
|
|
'1', |
6055 |
|
|
'2.0', |
6056 |
|
|
'1', |
6057 |
|
|
'3.0', |
6058 |
|
|
'1'}, |
6059 |
|
|
'xmlversion', |
6060 |
|
|
{'', |
6061 |
|
|
'1', |
6062 |
|
|
'1.0', |
6063 |
|
|
'1', |
6064 |
|
|
'1.1', |
6065 |
|
|
'1'}}; |
6066 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Element::ManakaiDOMElement>} = 14.1; |
6067 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMElement>}->{compat_class}->{q<Message::DOM::Element::ManakaiDOMElement>} = 1; |
6068 |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Element::ManakaiDOMElement>} = {'o0', |
6069 |
|
|
['parent'], |
6070 |
|
|
's1a', |
6071 |
|
|
['child'], |
6072 |
|
|
's2hh', |
6073 |
|
|
['attr'], |
6074 |
|
|
'w0', |
6075 |
|
|
['od']}; |
6076 |
|
|
package Message::DOM::IFLatest::Attr; |
6077 |
wakaba |
1.9 |
our $VERSION = 20061105.0823; |
6078 |
wakaba |
1.1 |
package Message::DOM::Element::ManakaiDOMAttr; |
6079 |
wakaba |
1.9 |
our $VERSION = 20061105.0823; |
6080 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
6081 |
|
|
'Message::DOM::IF::Attr', |
6082 |
|
|
'Message::DOM::IF::Node', |
6083 |
|
|
'Message::DOM::IFLatest::Attr', |
6084 |
|
|
'Message::DOM::IFLatest::Node', |
6085 |
|
|
'Message::DOM::IFLevel1::Attr', |
6086 |
|
|
'Message::DOM::IFLevel1::Node', |
6087 |
|
|
'Message::DOM::IFLevel2::Attr', |
6088 |
|
|
'Message::DOM::IFLevel2::Node', |
6089 |
|
|
'Message::DOM::IFLevel3::Attr', |
6090 |
|
|
'Message::DOM::IFLevel3::Node'; |
6091 |
|
|
use Char::Class::XML 'InXMLNameChar10', |
6092 |
|
|
'InXMLNameChar11', |
6093 |
|
|
'InXMLNameStartChar11', |
6094 |
|
|
'InXML_NameStartChar10'; |
6095 |
|
|
sub ___create_node_stem ($$$$) { |
6096 |
|
|
my ($self, $bag, $obj, $opt) = @_; |
6097 |
|
|
my $r = {}; |
6098 |
|
|
|
6099 |
|
|
{ |
6100 |
|
|
|
6101 |
|
|
|
6102 |
|
|
$obj->{ |
6103 |
|
|
'child' |
6104 |
|
|
} = []; |
6105 |
|
|
|
6106 |
|
|
|
6107 |
|
|
{ |
6108 |
|
|
|
6109 |
|
|
if |
6110 |
|
|
(defined ${$opt->{'ns'}}) { |
6111 |
|
|
if (ref ${$opt->{'ns'}} eq 'SCALAR') { |
6112 |
|
|
$obj->{'ns'} = ${$opt->{'ns'}}; |
6113 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}) { |
6114 |
|
|
$obj->{'ns'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}; |
6115 |
|
|
} else { |
6116 |
|
|
require Scalar::Util; |
6117 |
|
|
$obj->{'ns'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}} = \(${$opt->{'ns'}}); |
6118 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}); |
6119 |
|
|
} |
6120 |
|
|
} else { |
6121 |
|
|
CORE::delete $obj->{'ns'}; |
6122 |
|
|
} |
6123 |
|
|
|
6124 |
|
|
|
6125 |
wakaba |
1.3 |
} |
6126 |
wakaba |
1.9 |
|
6127 |
wakaba |
1.1 |
; |
6128 |
wakaba |
1.9 |
|
6129 |
wakaba |
1.1 |
|
6130 |
|
|
{ |
6131 |
|
|
|
6132 |
wakaba |
1.9 |
if |
6133 |
|
|
(defined ${$opt->{'pfx'}}) { |
6134 |
|
|
if (ref ${$opt->{'pfx'}} eq 'SCALAR') { |
6135 |
|
|
$obj->{'pfx'} = ${$opt->{'pfx'}}; |
6136 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}) { |
6137 |
|
|
$obj->{'pfx'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}; |
6138 |
|
|
} else { |
6139 |
|
|
require Scalar::Util; |
6140 |
|
|
$obj->{'pfx'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}} = \(${$opt->{'pfx'}}); |
6141 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}); |
6142 |
|
|
} |
6143 |
|
|
} else { |
6144 |
|
|
CORE::delete $obj->{'pfx'}; |
6145 |
|
|
} |
6146 |
wakaba |
1.1 |
|
6147 |
|
|
|
6148 |
wakaba |
1.3 |
} |
6149 |
wakaba |
1.1 |
|
6150 |
|
|
; |
6151 |
wakaba |
1.9 |
|
6152 |
wakaba |
1.1 |
|
6153 |
|
|
{ |
6154 |
|
|
|
6155 |
wakaba |
1.9 |
if |
6156 |
|
|
(defined ${$opt->{'ln'}}) { |
6157 |
|
|
if (ref ${$opt->{'ln'}} eq 'SCALAR') { |
6158 |
|
|
$obj->{'ln'} = ${$opt->{'ln'}}; |
6159 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}) { |
6160 |
|
|
$obj->{'ln'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}; |
6161 |
|
|
} else { |
6162 |
|
|
require Scalar::Util; |
6163 |
|
|
$obj->{'ln'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}} = \(${$opt->{'ln'}}); |
6164 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}); |
6165 |
|
|
} |
6166 |
|
|
} else { |
6167 |
|
|
CORE::delete $obj->{'ln'}; |
6168 |
|
|
} |
6169 |
wakaba |
1.1 |
|
6170 |
|
|
|
6171 |
wakaba |
1.3 |
} |
6172 |
wakaba |
1.1 |
|
6173 |
|
|
; |
6174 |
wakaba |
1.9 |
$obj->{ |
6175 |
|
|
'specified' |
6176 |
|
|
} = $opt->{ |
6177 |
|
|
'specified' |
6178 |
|
|
}; |
6179 |
wakaba |
1.1 |
|
6180 |
|
|
|
6181 |
|
|
{ |
6182 |
|
|
|
6183 |
|
|
|
6184 |
wakaba |
1.9 |
$obj->{'od'} = $opt->{'od'}->{ |
6185 |
|
|
'id' |
6186 |
|
|
}; |
6187 |
|
|
$bag->{${$opt->{'od'}->{ |
6188 |
|
|
'id' |
6189 |
|
|
}}} |
6190 |
|
|
->{'do'}->{${$obj->{ |
6191 |
wakaba |
1.1 |
'id' |
6192 |
|
|
}}} |
6193 |
wakaba |
1.9 |
= $obj->{ |
6194 |
|
|
'id' |
6195 |
|
|
}; |
6196 |
wakaba |
1.1 |
|
6197 |
|
|
|
6198 |
wakaba |
1.3 |
} |
6199 |
wakaba |
1.1 |
|
6200 |
|
|
; |
6201 |
wakaba |
1.9 |
$r = $obj; |
6202 |
wakaba |
1.1 |
|
6203 |
|
|
|
6204 |
wakaba |
1.3 |
} |
6205 |
wakaba |
1.1 |
$r} |
6206 |
|
|
sub node_type ($;$) { |
6207 |
|
|
if (@_ == 1) {my ($self) = @_; |
6208 |
|
|
my $r; |
6209 |
wakaba |
1.6 |
$r = 2; |
6210 |
wakaba |
1.1 |
$r; |
6211 |
|
|
} else {my ($self) = @_; |
6212 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
6213 |
|
|
} |
6214 |
|
|
} |
6215 |
|
|
sub prefix ($;$) { |
6216 |
|
|
if (@_ == 1) {my ($self) = @_; |
6217 |
|
|
my $r = ''; |
6218 |
|
|
|
6219 |
|
|
{ |
6220 |
|
|
|
6221 |
|
|
my |
6222 |
|
|
$v; |
6223 |
|
|
|
6224 |
|
|
|
6225 |
|
|
{ |
6226 |
|
|
|
6227 |
|
|
|
6228 |
|
|
$v = $self->{ |
6229 |
|
|
'b' |
6230 |
|
|
}->{${$self->{ |
6231 |
|
|
'id' |
6232 |
|
|
}}} |
6233 |
|
|
->{'pfx'}; |
6234 |
|
|
|
6235 |
|
|
|
6236 |
wakaba |
1.3 |
} |
6237 |
wakaba |
1.1 |
|
6238 |
|
|
; |
6239 |
|
|
$r = defined $v ? $$v : |
6240 |
|
|
undef |
6241 |
|
|
; |
6242 |
|
|
|
6243 |
|
|
|
6244 |
wakaba |
1.3 |
} |
6245 |
wakaba |
1.1 |
$r; |
6246 |
|
|
} else {my ($self, $given) = @_; |
6247 |
|
|
|
6248 |
|
|
{ |
6249 |
|
|
|
6250 |
|
|
my |
6251 |
|
|
$od = $self-> |
6252 |
|
|
owner_document |
6253 |
|
|
; |
6254 |
|
|
if ($od-> |
6255 |
|
|
strict_error_checking |
6256 |
|
|
) { |
6257 |
|
|
|
6258 |
|
|
|
6259 |
|
|
{ |
6260 |
|
|
|
6261 |
|
|
if |
6262 |
|
|
($self-> |
6263 |
|
|
manakai_read_only |
6264 |
|
|
) { |
6265 |
|
|
|
6266 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
6267 |
|
|
|
6268 |
|
|
; |
6269 |
|
|
} |
6270 |
|
|
|
6271 |
|
|
|
6272 |
wakaba |
1.3 |
} |
6273 |
wakaba |
1.1 |
|
6274 |
|
|
; |
6275 |
|
|
my $nsuri; |
6276 |
|
|
|
6277 |
|
|
|
6278 |
|
|
{ |
6279 |
|
|
|
6280 |
|
|
|
6281 |
|
|
$nsuri = $self->{ |
6282 |
|
|
'b' |
6283 |
|
|
}->{${$self->{ |
6284 |
|
|
'id' |
6285 |
|
|
}}} |
6286 |
|
|
->{'ns'}; |
6287 |
|
|
|
6288 |
|
|
|
6289 |
wakaba |
1.3 |
} |
6290 |
wakaba |
1.1 |
|
6291 |
|
|
; |
6292 |
|
|
if (not defined $nsuri) { |
6293 |
|
|
|
6294 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => undef, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://www.w3.org/2001/04/infoset#prefix' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_PREFIX_WITH_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'prefix'; |
6295 |
|
|
|
6296 |
|
|
; |
6297 |
|
|
} elsif ($$nsuri ne |
6298 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
6299 |
|
|
|
6300 |
|
|
defined $given and $given eq 'xml') { |
6301 |
|
|
|
6302 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $self->namespace_uri, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://www.w3.org/2001/04/infoset#prefix' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XML_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'prefix'; |
6303 |
|
|
|
6304 |
|
|
; |
6305 |
|
|
} elsif ($$nsuri ne |
6306 |
|
|
'http://www.w3.org/2000/xmlns/' and |
6307 |
|
|
|
6308 |
|
|
defined $given and $given eq 'xmlns') { |
6309 |
|
|
|
6310 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $self->namespace_uri, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://www.w3.org/2001/04/infoset#prefix' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XMLNS_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'prefix'; |
6311 |
|
|
|
6312 |
|
|
; |
6313 |
|
|
} elsif ($self-> |
6314 |
|
|
node_name eq |
6315 |
|
|
'xmlns') { |
6316 |
|
|
|
6317 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $self->namespace_uri, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://www.w3.org/2001/04/infoset#prefix' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_QNAME_IS_XMLNS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'prefix'; |
6318 |
|
|
|
6319 |
|
|
; |
6320 |
|
|
} |
6321 |
|
|
my $version = $od-> |
6322 |
|
|
xml_version |
6323 |
|
|
; |
6324 |
|
|
|
6325 |
|
|
|
6326 |
|
|
{ |
6327 |
|
|
|
6328 |
|
|
if |
6329 |
|
|
(defined $given and $given eq '') { |
6330 |
wakaba |
1.9 |
require Message::DOM::DOMMain; |
6331 |
wakaba |
1.1 |
|
6332 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-prefix', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureNamespacePrefix+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
6333 |
|
|
|
6334 |
|
|
; |
6335 |
|
|
undef $given; |
6336 |
|
|
} |
6337 |
|
|
if (defined $given) { |
6338 |
|
|
if (($version eq '1.0' and |
6339 |
|
|
not |
6340 |
|
|
($given =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
6341 |
|
|
) or |
6342 |
|
|
($version eq '1.1' and |
6343 |
|
|
not |
6344 |
|
|
($given =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
6345 |
|
|
)) { |
6346 |
|
|
|
6347 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://www.w3.org/2001/04/infoset#name' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureNamespacePrefix+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
6348 |
|
|
|
6349 |
|
|
; |
6350 |
|
|
} elsif (index ($given, ':') > -1) { |
6351 |
|
|
|
6352 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#name' => $given, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_BAD_NCNAME', 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureNamespacePrefix+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
6353 |
|
|
|
6354 |
|
|
; |
6355 |
|
|
} |
6356 |
|
|
} # has prefix |
6357 |
|
|
|
6358 |
|
|
|
6359 |
wakaba |
1.3 |
} |
6360 |
wakaba |
1.1 |
|
6361 |
|
|
; |
6362 |
|
|
} # strict |
6363 |
|
|
my $v = defined $given ? \$given : |
6364 |
|
|
undef |
6365 |
|
|
; |
6366 |
|
|
|
6367 |
|
|
|
6368 |
|
|
{ |
6369 |
|
|
|
6370 |
|
|
|
6371 |
|
|
$self->{ |
6372 |
|
|
'b' |
6373 |
|
|
}->{${$self->{ |
6374 |
|
|
'id' |
6375 |
|
|
}}} |
6376 |
|
|
->{'pfx'} = $v; |
6377 |
|
|
|
6378 |
|
|
|
6379 |
wakaba |
1.3 |
} |
6380 |
wakaba |
1.1 |
|
6381 |
|
|
; |
6382 |
|
|
|
6383 |
|
|
|
6384 |
wakaba |
1.3 |
} |
6385 |
wakaba |
1.1 |
} |
6386 |
|
|
} |
6387 |
|
|
sub append_child ($$) { |
6388 |
|
|
my ($self, $newChild) = @_; |
6389 |
|
|
my $r; |
6390 |
|
|
|
6391 |
|
|
{ |
6392 |
|
|
|
6393 |
|
|
my |
6394 |
|
|
$self_od = $self-> |
6395 |
|
|
owner_document |
6396 |
|
|
; |
6397 |
|
|
my $child_od = $newChild-> |
6398 |
|
|
owner_document |
6399 |
|
|
; |
6400 |
|
|
my $child_nt = $newChild-> |
6401 |
|
|
node_type |
6402 |
|
|
; |
6403 |
|
|
|
6404 |
|
|
|
6405 |
|
|
{ |
6406 |
|
|
|
6407 |
|
|
|
6408 |
|
|
{ |
6409 |
|
|
|
6410 |
|
|
local $Error::Depth = $Error::Depth + 1; |
6411 |
|
|
|
6412 |
|
|
{ |
6413 |
|
|
|
6414 |
|
|
|
6415 |
|
|
my |
6416 |
|
|
$strict = $self_od-> |
6417 |
|
|
strict_error_checking |
6418 |
|
|
; |
6419 |
|
|
|
6420 |
|
|
## -- Node Type check |
6421 |
|
|
my @new_child; |
6422 |
|
|
if ({ |
6423 |
wakaba |
1.6 |
3 => 1, |
6424 |
|
|
5 => 1, |
6425 |
wakaba |
1.1 |
}->{$child_nt}) { |
6426 |
|
|
push @new_child, $newChild; |
6427 |
|
|
} elsif ($child_nt == |
6428 |
wakaba |
1.6 |
11 |
6429 |
wakaba |
1.1 |
) { |
6430 |
|
|
for my $cn (@{$newChild-> |
6431 |
|
|
child_nodes |
6432 |
|
|
}) { |
6433 |
|
|
unless ({ |
6434 |
wakaba |
1.6 |
3 => 1, |
6435 |
|
|
5 => 1, |
6436 |
wakaba |
1.1 |
}->{$cn-> |
6437 |
|
|
node_type |
6438 |
|
|
}) { |
6439 |
|
|
|
6440 |
|
|
|
6441 |
|
|
{ |
6442 |
|
|
|
6443 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6444 |
|
|
|
6445 |
|
|
{ |
6446 |
|
|
|
6447 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
6448 |
|
|
|
6449 |
|
|
|
6450 |
wakaba |
1.3 |
} |
6451 |
wakaba |
1.1 |
|
6452 |
|
|
|
6453 |
|
|
;} |
6454 |
|
|
|
6455 |
|
|
; |
6456 |
|
|
} |
6457 |
|
|
push @new_child, $cn; |
6458 |
|
|
} |
6459 |
|
|
} else { |
6460 |
|
|
|
6461 |
|
|
|
6462 |
|
|
{ |
6463 |
|
|
|
6464 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6465 |
|
|
|
6466 |
|
|
{ |
6467 |
|
|
|
6468 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
6469 |
|
|
|
6470 |
|
|
|
6471 |
wakaba |
1.3 |
} |
6472 |
wakaba |
1.1 |
|
6473 |
|
|
|
6474 |
|
|
;} |
6475 |
|
|
|
6476 |
|
|
; |
6477 |
|
|
} |
6478 |
|
|
|
6479 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
6480 |
|
|
parent_node |
6481 |
|
|
: |
6482 |
|
|
|
6483 |
|
|
undef |
6484 |
|
|
; |
6485 |
|
|
if ($strict) { |
6486 |
|
|
## -- Wrong-document check |
6487 |
|
|
unless ($self_od eq $child_od) { |
6488 |
|
|
|
6489 |
|
|
|
6490 |
|
|
{ |
6491 |
|
|
|
6492 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6493 |
|
|
|
6494 |
|
|
{ |
6495 |
|
|
|
6496 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
6497 |
|
|
|
6498 |
|
|
|
6499 |
wakaba |
1.3 |
} |
6500 |
wakaba |
1.1 |
|
6501 |
|
|
|
6502 |
|
|
;} |
6503 |
|
|
|
6504 |
|
|
; |
6505 |
|
|
} |
6506 |
|
|
|
6507 |
|
|
## -- Read-onlyness check |
6508 |
|
|
if ($self-> |
6509 |
|
|
manakai_read_only |
6510 |
|
|
) { |
6511 |
|
|
|
6512 |
|
|
|
6513 |
|
|
{ |
6514 |
|
|
|
6515 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6516 |
|
|
|
6517 |
|
|
{ |
6518 |
|
|
|
6519 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
6520 |
|
|
|
6521 |
|
|
|
6522 |
wakaba |
1.3 |
} |
6523 |
wakaba |
1.1 |
|
6524 |
|
|
|
6525 |
|
|
;} |
6526 |
|
|
|
6527 |
|
|
; |
6528 |
|
|
} |
6529 |
|
|
if (@new_child) { |
6530 |
|
|
if ($nc_parent and |
6531 |
|
|
$nc_parent-> |
6532 |
|
|
manakai_read_only |
6533 |
|
|
) { |
6534 |
|
|
|
6535 |
|
|
|
6536 |
|
|
{ |
6537 |
|
|
|
6538 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6539 |
|
|
|
6540 |
|
|
{ |
6541 |
|
|
|
6542 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
6543 |
|
|
|
6544 |
|
|
|
6545 |
wakaba |
1.3 |
} |
6546 |
wakaba |
1.1 |
|
6547 |
|
|
|
6548 |
|
|
;} |
6549 |
|
|
|
6550 |
|
|
; |
6551 |
|
|
} |
6552 |
|
|
} |
6553 |
|
|
} |
6554 |
|
|
|
6555 |
|
|
## -- Insert at... |
6556 |
|
|
my $index = -1; # last |
6557 |
|
|
|
6558 |
|
|
|
6559 |
|
|
; # FOR !tc:ForAppendChild |
6560 |
|
|
|
6561 |
|
|
## -- Removes from parent |
6562 |
|
|
if ($nc_parent) { |
6563 |
|
|
if ($child_nt == |
6564 |
wakaba |
1.6 |
11 |
6565 |
wakaba |
1.1 |
) { |
6566 |
|
|
|
6567 |
|
|
|
6568 |
|
|
{ |
6569 |
|
|
|
6570 |
|
|
|
6571 |
|
|
$newChild->{ |
6572 |
|
|
'b' |
6573 |
|
|
}->{${$newChild->{ |
6574 |
|
|
'id' |
6575 |
|
|
}}} |
6576 |
|
|
->{'child'} = []; |
6577 |
|
|
|
6578 |
|
|
|
6579 |
wakaba |
1.3 |
} |
6580 |
wakaba |
1.1 |
|
6581 |
|
|
; |
6582 |
|
|
} else { |
6583 |
|
|
my $v; |
6584 |
|
|
|
6585 |
|
|
|
6586 |
|
|
{ |
6587 |
|
|
|
6588 |
|
|
|
6589 |
|
|
$v = $nc_parent->{ |
6590 |
|
|
'b' |
6591 |
|
|
}->{${$nc_parent->{ |
6592 |
|
|
'id' |
6593 |
|
|
}}} |
6594 |
|
|
->{'child'}; |
6595 |
|
|
|
6596 |
|
|
|
6597 |
wakaba |
1.3 |
} |
6598 |
wakaba |
1.1 |
|
6599 |
|
|
; |
6600 |
|
|
RP: for my $i (0..$#$v) { |
6601 |
|
|
my $nodeid = $v->[$i]; |
6602 |
|
|
if ( |
6603 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
6604 |
|
|
) { |
6605 |
|
|
splice @$v, $i, 1, (); |
6606 |
|
|
last RP; |
6607 |
|
|
} |
6608 |
|
|
} # RP |
6609 |
|
|
} |
6610 |
|
|
} |
6611 |
|
|
|
6612 |
|
|
## -- Rewrite the |parentNode| properties |
6613 |
|
|
for my $nc (@new_child) { |
6614 |
|
|
|
6615 |
|
|
|
6616 |
|
|
{ |
6617 |
|
|
|
6618 |
|
|
|
6619 |
|
|
$nc->{ |
6620 |
|
|
'b' |
6621 |
|
|
}->{${$nc->{ |
6622 |
|
|
'id' |
6623 |
|
|
}}} |
6624 |
|
|
->{'parent'} = $self->{ |
6625 |
|
|
'id' |
6626 |
|
|
}; |
6627 |
|
|
|
6628 |
|
|
|
6629 |
wakaba |
1.3 |
} |
6630 |
wakaba |
1.1 |
|
6631 |
|
|
; |
6632 |
|
|
} |
6633 |
|
|
|
6634 |
|
|
my $children; |
6635 |
|
|
|
6636 |
|
|
|
6637 |
|
|
{ |
6638 |
|
|
|
6639 |
|
|
|
6640 |
|
|
$children = $self->{ |
6641 |
|
|
'b' |
6642 |
|
|
}->{${$self->{ |
6643 |
|
|
'id' |
6644 |
|
|
}}} |
6645 |
|
|
->{'child'}; |
6646 |
|
|
|
6647 |
|
|
|
6648 |
wakaba |
1.3 |
} |
6649 |
wakaba |
1.1 |
|
6650 |
|
|
; |
6651 |
|
|
|
6652 |
|
|
|
6653 |
|
|
|
6654 |
|
|
{ |
6655 |
|
|
|
6656 |
|
|
|
6657 |
|
|
## -- Adds to children list |
6658 |
|
|
push @$children, map { |
6659 |
|
|
|
6660 |
|
|
$_->{'id'} |
6661 |
|
|
|
6662 |
|
|
} @new_child; |
6663 |
|
|
$r = $newChild; |
6664 |
|
|
|
6665 |
|
|
|
6666 |
|
|
|
6667 |
wakaba |
1.3 |
} |
6668 |
wakaba |
1.1 |
|
6669 |
|
|
; |
6670 |
|
|
|
6671 |
|
|
|
6672 |
|
|
|
6673 |
|
|
; |
6674 |
|
|
|
6675 |
|
|
|
6676 |
|
|
|
6677 |
|
|
; |
6678 |
|
|
|
6679 |
|
|
|
6680 |
|
|
|
6681 |
wakaba |
1.3 |
} |
6682 |
wakaba |
1.1 |
|
6683 |
|
|
|
6684 |
|
|
;} |
6685 |
|
|
|
6686 |
|
|
; |
6687 |
|
|
|
6688 |
|
|
|
6689 |
wakaba |
1.3 |
} |
6690 |
wakaba |
1.1 |
|
6691 |
|
|
; |
6692 |
|
|
|
6693 |
|
|
|
6694 |
wakaba |
1.3 |
} |
6695 |
wakaba |
1.1 |
$r} |
6696 |
|
|
sub insert_before ($$;$) { |
6697 |
|
|
my ($self, $newChild, $refChild) = @_; |
6698 |
|
|
my $r; |
6699 |
|
|
|
6700 |
|
|
{ |
6701 |
|
|
|
6702 |
|
|
my |
6703 |
|
|
$self_od = $self-> |
6704 |
|
|
owner_document |
6705 |
|
|
; |
6706 |
|
|
my $child_od = $newChild-> |
6707 |
|
|
owner_document |
6708 |
|
|
; |
6709 |
|
|
my $child_nt = $newChild-> |
6710 |
|
|
node_type |
6711 |
|
|
; |
6712 |
|
|
|
6713 |
|
|
|
6714 |
|
|
{ |
6715 |
|
|
|
6716 |
|
|
|
6717 |
|
|
{ |
6718 |
|
|
|
6719 |
|
|
local $Error::Depth = $Error::Depth + 1; |
6720 |
|
|
|
6721 |
|
|
{ |
6722 |
|
|
|
6723 |
|
|
|
6724 |
|
|
my |
6725 |
|
|
$strict = $self_od-> |
6726 |
|
|
strict_error_checking |
6727 |
|
|
; |
6728 |
|
|
|
6729 |
|
|
## -- Node Type check |
6730 |
|
|
my @new_child; |
6731 |
|
|
if ({ |
6732 |
wakaba |
1.6 |
3 => 1, |
6733 |
|
|
5 => 1, |
6734 |
wakaba |
1.1 |
}->{$child_nt}) { |
6735 |
|
|
push @new_child, $newChild; |
6736 |
|
|
} elsif ($child_nt == |
6737 |
wakaba |
1.6 |
11 |
6738 |
wakaba |
1.1 |
) { |
6739 |
|
|
for my $cn (@{$newChild-> |
6740 |
|
|
child_nodes |
6741 |
|
|
}) { |
6742 |
|
|
unless ({ |
6743 |
wakaba |
1.6 |
3 => 1, |
6744 |
|
|
5 => 1, |
6745 |
wakaba |
1.1 |
}->{$cn-> |
6746 |
|
|
node_type |
6747 |
|
|
}) { |
6748 |
|
|
|
6749 |
|
|
|
6750 |
|
|
{ |
6751 |
|
|
|
6752 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6753 |
|
|
|
6754 |
|
|
{ |
6755 |
|
|
|
6756 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
6757 |
|
|
|
6758 |
|
|
|
6759 |
wakaba |
1.3 |
} |
6760 |
wakaba |
1.1 |
|
6761 |
|
|
|
6762 |
|
|
;} |
6763 |
|
|
|
6764 |
|
|
; |
6765 |
|
|
} |
6766 |
|
|
push @new_child, $cn; |
6767 |
|
|
} |
6768 |
|
|
} else { |
6769 |
|
|
|
6770 |
|
|
|
6771 |
|
|
{ |
6772 |
|
|
|
6773 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6774 |
|
|
|
6775 |
|
|
{ |
6776 |
|
|
|
6777 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
6778 |
|
|
|
6779 |
|
|
|
6780 |
wakaba |
1.3 |
} |
6781 |
wakaba |
1.1 |
|
6782 |
|
|
|
6783 |
|
|
;} |
6784 |
|
|
|
6785 |
|
|
; |
6786 |
|
|
} |
6787 |
|
|
|
6788 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
6789 |
|
|
parent_node |
6790 |
|
|
: |
6791 |
|
|
|
6792 |
|
|
undef |
6793 |
|
|
; |
6794 |
|
|
if ($strict) { |
6795 |
|
|
## -- Wrong-document check |
6796 |
|
|
unless ($self_od eq $child_od) { |
6797 |
|
|
|
6798 |
|
|
|
6799 |
|
|
{ |
6800 |
|
|
|
6801 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6802 |
|
|
|
6803 |
|
|
{ |
6804 |
|
|
|
6805 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
6806 |
|
|
|
6807 |
|
|
|
6808 |
wakaba |
1.3 |
} |
6809 |
wakaba |
1.1 |
|
6810 |
|
|
|
6811 |
|
|
;} |
6812 |
|
|
|
6813 |
|
|
; |
6814 |
|
|
} |
6815 |
|
|
|
6816 |
|
|
## -- Read-onlyness check |
6817 |
|
|
if ($self-> |
6818 |
|
|
manakai_read_only |
6819 |
|
|
) { |
6820 |
|
|
|
6821 |
|
|
|
6822 |
|
|
{ |
6823 |
|
|
|
6824 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6825 |
|
|
|
6826 |
|
|
{ |
6827 |
|
|
|
6828 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
6829 |
|
|
|
6830 |
|
|
|
6831 |
wakaba |
1.3 |
} |
6832 |
wakaba |
1.1 |
|
6833 |
|
|
|
6834 |
|
|
;} |
6835 |
|
|
|
6836 |
|
|
; |
6837 |
|
|
} |
6838 |
|
|
if (@new_child) { |
6839 |
|
|
if ($nc_parent and |
6840 |
|
|
$nc_parent-> |
6841 |
|
|
manakai_read_only |
6842 |
|
|
) { |
6843 |
|
|
|
6844 |
|
|
|
6845 |
|
|
{ |
6846 |
|
|
|
6847 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6848 |
|
|
|
6849 |
|
|
{ |
6850 |
|
|
|
6851 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
6852 |
|
|
|
6853 |
|
|
|
6854 |
wakaba |
1.3 |
} |
6855 |
wakaba |
1.1 |
|
6856 |
|
|
|
6857 |
|
|
;} |
6858 |
|
|
|
6859 |
|
|
; |
6860 |
|
|
} |
6861 |
|
|
} |
6862 |
|
|
} |
6863 |
|
|
|
6864 |
|
|
## -- Insert at... |
6865 |
|
|
my $index = -1; # last |
6866 |
|
|
|
6867 |
|
|
|
6868 |
|
|
{ |
6869 |
|
|
|
6870 |
|
|
|
6871 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
6872 |
|
|
if (defined $refChild) { |
6873 |
|
|
if ($refChild eq $newChild) { |
6874 |
|
|
|
6875 |
|
|
|
6876 |
|
|
{ |
6877 |
|
|
|
6878 |
|
|
|
6879 |
|
|
{ |
6880 |
|
|
|
6881 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6882 |
|
|
|
6883 |
|
|
{ |
6884 |
|
|
|
6885 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#insert-before-itself', 'rdata' => $refChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
6886 |
|
|
|
6887 |
|
|
|
6888 |
wakaba |
1.3 |
} |
6889 |
wakaba |
1.1 |
|
6890 |
|
|
|
6891 |
|
|
;} |
6892 |
|
|
|
6893 |
|
|
; |
6894 |
|
|
|
6895 |
|
|
|
6896 |
|
|
|
6897 |
wakaba |
1.3 |
} |
6898 |
wakaba |
1.1 |
|
6899 |
|
|
; |
6900 |
|
|
|
6901 |
|
|
|
6902 |
|
|
; |
6903 |
|
|
} |
6904 |
|
|
|
6905 |
|
|
my $cns = $self-> |
6906 |
|
|
child_nodes |
6907 |
|
|
; |
6908 |
|
|
my $cnsl = @$cns; |
6909 |
|
|
C: { |
6910 |
|
|
$index = 0; |
6911 |
|
|
for my $i (0..($cnsl-1)) { |
6912 |
|
|
my $cn = $cns->[$i]; |
6913 |
|
|
if ($cn eq $refChild) { |
6914 |
|
|
$index += $i; |
6915 |
|
|
last C; |
6916 |
|
|
} elsif ($cn eq $newChild) { |
6917 |
|
|
$index = -1; # offset |
6918 |
|
|
} |
6919 |
|
|
} |
6920 |
|
|
|
6921 |
|
|
|
6922 |
|
|
{ |
6923 |
|
|
|
6924 |
|
|
|
6925 |
|
|
{ |
6926 |
|
|
|
6927 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6928 |
|
|
|
6929 |
|
|
{ |
6930 |
|
|
|
6931 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'refChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $refChild; |
6932 |
|
|
|
6933 |
|
|
|
6934 |
wakaba |
1.3 |
} |
6935 |
wakaba |
1.1 |
|
6936 |
|
|
|
6937 |
|
|
;} |
6938 |
|
|
|
6939 |
|
|
; |
6940 |
|
|
|
6941 |
|
|
|
6942 |
|
|
|
6943 |
wakaba |
1.3 |
} |
6944 |
wakaba |
1.1 |
|
6945 |
|
|
; |
6946 |
|
|
|
6947 |
|
|
|
6948 |
|
|
; |
6949 |
|
|
} # C |
6950 |
|
|
} else { # |oldChild| is not defined |
6951 |
|
|
|
6952 |
|
|
|
6953 |
|
|
; |
6954 |
|
|
} |
6955 |
|
|
|
6956 |
|
|
|
6957 |
|
|
|
6958 |
wakaba |
1.3 |
} |
6959 |
wakaba |
1.1 |
|
6960 |
|
|
; # FOR !tc:ForAppendChild |
6961 |
|
|
|
6962 |
|
|
## -- Removes from parent |
6963 |
|
|
if ($nc_parent) { |
6964 |
|
|
if ($child_nt == |
6965 |
wakaba |
1.6 |
11 |
6966 |
wakaba |
1.1 |
) { |
6967 |
|
|
|
6968 |
|
|
|
6969 |
|
|
{ |
6970 |
|
|
|
6971 |
|
|
|
6972 |
|
|
$newChild->{ |
6973 |
|
|
'b' |
6974 |
|
|
}->{${$newChild->{ |
6975 |
|
|
'id' |
6976 |
|
|
}}} |
6977 |
|
|
->{'child'} = []; |
6978 |
|
|
|
6979 |
|
|
|
6980 |
wakaba |
1.3 |
} |
6981 |
wakaba |
1.1 |
|
6982 |
|
|
; |
6983 |
|
|
} else { |
6984 |
|
|
my $v; |
6985 |
|
|
|
6986 |
|
|
|
6987 |
|
|
{ |
6988 |
|
|
|
6989 |
|
|
|
6990 |
|
|
$v = $nc_parent->{ |
6991 |
|
|
'b' |
6992 |
|
|
}->{${$nc_parent->{ |
6993 |
|
|
'id' |
6994 |
|
|
}}} |
6995 |
|
|
->{'child'}; |
6996 |
|
|
|
6997 |
|
|
|
6998 |
wakaba |
1.3 |
} |
6999 |
wakaba |
1.1 |
|
7000 |
|
|
; |
7001 |
|
|
RP: for my $i (0..$#$v) { |
7002 |
|
|
my $nodeid = $v->[$i]; |
7003 |
|
|
if ( |
7004 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
7005 |
|
|
) { |
7006 |
|
|
splice @$v, $i, 1, (); |
7007 |
|
|
last RP; |
7008 |
|
|
} |
7009 |
|
|
} # RP |
7010 |
|
|
} |
7011 |
|
|
} |
7012 |
|
|
|
7013 |
|
|
## -- Rewrite the |parentNode| properties |
7014 |
|
|
for my $nc (@new_child) { |
7015 |
|
|
|
7016 |
|
|
|
7017 |
|
|
{ |
7018 |
|
|
|
7019 |
|
|
|
7020 |
|
|
$nc->{ |
7021 |
|
|
'b' |
7022 |
|
|
}->{${$nc->{ |
7023 |
|
|
'id' |
7024 |
|
|
}}} |
7025 |
|
|
->{'parent'} = $self->{ |
7026 |
|
|
'id' |
7027 |
|
|
}; |
7028 |
|
|
|
7029 |
|
|
|
7030 |
wakaba |
1.3 |
} |
7031 |
wakaba |
1.1 |
|
7032 |
|
|
; |
7033 |
|
|
} |
7034 |
|
|
|
7035 |
|
|
my $children; |
7036 |
|
|
|
7037 |
|
|
|
7038 |
|
|
{ |
7039 |
|
|
|
7040 |
|
|
|
7041 |
|
|
$children = $self->{ |
7042 |
|
|
'b' |
7043 |
|
|
}->{${$self->{ |
7044 |
|
|
'id' |
7045 |
|
|
}}} |
7046 |
|
|
->{'child'}; |
7047 |
|
|
|
7048 |
|
|
|
7049 |
wakaba |
1.3 |
} |
7050 |
wakaba |
1.1 |
|
7051 |
|
|
; |
7052 |
|
|
|
7053 |
|
|
|
7054 |
|
|
|
7055 |
|
|
; |
7056 |
|
|
|
7057 |
|
|
|
7058 |
|
|
|
7059 |
|
|
{ |
7060 |
|
|
|
7061 |
|
|
|
7062 |
|
|
## -- Adds to children list |
7063 |
|
|
if ($index == -1) { |
7064 |
|
|
push @$children, map { |
7065 |
|
|
|
7066 |
|
|
$_->{'id'} |
7067 |
|
|
|
7068 |
|
|
} @new_child; |
7069 |
|
|
} else { |
7070 |
|
|
splice @$children, $index, 0, map { |
7071 |
|
|
|
7072 |
|
|
$_->{'id'} |
7073 |
|
|
|
7074 |
|
|
} @new_child; |
7075 |
|
|
} |
7076 |
|
|
$r = $newChild; |
7077 |
|
|
|
7078 |
|
|
|
7079 |
|
|
|
7080 |
wakaba |
1.3 |
} |
7081 |
wakaba |
1.1 |
|
7082 |
|
|
; |
7083 |
|
|
|
7084 |
|
|
|
7085 |
|
|
|
7086 |
|
|
; |
7087 |
|
|
|
7088 |
|
|
|
7089 |
|
|
|
7090 |
wakaba |
1.3 |
} |
7091 |
wakaba |
1.1 |
|
7092 |
|
|
|
7093 |
|
|
;} |
7094 |
|
|
|
7095 |
|
|
; |
7096 |
|
|
|
7097 |
|
|
|
7098 |
wakaba |
1.3 |
} |
7099 |
wakaba |
1.1 |
|
7100 |
|
|
; |
7101 |
|
|
|
7102 |
|
|
|
7103 |
wakaba |
1.3 |
} |
7104 |
wakaba |
1.1 |
$r} |
7105 |
|
|
sub replace_child ($$$) { |
7106 |
|
|
my ($self, $newChild, $oldChild) = @_; |
7107 |
|
|
my $r; |
7108 |
|
|
|
7109 |
|
|
{ |
7110 |
|
|
|
7111 |
|
|
my |
7112 |
|
|
$self_od = $self-> |
7113 |
|
|
owner_document |
7114 |
|
|
; |
7115 |
|
|
my $child_od = $newChild-> |
7116 |
|
|
owner_document |
7117 |
|
|
; |
7118 |
|
|
my $child_nt = $newChild-> |
7119 |
|
|
node_type |
7120 |
|
|
; |
7121 |
|
|
|
7122 |
|
|
|
7123 |
|
|
{ |
7124 |
|
|
|
7125 |
|
|
|
7126 |
|
|
{ |
7127 |
|
|
|
7128 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7129 |
|
|
|
7130 |
|
|
{ |
7131 |
|
|
|
7132 |
|
|
|
7133 |
|
|
my |
7134 |
|
|
$strict = $self_od-> |
7135 |
|
|
strict_error_checking |
7136 |
|
|
; |
7137 |
|
|
|
7138 |
|
|
## -- Node Type check |
7139 |
|
|
my @new_child; |
7140 |
|
|
if ({ |
7141 |
wakaba |
1.6 |
3 => 1, |
7142 |
|
|
5 => 1, |
7143 |
wakaba |
1.1 |
}->{$child_nt}) { |
7144 |
|
|
push @new_child, $newChild; |
7145 |
|
|
} elsif ($child_nt == |
7146 |
wakaba |
1.6 |
11 |
7147 |
wakaba |
1.1 |
) { |
7148 |
|
|
for my $cn (@{$newChild-> |
7149 |
|
|
child_nodes |
7150 |
|
|
}) { |
7151 |
|
|
unless ({ |
7152 |
wakaba |
1.6 |
3 => 1, |
7153 |
|
|
5 => 1, |
7154 |
wakaba |
1.1 |
}->{$cn-> |
7155 |
|
|
node_type |
7156 |
|
|
}) { |
7157 |
|
|
|
7158 |
|
|
|
7159 |
|
|
{ |
7160 |
|
|
|
7161 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7162 |
|
|
|
7163 |
|
|
{ |
7164 |
|
|
|
7165 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
7166 |
|
|
|
7167 |
|
|
|
7168 |
wakaba |
1.3 |
} |
7169 |
wakaba |
1.1 |
|
7170 |
|
|
|
7171 |
|
|
;} |
7172 |
|
|
|
7173 |
|
|
; |
7174 |
|
|
} |
7175 |
|
|
push @new_child, $cn; |
7176 |
|
|
} |
7177 |
|
|
} else { |
7178 |
|
|
|
7179 |
|
|
|
7180 |
|
|
{ |
7181 |
|
|
|
7182 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7183 |
|
|
|
7184 |
|
|
{ |
7185 |
|
|
|
7186 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
7187 |
|
|
|
7188 |
|
|
|
7189 |
wakaba |
1.3 |
} |
7190 |
wakaba |
1.1 |
|
7191 |
|
|
|
7192 |
|
|
;} |
7193 |
|
|
|
7194 |
|
|
; |
7195 |
|
|
} |
7196 |
|
|
|
7197 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
7198 |
|
|
parent_node |
7199 |
|
|
: |
7200 |
|
|
|
7201 |
|
|
undef |
7202 |
|
|
; |
7203 |
|
|
if ($strict) { |
7204 |
|
|
## -- Wrong-document check |
7205 |
|
|
unless ($self_od eq $child_od) { |
7206 |
|
|
|
7207 |
|
|
|
7208 |
|
|
{ |
7209 |
|
|
|
7210 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7211 |
|
|
|
7212 |
|
|
{ |
7213 |
|
|
|
7214 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
7215 |
|
|
|
7216 |
|
|
|
7217 |
wakaba |
1.3 |
} |
7218 |
wakaba |
1.1 |
|
7219 |
|
|
|
7220 |
|
|
;} |
7221 |
|
|
|
7222 |
|
|
; |
7223 |
|
|
} |
7224 |
|
|
|
7225 |
|
|
## -- Read-onlyness check |
7226 |
|
|
if ($self-> |
7227 |
|
|
manakai_read_only |
7228 |
|
|
) { |
7229 |
|
|
|
7230 |
|
|
|
7231 |
|
|
{ |
7232 |
|
|
|
7233 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7234 |
|
|
|
7235 |
|
|
{ |
7236 |
|
|
|
7237 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
7238 |
|
|
|
7239 |
|
|
|
7240 |
wakaba |
1.3 |
} |
7241 |
wakaba |
1.1 |
|
7242 |
|
|
|
7243 |
|
|
;} |
7244 |
|
|
|
7245 |
|
|
; |
7246 |
|
|
} |
7247 |
|
|
if (@new_child) { |
7248 |
|
|
if ($nc_parent and |
7249 |
|
|
$nc_parent-> |
7250 |
|
|
manakai_read_only |
7251 |
|
|
) { |
7252 |
|
|
|
7253 |
|
|
|
7254 |
|
|
{ |
7255 |
|
|
|
7256 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7257 |
|
|
|
7258 |
|
|
{ |
7259 |
|
|
|
7260 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
7261 |
|
|
|
7262 |
|
|
|
7263 |
wakaba |
1.3 |
} |
7264 |
wakaba |
1.1 |
|
7265 |
|
|
|
7266 |
|
|
;} |
7267 |
|
|
|
7268 |
|
|
; |
7269 |
|
|
} |
7270 |
|
|
} |
7271 |
|
|
} |
7272 |
|
|
|
7273 |
|
|
## -- Insert at... |
7274 |
|
|
my $index = -1; # last |
7275 |
|
|
|
7276 |
|
|
|
7277 |
|
|
{ |
7278 |
|
|
|
7279 |
|
|
|
7280 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
7281 |
|
|
if (defined $oldChild) { |
7282 |
|
|
if ($oldChild eq $newChild) { |
7283 |
|
|
|
7284 |
|
|
|
7285 |
|
|
; |
7286 |
|
|
|
7287 |
|
|
|
7288 |
|
|
{ |
7289 |
|
|
|
7290 |
|
|
|
7291 |
|
|
{ |
7292 |
|
|
|
7293 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7294 |
|
|
|
7295 |
|
|
{ |
7296 |
|
|
|
7297 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#replace-by-itself', 'rdata' => $oldChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
7298 |
|
|
|
7299 |
|
|
|
7300 |
wakaba |
1.3 |
} |
7301 |
wakaba |
1.1 |
|
7302 |
|
|
|
7303 |
|
|
;} |
7304 |
|
|
|
7305 |
|
|
; |
7306 |
|
|
|
7307 |
|
|
|
7308 |
|
|
|
7309 |
wakaba |
1.3 |
} |
7310 |
wakaba |
1.1 |
|
7311 |
|
|
; |
7312 |
|
|
} |
7313 |
|
|
|
7314 |
|
|
my $cns = $self-> |
7315 |
|
|
child_nodes |
7316 |
|
|
; |
7317 |
|
|
my $cnsl = @$cns; |
7318 |
|
|
C: { |
7319 |
|
|
$index = 0; |
7320 |
|
|
for my $i (0..($cnsl-1)) { |
7321 |
|
|
my $cn = $cns->[$i]; |
7322 |
|
|
if ($cn eq $oldChild) { |
7323 |
|
|
$index += $i; |
7324 |
|
|
last C; |
7325 |
|
|
} elsif ($cn eq $newChild) { |
7326 |
|
|
$index = -1; # offset |
7327 |
|
|
} |
7328 |
|
|
} |
7329 |
|
|
|
7330 |
|
|
|
7331 |
|
|
; |
7332 |
|
|
|
7333 |
|
|
|
7334 |
|
|
{ |
7335 |
|
|
|
7336 |
|
|
|
7337 |
|
|
{ |
7338 |
|
|
|
7339 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7340 |
|
|
|
7341 |
|
|
{ |
7342 |
|
|
|
7343 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
7344 |
|
|
|
7345 |
|
|
|
7346 |
wakaba |
1.3 |
} |
7347 |
wakaba |
1.1 |
|
7348 |
|
|
|
7349 |
|
|
;} |
7350 |
|
|
|
7351 |
|
|
; |
7352 |
|
|
|
7353 |
|
|
|
7354 |
|
|
|
7355 |
wakaba |
1.3 |
} |
7356 |
wakaba |
1.1 |
|
7357 |
|
|
; |
7358 |
|
|
} # C |
7359 |
|
|
} else { # |oldChild| is not defined |
7360 |
|
|
|
7361 |
|
|
|
7362 |
|
|
{ |
7363 |
|
|
|
7364 |
|
|
|
7365 |
|
|
{ |
7366 |
|
|
|
7367 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7368 |
|
|
|
7369 |
|
|
{ |
7370 |
|
|
|
7371 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
7372 |
|
|
|
7373 |
|
|
|
7374 |
wakaba |
1.3 |
} |
7375 |
wakaba |
1.1 |
|
7376 |
|
|
|
7377 |
|
|
;} |
7378 |
|
|
|
7379 |
|
|
; |
7380 |
|
|
|
7381 |
|
|
|
7382 |
|
|
|
7383 |
wakaba |
1.3 |
} |
7384 |
wakaba |
1.1 |
|
7385 |
|
|
; |
7386 |
|
|
} |
7387 |
|
|
|
7388 |
|
|
|
7389 |
|
|
|
7390 |
wakaba |
1.3 |
} |
7391 |
wakaba |
1.1 |
|
7392 |
|
|
; # FOR !tc:ForAppendChild |
7393 |
|
|
|
7394 |
|
|
## -- Removes from parent |
7395 |
|
|
if ($nc_parent) { |
7396 |
|
|
if ($child_nt == |
7397 |
wakaba |
1.6 |
11 |
7398 |
wakaba |
1.1 |
) { |
7399 |
|
|
|
7400 |
|
|
|
7401 |
|
|
{ |
7402 |
|
|
|
7403 |
|
|
|
7404 |
|
|
$newChild->{ |
7405 |
|
|
'b' |
7406 |
|
|
}->{${$newChild->{ |
7407 |
|
|
'id' |
7408 |
|
|
}}} |
7409 |
|
|
->{'child'} = []; |
7410 |
|
|
|
7411 |
|
|
|
7412 |
wakaba |
1.3 |
} |
7413 |
wakaba |
1.1 |
|
7414 |
|
|
; |
7415 |
|
|
} else { |
7416 |
|
|
my $v; |
7417 |
|
|
|
7418 |
|
|
|
7419 |
|
|
{ |
7420 |
|
|
|
7421 |
|
|
|
7422 |
|
|
$v = $nc_parent->{ |
7423 |
|
|
'b' |
7424 |
|
|
}->{${$nc_parent->{ |
7425 |
|
|
'id' |
7426 |
|
|
}}} |
7427 |
|
|
->{'child'}; |
7428 |
|
|
|
7429 |
|
|
|
7430 |
wakaba |
1.3 |
} |
7431 |
wakaba |
1.1 |
|
7432 |
|
|
; |
7433 |
|
|
RP: for my $i (0..$#$v) { |
7434 |
|
|
my $nodeid = $v->[$i]; |
7435 |
|
|
if ( |
7436 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
7437 |
|
|
) { |
7438 |
|
|
splice @$v, $i, 1, (); |
7439 |
|
|
last RP; |
7440 |
|
|
} |
7441 |
|
|
} # RP |
7442 |
|
|
} |
7443 |
|
|
} |
7444 |
|
|
|
7445 |
|
|
## -- Rewrite the |parentNode| properties |
7446 |
|
|
for my $nc (@new_child) { |
7447 |
|
|
|
7448 |
|
|
|
7449 |
|
|
{ |
7450 |
|
|
|
7451 |
|
|
|
7452 |
|
|
$nc->{ |
7453 |
|
|
'b' |
7454 |
|
|
}->{${$nc->{ |
7455 |
|
|
'id' |
7456 |
|
|
}}} |
7457 |
|
|
->{'parent'} = $self->{ |
7458 |
|
|
'id' |
7459 |
|
|
}; |
7460 |
|
|
|
7461 |
|
|
|
7462 |
wakaba |
1.3 |
} |
7463 |
wakaba |
1.1 |
|
7464 |
|
|
; |
7465 |
|
|
} |
7466 |
|
|
|
7467 |
|
|
my $children; |
7468 |
|
|
|
7469 |
|
|
|
7470 |
|
|
{ |
7471 |
|
|
|
7472 |
|
|
|
7473 |
|
|
$children = $self->{ |
7474 |
|
|
'b' |
7475 |
|
|
}->{${$self->{ |
7476 |
|
|
'id' |
7477 |
|
|
}}} |
7478 |
|
|
->{'child'}; |
7479 |
|
|
|
7480 |
|
|
|
7481 |
wakaba |
1.3 |
} |
7482 |
wakaba |
1.1 |
|
7483 |
|
|
; |
7484 |
|
|
|
7485 |
|
|
|
7486 |
|
|
|
7487 |
|
|
; |
7488 |
|
|
|
7489 |
|
|
|
7490 |
|
|
|
7491 |
|
|
; |
7492 |
|
|
|
7493 |
|
|
|
7494 |
|
|
|
7495 |
|
|
{ |
7496 |
|
|
|
7497 |
|
|
|
7498 |
|
|
## -- Replaces the node |
7499 |
|
|
splice @$children, $index, 1, map { |
7500 |
|
|
|
7501 |
|
|
$_->{'id'} |
7502 |
|
|
|
7503 |
|
|
} @new_child; |
7504 |
|
|
|
7505 |
|
|
|
7506 |
|
|
{ |
7507 |
|
|
|
7508 |
|
|
CORE::delete |
7509 |
|
|
$oldChild->{ |
7510 |
|
|
'b' |
7511 |
|
|
}->{${$oldChild->{ |
7512 |
|
|
'id' |
7513 |
|
|
}}} |
7514 |
|
|
->{'parent'}; |
7515 |
|
|
|
7516 |
|
|
|
7517 |
wakaba |
1.3 |
} |
7518 |
wakaba |
1.1 |
|
7519 |
|
|
; |
7520 |
|
|
$r = $oldChild; |
7521 |
|
|
|
7522 |
|
|
|
7523 |
|
|
|
7524 |
wakaba |
1.3 |
} |
7525 |
wakaba |
1.1 |
|
7526 |
|
|
; |
7527 |
|
|
|
7528 |
|
|
|
7529 |
|
|
|
7530 |
wakaba |
1.3 |
} |
7531 |
wakaba |
1.1 |
|
7532 |
|
|
|
7533 |
|
|
;} |
7534 |
|
|
|
7535 |
|
|
; |
7536 |
|
|
|
7537 |
|
|
|
7538 |
wakaba |
1.3 |
} |
7539 |
wakaba |
1.1 |
|
7540 |
|
|
; |
7541 |
|
|
|
7542 |
|
|
|
7543 |
wakaba |
1.3 |
} |
7544 |
wakaba |
1.1 |
$r} |
7545 |
|
|
sub node_name ($;$) { |
7546 |
|
|
if (@_ == 1) {my ($self) = @_; |
7547 |
|
|
my $r = ''; |
7548 |
|
|
|
7549 |
|
|
{ |
7550 |
|
|
|
7551 |
|
|
my |
7552 |
|
|
$prefix; |
7553 |
|
|
|
7554 |
|
|
|
7555 |
|
|
{ |
7556 |
|
|
|
7557 |
|
|
|
7558 |
|
|
$prefix = $self->{ |
7559 |
|
|
'b' |
7560 |
|
|
}->{${$self->{ |
7561 |
|
|
'id' |
7562 |
|
|
}}} |
7563 |
|
|
->{'pfx'}; |
7564 |
|
|
|
7565 |
|
|
|
7566 |
wakaba |
1.3 |
} |
7567 |
wakaba |
1.1 |
|
7568 |
|
|
; |
7569 |
|
|
my $lname; |
7570 |
|
|
|
7571 |
|
|
|
7572 |
|
|
{ |
7573 |
|
|
|
7574 |
|
|
|
7575 |
|
|
$lname = $self->{ |
7576 |
|
|
'b' |
7577 |
|
|
}->{${$self->{ |
7578 |
|
|
'id' |
7579 |
|
|
}}} |
7580 |
|
|
->{'ln'}; |
7581 |
|
|
|
7582 |
|
|
|
7583 |
wakaba |
1.3 |
} |
7584 |
wakaba |
1.1 |
|
7585 |
|
|
; |
7586 |
|
|
$r = defined $prefix ? $$prefix.':'.$$lname : $$lname; |
7587 |
|
|
|
7588 |
|
|
|
7589 |
wakaba |
1.3 |
} |
7590 |
wakaba |
1.1 |
$r; |
7591 |
|
|
} else {my ($self) = @_; |
7592 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
7593 |
|
|
} |
7594 |
|
|
} |
7595 |
|
|
sub name ($;$) { |
7596 |
|
|
if (@_ == 1) {my ($self) = @_; |
7597 |
|
|
my $r = ''; |
7598 |
|
|
|
7599 |
|
|
{ |
7600 |
|
|
|
7601 |
|
|
my |
7602 |
|
|
$prefix; |
7603 |
|
|
|
7604 |
|
|
|
7605 |
|
|
{ |
7606 |
|
|
|
7607 |
|
|
|
7608 |
|
|
$prefix = $self->{ |
7609 |
|
|
'b' |
7610 |
|
|
}->{${$self->{ |
7611 |
|
|
'id' |
7612 |
|
|
}}} |
7613 |
|
|
->{'pfx'}; |
7614 |
|
|
|
7615 |
|
|
|
7616 |
wakaba |
1.3 |
} |
7617 |
wakaba |
1.1 |
|
7618 |
|
|
; |
7619 |
|
|
my $lname; |
7620 |
|
|
|
7621 |
|
|
|
7622 |
|
|
{ |
7623 |
|
|
|
7624 |
|
|
|
7625 |
|
|
$lname = $self->{ |
7626 |
|
|
'b' |
7627 |
|
|
}->{${$self->{ |
7628 |
|
|
'id' |
7629 |
|
|
}}} |
7630 |
|
|
->{'ln'}; |
7631 |
|
|
|
7632 |
|
|
|
7633 |
wakaba |
1.3 |
} |
7634 |
wakaba |
1.1 |
|
7635 |
|
|
; |
7636 |
|
|
$r = defined $prefix ? $$prefix.':'.$$lname : $$lname; |
7637 |
|
|
|
7638 |
|
|
|
7639 |
wakaba |
1.3 |
} |
7640 |
wakaba |
1.1 |
$r; |
7641 |
|
|
} else {my ($self) = @_; |
7642 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'name'; |
7643 |
|
|
} |
7644 |
|
|
} |
7645 |
|
|
sub node_value ($;$) { |
7646 |
|
|
if (@_ == 1) {my ($self) = @_; |
7647 |
|
|
my $r = ''; |
7648 |
|
|
|
7649 |
|
|
{ |
7650 |
|
|
|
7651 |
|
|
|
7652 |
|
|
{ |
7653 |
|
|
|
7654 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7655 |
|
|
|
7656 |
|
|
{ |
7657 |
|
|
|
7658 |
|
|
|
7659 |
wakaba |
1.9 |
for |
7660 |
|
|
my $child (@{$self-> |
7661 |
|
|
child_nodes |
7662 |
|
|
}) { |
7663 |
|
|
if ($child-> |
7664 |
|
|
node_type |
7665 |
|
|
== |
7666 |
|
|
|
7667 |
|
|
5 |
7668 |
|
|
) { |
7669 |
|
|
my $v = $child-> |
7670 |
|
|
text_content |
7671 |
|
|
; |
7672 |
|
|
$v =~ s/[\x09\x0A\x0D]/ /; |
7673 |
|
|
$r .= $v; |
7674 |
|
|
} else { |
7675 |
|
|
$r .= $child-> |
7676 |
|
|
text_content |
7677 |
|
|
; |
7678 |
|
|
} |
7679 |
|
|
} # childNodes |
7680 |
|
|
my $vt; |
7681 |
|
|
|
7682 |
|
|
|
7683 |
|
|
{ |
7684 |
|
|
|
7685 |
|
|
|
7686 |
|
|
$vt = $self->{ |
7687 |
|
|
'b' |
7688 |
|
|
}->{${$self->{ |
7689 |
|
|
'id' |
7690 |
|
|
}}} |
7691 |
|
|
->{'at'}; |
7692 |
|
|
|
7693 |
|
|
|
7694 |
|
|
} |
7695 |
wakaba |
1.1 |
|
7696 |
|
|
; |
7697 |
wakaba |
1.9 |
unless (not defined $vt or |
7698 |
|
|
$vt == |
7699 |
|
|
0 or |
7700 |
|
|
|
7701 |
|
|
$vt == |
7702 |
|
|
11 or |
7703 |
|
|
|
7704 |
|
|
$vt == |
7705 |
|
|
1 |
7706 |
|
|
) { |
7707 |
|
|
$r =~ s/\A\x20+//; |
7708 |
|
|
$r =~ s/\x20+\z//; |
7709 |
|
|
$r =~ s/\x20+/ /g; |
7710 |
|
|
} |
7711 |
|
|
|
7712 |
|
|
if (defined $vt and $vt == |
7713 |
|
|
2 and |
7714 |
|
|
|
7715 |
|
|
$self-> |
7716 |
|
|
owner_document |
7717 |
|
|
-> |
7718 |
|
|
dom_config |
7719 |
|
|
|
7720 |
|
|
-> |
7721 |
|
|
get_parameter |
7722 |
|
|
( |
7723 |
|
|
'http://suika.fam.cx/www/2006/dom-config/xml-id' |
7724 |
|
|
)) { |
7725 |
|
|
$r =~ s/[\x09\x0A\x0D\x20]+/ /g; |
7726 |
|
|
$r =~ s/\A //; |
7727 |
|
|
$r =~ s/ \z//; |
7728 |
|
|
} |
7729 |
wakaba |
1.1 |
|
7730 |
|
|
|
7731 |
|
|
|
7732 |
wakaba |
1.3 |
} |
7733 |
wakaba |
1.1 |
|
7734 |
|
|
|
7735 |
|
|
;} |
7736 |
|
|
|
7737 |
|
|
; |
7738 |
|
|
|
7739 |
|
|
|
7740 |
wakaba |
1.3 |
} |
7741 |
wakaba |
1.1 |
$r; |
7742 |
|
|
} else {my ($self, $given) = @_; |
7743 |
|
|
|
7744 |
|
|
{ |
7745 |
|
|
|
7746 |
|
|
|
7747 |
|
|
{ |
7748 |
|
|
|
7749 |
|
|
|
7750 |
|
|
{ |
7751 |
|
|
|
7752 |
wakaba |
1.9 |
if |
7753 |
|
|
($self-> |
7754 |
|
|
manakai_read_only |
7755 |
|
|
) { |
7756 |
|
|
|
7757 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
7758 |
|
|
|
7759 |
|
|
; |
7760 |
|
|
} |
7761 |
|
|
|
7762 |
|
|
|
7763 |
|
|
} |
7764 |
|
|
|
7765 |
|
|
; |
7766 |
|
|
|
7767 |
|
|
my @__old_children = @{$self-> |
7768 |
|
|
child_nodes |
7769 |
|
|
}; |
7770 |
|
|
for my $__old_child (@__old_children) { |
7771 |
|
|
|
7772 |
|
|
|
7773 |
|
|
{ |
7774 |
|
|
|
7775 |
|
|
CORE::delete |
7776 |
|
|
$__old_child->{ |
7777 |
|
|
'b' |
7778 |
|
|
}->{${$__old_child->{ |
7779 |
|
|
'id' |
7780 |
|
|
}}} |
7781 |
|
|
->{'parent'}; |
7782 |
|
|
|
7783 |
|
|
|
7784 |
|
|
} |
7785 |
wakaba |
1.1 |
|
7786 |
wakaba |
1.9 |
; |
7787 |
|
|
} |
7788 |
wakaba |
1.1 |
|
7789 |
wakaba |
1.9 |
my @__new_children; |
7790 |
|
|
if (defined $given and length $given) { |
7791 |
|
|
my $__text = $self->owner_document-> |
7792 |
|
|
create_text_node |
7793 |
wakaba |
1.1 |
($given); |
7794 |
wakaba |
1.9 |
push @__new_children, |
7795 |
|
|
$__text->{'id'} |
7796 |
|
|
; |
7797 |
|
|
|
7798 |
|
|
|
7799 |
|
|
{ |
7800 |
|
|
|
7801 |
|
|
|
7802 |
|
|
$__text->{ |
7803 |
|
|
'b' |
7804 |
|
|
}->{${$__text->{ |
7805 |
|
|
'id' |
7806 |
|
|
}}} |
7807 |
|
|
->{'parent'} = $self->{ |
7808 |
|
|
'id' |
7809 |
|
|
}; |
7810 |
|
|
|
7811 |
|
|
|
7812 |
|
|
} |
7813 |
wakaba |
1.1 |
|
7814 |
wakaba |
1.9 |
; |
7815 |
|
|
} |
7816 |
|
|
|
7817 |
|
|
|
7818 |
|
|
|
7819 |
|
|
{ |
7820 |
|
|
|
7821 |
|
|
|
7822 |
|
|
$self->{ |
7823 |
|
|
'b' |
7824 |
|
|
}->{${$self->{ |
7825 |
|
|
'id' |
7826 |
|
|
}}} |
7827 |
|
|
->{'child'} = \@__new_children; |
7828 |
wakaba |
1.1 |
|
7829 |
|
|
|
7830 |
wakaba |
1.3 |
} |
7831 |
wakaba |
1.1 |
|
7832 |
wakaba |
1.9 |
; |
7833 |
|
|
|
7834 |
wakaba |
1.1 |
|
7835 |
wakaba |
1.9 |
} |
7836 |
wakaba |
1.1 |
|
7837 |
|
|
; |
7838 |
|
|
|
7839 |
|
|
|
7840 |
wakaba |
1.3 |
} |
7841 |
wakaba |
1.1 |
} |
7842 |
|
|
} |
7843 |
|
|
sub manakai_append_text ($$) { |
7844 |
|
|
my ($self, $string) = @_; |
7845 |
|
|
my $r; |
7846 |
|
|
|
7847 |
|
|
{ |
7848 |
|
|
|
7849 |
|
|
|
7850 |
|
|
{ |
7851 |
|
|
|
7852 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7853 |
|
|
|
7854 |
|
|
{ |
7855 |
|
|
|
7856 |
|
|
|
7857 |
|
|
my |
7858 |
|
|
$lc = $self-> |
7859 |
|
|
last_child |
7860 |
|
|
; |
7861 |
|
|
if (defined $lc and |
7862 |
|
|
$lc-> |
7863 |
|
|
node_type |
7864 |
|
|
== |
7865 |
wakaba |
1.6 |
3 |
7866 |
wakaba |
1.1 |
) { |
7867 |
|
|
$lc-> |
7868 |
|
|
manakai_append_text |
7869 |
|
|
|
7870 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
7871 |
|
|
} else { |
7872 |
|
|
my $text = $self-> |
7873 |
|
|
owner_document |
7874 |
|
|
|
7875 |
|
|
-> |
7876 |
|
|
create_text_node |
7877 |
|
|
|
7878 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
7879 |
|
|
$self-> |
7880 |
|
|
append_child |
7881 |
|
|
($text); |
7882 |
|
|
} |
7883 |
|
|
$r = $self; |
7884 |
|
|
|
7885 |
|
|
|
7886 |
|
|
|
7887 |
wakaba |
1.3 |
} |
7888 |
wakaba |
1.1 |
|
7889 |
|
|
|
7890 |
|
|
;} |
7891 |
|
|
|
7892 |
|
|
; |
7893 |
|
|
|
7894 |
|
|
|
7895 |
wakaba |
1.3 |
} |
7896 |
wakaba |
1.1 |
$r} |
7897 |
|
|
sub get_feature ($$$) { |
7898 |
|
|
my ($self, $feature, $version) = @_; |
7899 |
|
|
|
7900 |
|
|
{ |
7901 |
|
|
|
7902 |
|
|
|
7903 |
|
|
$feature = lc $feature; |
7904 |
|
|
|
7905 |
|
|
|
7906 |
wakaba |
1.3 |
} |
7907 |
wakaba |
1.1 |
|
7908 |
|
|
{ |
7909 |
|
|
|
7910 |
|
|
|
7911 |
|
|
$version = '' unless defined $version; |
7912 |
|
|
|
7913 |
|
|
|
7914 |
wakaba |
1.3 |
} |
7915 |
wakaba |
1.1 |
my $r; |
7916 |
|
|
|
7917 |
|
|
{ |
7918 |
|
|
|
7919 |
|
|
|
7920 |
|
|
$feature =~ s/^\+//; |
7921 |
|
|
|
7922 |
|
|
|
7923 |
|
|
{ |
7924 |
|
|
|
7925 |
|
|
if |
7926 |
wakaba |
1.9 |
($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { |
7927 |
wakaba |
1.1 |
$r = $self; |
7928 |
|
|
} |
7929 |
|
|
|
7930 |
|
|
|
7931 |
wakaba |
1.3 |
} |
7932 |
wakaba |
1.1 |
|
7933 |
|
|
; |
7934 |
|
|
unless (defined $r) { |
7935 |
|
|
|
7936 |
|
|
|
7937 |
|
|
{ |
7938 |
|
|
|
7939 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7940 |
|
|
|
7941 |
|
|
{ |
7942 |
|
|
|
7943 |
|
|
|
7944 |
|
|
|
7945 |
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
7946 |
|
|
|
7947 |
|
|
|
7948 |
|
|
|
7949 |
wakaba |
1.3 |
} |
7950 |
wakaba |
1.1 |
|
7951 |
|
|
|
7952 |
|
|
;} |
7953 |
|
|
|
7954 |
|
|
; |
7955 |
|
|
} |
7956 |
|
|
|
7957 |
|
|
|
7958 |
wakaba |
1.3 |
} |
7959 |
wakaba |
1.1 |
$r} |
7960 |
|
|
sub base_uri ($;$) { |
7961 |
|
|
if (@_ == 1) {my ($self) = @_; |
7962 |
|
|
my $r = ''; |
7963 |
|
|
|
7964 |
|
|
{ |
7965 |
|
|
|
7966 |
|
|
|
7967 |
|
|
{ |
7968 |
|
|
|
7969 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7970 |
|
|
|
7971 |
|
|
{ |
7972 |
|
|
|
7973 |
|
|
|
7974 |
|
|
my |
7975 |
|
|
$oe = $self-> |
7976 |
|
|
owner_element |
7977 |
|
|
; |
7978 |
|
|
if ($oe) { |
7979 |
wakaba |
1.9 |
my $ln = $self->local_name; |
7980 |
|
|
my $nsuri = $self->namespace_uri; |
7981 |
|
|
if (($ln eq 'base' and defined $nsuri and $nsuri eq |
7982 |
|
|
'http://www.w3.org/XML/1998/namespace' |
7983 |
|
|
) or |
7984 |
|
|
($ln eq 'xml:base' and not defined $nsuri)) { |
7985 |
|
|
my $oep = $oe-> |
7986 |
|
|
parent_node |
7987 |
|
|
; |
7988 |
|
|
if ($oep) { |
7989 |
|
|
$r = $oep-> |
7990 |
|
|
base_uri |
7991 |
|
|
; |
7992 |
|
|
} else { |
7993 |
|
|
$r = $self-> |
7994 |
|
|
owner_document |
7995 |
|
|
-> |
7996 |
wakaba |
1.1 |
base_uri |
7997 |
|
|
; |
7998 |
wakaba |
1.9 |
} |
7999 |
|
|
} else { |
8000 |
|
|
$r = $oe-> |
8001 |
|
|
base_uri |
8002 |
|
|
; |
8003 |
|
|
} |
8004 |
wakaba |
1.1 |
} else { |
8005 |
wakaba |
1.9 |
$r = $self-> |
8006 |
wakaba |
1.1 |
owner_document |
8007 |
wakaba |
1.9 |
-> |
8008 |
wakaba |
1.1 |
base_uri |
8009 |
|
|
; |
8010 |
|
|
} |
8011 |
|
|
|
8012 |
|
|
|
8013 |
|
|
|
8014 |
wakaba |
1.3 |
} |
8015 |
wakaba |
1.1 |
|
8016 |
|
|
|
8017 |
|
|
;} |
8018 |
|
|
|
8019 |
|
|
; |
8020 |
|
|
|
8021 |
|
|
|
8022 |
wakaba |
1.3 |
} |
8023 |
wakaba |
1.1 |
$r; |
8024 |
|
|
} else {my ($self) = @_; |
8025 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
8026 |
|
|
} |
8027 |
|
|
} |
8028 |
|
|
sub owner_element ($;$) { |
8029 |
|
|
if (@_ == 1) {my ($self) = @_; |
8030 |
|
|
my $r; |
8031 |
|
|
|
8032 |
|
|
{ |
8033 |
|
|
|
8034 |
|
|
|
8035 |
|
|
{ |
8036 |
|
|
|
8037 |
|
|
my |
8038 |
|
|
$__v = $self->{ |
8039 |
|
|
'b' |
8040 |
|
|
}->{${$self->{ |
8041 |
|
|
'id' |
8042 |
|
|
}}} |
8043 |
|
|
->{'owner'}; |
8044 |
|
|
if (defined $__v) { |
8045 |
|
|
|
8046 |
|
|
|
8047 |
|
|
{ |
8048 |
|
|
|
8049 |
|
|
|
8050 |
|
|
$r = ${$self->{'b'}->{${$__v}}->{ |
8051 |
|
|
'cls' |
8052 |
|
|
}}->___create_node_ref ({ |
8053 |
|
|
|
8054 |
|
|
'id' |
8055 |
|
|
=> $__v, |
8056 |
|
|
|
8057 |
|
|
'b' |
8058 |
|
|
=> $self->{'b'}, |
8059 |
|
|
}, { |
8060 |
|
|
}); |
8061 |
|
|
$self->{'b'}->{${$__v}}->{ |
8062 |
|
|
'rc' |
8063 |
|
|
}++; |
8064 |
|
|
|
8065 |
|
|
|
8066 |
wakaba |
1.3 |
} |
8067 |
wakaba |
1.1 |
|
8068 |
|
|
; |
8069 |
|
|
} |
8070 |
|
|
|
8071 |
|
|
|
8072 |
wakaba |
1.3 |
} |
8073 |
wakaba |
1.1 |
|
8074 |
|
|
; |
8075 |
|
|
|
8076 |
|
|
|
8077 |
wakaba |
1.3 |
} |
8078 |
wakaba |
1.1 |
$r; |
8079 |
|
|
} else {my ($self) = @_; |
8080 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'owner_element'; |
8081 |
|
|
} |
8082 |
|
|
} |
8083 |
|
|
sub specified ($;$) { |
8084 |
|
|
if (@_ == 1) {my ($self) = @_; |
8085 |
|
|
my $r = 0; |
8086 |
|
|
|
8087 |
|
|
{ |
8088 |
|
|
|
8089 |
|
|
|
8090 |
|
|
{ |
8091 |
|
|
|
8092 |
|
|
|
8093 |
|
|
$r = $self->{ |
8094 |
|
|
'b' |
8095 |
|
|
}->{${$self->{ |
8096 |
|
|
'id' |
8097 |
|
|
}}} |
8098 |
|
|
->{'specified'}; |
8099 |
|
|
|
8100 |
|
|
|
8101 |
wakaba |
1.3 |
} |
8102 |
wakaba |
1.1 |
|
8103 |
|
|
; |
8104 |
|
|
unless ($r) { |
8105 |
|
|
my $oe; |
8106 |
|
|
|
8107 |
|
|
|
8108 |
|
|
{ |
8109 |
|
|
|
8110 |
|
|
|
8111 |
|
|
$oe = $self->{ |
8112 |
|
|
'b' |
8113 |
|
|
}->{${$self->{ |
8114 |
|
|
'id' |
8115 |
|
|
}}} |
8116 |
|
|
->{'owner'}; |
8117 |
|
|
|
8118 |
|
|
|
8119 |
wakaba |
1.3 |
} |
8120 |
wakaba |
1.1 |
|
8121 |
|
|
; |
8122 |
|
|
unless (defined $oe) { |
8123 |
|
|
$r = |
8124 |
|
|
1 |
8125 |
|
|
; |
8126 |
|
|
} |
8127 |
|
|
} |
8128 |
|
|
|
8129 |
|
|
|
8130 |
wakaba |
1.3 |
} |
8131 |
wakaba |
1.1 |
$r; |
8132 |
|
|
} else {my ($self, $given) = @_; |
8133 |
|
|
|
8134 |
|
|
{ |
8135 |
|
|
|
8136 |
|
|
|
8137 |
|
|
{ |
8138 |
|
|
|
8139 |
|
|
if |
8140 |
|
|
($self-> |
8141 |
|
|
manakai_read_only |
8142 |
|
|
) { |
8143 |
|
|
|
8144 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
8145 |
|
|
|
8146 |
|
|
; |
8147 |
|
|
} |
8148 |
|
|
|
8149 |
|
|
|
8150 |
wakaba |
1.3 |
} |
8151 |
wakaba |
1.1 |
|
8152 |
|
|
; |
8153 |
|
|
unless ($given) { |
8154 |
|
|
my $oe; |
8155 |
|
|
|
8156 |
|
|
|
8157 |
|
|
{ |
8158 |
|
|
|
8159 |
|
|
|
8160 |
|
|
$oe = $self->{ |
8161 |
|
|
'b' |
8162 |
|
|
}->{${$self->{ |
8163 |
|
|
'id' |
8164 |
|
|
}}} |
8165 |
|
|
->{'owner'}; |
8166 |
|
|
|
8167 |
|
|
|
8168 |
wakaba |
1.3 |
} |
8169 |
wakaba |
1.1 |
|
8170 |
|
|
; |
8171 |
|
|
$given = |
8172 |
|
|
1 unless |
8173 |
|
|
defined $oe; |
8174 |
|
|
} |
8175 |
|
|
|
8176 |
|
|
|
8177 |
|
|
{ |
8178 |
|
|
|
8179 |
|
|
|
8180 |
|
|
$self->{ |
8181 |
|
|
'b' |
8182 |
|
|
}->{${$self->{ |
8183 |
|
|
'id' |
8184 |
|
|
}}} |
8185 |
|
|
->{'specified'} = $given; |
8186 |
|
|
|
8187 |
|
|
|
8188 |
wakaba |
1.3 |
} |
8189 |
wakaba |
1.1 |
|
8190 |
|
|
; |
8191 |
|
|
|
8192 |
|
|
|
8193 |
wakaba |
1.3 |
} |
8194 |
wakaba |
1.1 |
} |
8195 |
|
|
} |
8196 |
|
|
sub value ($;$) { |
8197 |
|
|
if (@_ == 1) {my ($self) = @_; |
8198 |
|
|
my $r = ''; |
8199 |
|
|
|
8200 |
|
|
{ |
8201 |
|
|
|
8202 |
|
|
|
8203 |
|
|
{ |
8204 |
|
|
|
8205 |
|
|
local $Error::Depth = $Error::Depth + 1; |
8206 |
|
|
|
8207 |
|
|
{ |
8208 |
|
|
|
8209 |
|
|
|
8210 |
|
|
for |
8211 |
|
|
my $child (@{$self-> |
8212 |
|
|
child_nodes |
8213 |
|
|
}) { |
8214 |
|
|
if ($child-> |
8215 |
|
|
node_type |
8216 |
|
|
== |
8217 |
|
|
|
8218 |
wakaba |
1.6 |
5 |
8219 |
wakaba |
1.1 |
) { |
8220 |
|
|
my $v = $child-> |
8221 |
|
|
text_content |
8222 |
|
|
; |
8223 |
|
|
$v =~ s/[\x09\x0A\x0D]/ /; |
8224 |
|
|
$r .= $v; |
8225 |
|
|
} else { |
8226 |
|
|
$r .= $child-> |
8227 |
|
|
text_content |
8228 |
|
|
; |
8229 |
|
|
} |
8230 |
|
|
} # childNodes |
8231 |
|
|
my $vt; |
8232 |
|
|
|
8233 |
|
|
|
8234 |
|
|
{ |
8235 |
|
|
|
8236 |
|
|
|
8237 |
|
|
$vt = $self->{ |
8238 |
|
|
'b' |
8239 |
|
|
}->{${$self->{ |
8240 |
|
|
'id' |
8241 |
|
|
}}} |
8242 |
|
|
->{'at'}; |
8243 |
|
|
|
8244 |
|
|
|
8245 |
wakaba |
1.3 |
} |
8246 |
wakaba |
1.1 |
|
8247 |
|
|
; |
8248 |
|
|
unless (not defined $vt or |
8249 |
|
|
$vt == |
8250 |
wakaba |
1.6 |
0 or |
8251 |
wakaba |
1.1 |
|
8252 |
|
|
$vt == |
8253 |
wakaba |
1.6 |
11 or |
8254 |
wakaba |
1.1 |
|
8255 |
|
|
$vt == |
8256 |
wakaba |
1.6 |
1 |
8257 |
wakaba |
1.1 |
) { |
8258 |
|
|
$r =~ s/\A\x20+//; |
8259 |
|
|
$r =~ s/\x20+\z//; |
8260 |
|
|
$r =~ s/\x20+/ /g; |
8261 |
|
|
} |
8262 |
wakaba |
1.9 |
|
8263 |
|
|
if (defined $vt and $vt == |
8264 |
|
|
2 and |
8265 |
|
|
|
8266 |
|
|
$self-> |
8267 |
|
|
owner_document |
8268 |
|
|
-> |
8269 |
|
|
dom_config |
8270 |
|
|
|
8271 |
|
|
-> |
8272 |
|
|
get_parameter |
8273 |
|
|
( |
8274 |
|
|
'http://suika.fam.cx/www/2006/dom-config/xml-id' |
8275 |
|
|
)) { |
8276 |
|
|
$r =~ s/[\x09\x0A\x0D\x20]+/ /g; |
8277 |
|
|
$r =~ s/\A //; |
8278 |
|
|
$r =~ s/ \z//; |
8279 |
|
|
} |
8280 |
wakaba |
1.1 |
|
8281 |
|
|
|
8282 |
|
|
|
8283 |
wakaba |
1.3 |
} |
8284 |
wakaba |
1.1 |
|
8285 |
|
|
|
8286 |
|
|
;} |
8287 |
|
|
|
8288 |
|
|
; |
8289 |
|
|
|
8290 |
|
|
|
8291 |
wakaba |
1.3 |
} |
8292 |
wakaba |
1.1 |
$r; |
8293 |
|
|
} else {my ($self, $given) = @_; |
8294 |
|
|
|
8295 |
|
|
{ |
8296 |
|
|
|
8297 |
|
|
|
8298 |
|
|
{ |
8299 |
|
|
|
8300 |
|
|
|
8301 |
|
|
{ |
8302 |
|
|
|
8303 |
|
|
if |
8304 |
|
|
($self-> |
8305 |
|
|
manakai_read_only |
8306 |
|
|
) { |
8307 |
|
|
|
8308 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
8309 |
|
|
|
8310 |
|
|
; |
8311 |
|
|
} |
8312 |
|
|
|
8313 |
|
|
|
8314 |
wakaba |
1.3 |
} |
8315 |
wakaba |
1.1 |
|
8316 |
|
|
; |
8317 |
|
|
|
8318 |
|
|
my @__old_children = @{$self-> |
8319 |
|
|
child_nodes |
8320 |
|
|
}; |
8321 |
|
|
for my $__old_child (@__old_children) { |
8322 |
|
|
|
8323 |
|
|
|
8324 |
|
|
{ |
8325 |
|
|
|
8326 |
|
|
CORE::delete |
8327 |
|
|
$__old_child->{ |
8328 |
|
|
'b' |
8329 |
|
|
}->{${$__old_child->{ |
8330 |
|
|
'id' |
8331 |
|
|
}}} |
8332 |
|
|
->{'parent'}; |
8333 |
|
|
|
8334 |
|
|
|
8335 |
wakaba |
1.3 |
} |
8336 |
wakaba |
1.1 |
|
8337 |
|
|
; |
8338 |
|
|
} |
8339 |
|
|
|
8340 |
|
|
my @__new_children; |
8341 |
|
|
if (defined $given and length $given) { |
8342 |
|
|
my $__text = $self->owner_document-> |
8343 |
|
|
create_text_node |
8344 |
|
|
($given); |
8345 |
|
|
push @__new_children, |
8346 |
|
|
$__text->{'id'} |
8347 |
|
|
; |
8348 |
|
|
|
8349 |
|
|
|
8350 |
|
|
{ |
8351 |
|
|
|
8352 |
|
|
|
8353 |
|
|
$__text->{ |
8354 |
|
|
'b' |
8355 |
|
|
}->{${$__text->{ |
8356 |
|
|
'id' |
8357 |
|
|
}}} |
8358 |
|
|
->{'parent'} = $self->{ |
8359 |
|
|
'id' |
8360 |
|
|
}; |
8361 |
|
|
|
8362 |
|
|
|
8363 |
wakaba |
1.3 |
} |
8364 |
wakaba |
1.1 |
|
8365 |
|
|
; |
8366 |
|
|
} |
8367 |
|
|
|
8368 |
|
|
|
8369 |
|
|
|
8370 |
|
|
{ |
8371 |
|
|
|
8372 |
|
|
|
8373 |
|
|
$self->{ |
8374 |
|
|
'b' |
8375 |
|
|
}->{${$self->{ |
8376 |
|
|
'id' |
8377 |
|
|
}}} |
8378 |
|
|
->{'child'} = \@__new_children; |
8379 |
|
|
|
8380 |
|
|
|
8381 |
wakaba |
1.3 |
} |
8382 |
wakaba |
1.1 |
|
8383 |
|
|
; |
8384 |
|
|
|
8385 |
|
|
|
8386 |
wakaba |
1.3 |
} |
8387 |
wakaba |
1.1 |
|
8388 |
|
|
; |
8389 |
|
|
|
8390 |
|
|
|
8391 |
wakaba |
1.3 |
} |
8392 |
wakaba |
1.1 |
} |
8393 |
|
|
} |
8394 |
|
|
sub schema_type_info ($;$) { |
8395 |
|
|
if (@_ == 1) {my ($self) = @_; |
8396 |
|
|
my $r; |
8397 |
|
|
|
8398 |
|
|
{ |
8399 |
|
|
|
8400 |
|
|
my |
8401 |
|
|
$type; |
8402 |
|
|
|
8403 |
|
|
|
8404 |
|
|
{ |
8405 |
|
|
|
8406 |
|
|
|
8407 |
|
|
$type = $self->{ |
8408 |
|
|
'b' |
8409 |
|
|
}->{${$self->{ |
8410 |
|
|
'id' |
8411 |
|
|
}}} |
8412 |
|
|
->{'at'}; |
8413 |
|
|
|
8414 |
|
|
|
8415 |
wakaba |
1.3 |
} |
8416 |
wakaba |
1.1 |
|
8417 |
|
|
; |
8418 |
|
|
|
8419 |
|
|
|
8420 |
|
|
{ |
8421 |
|
|
|
8422 |
|
|
my |
8423 |
|
|
$v = $type || 0; |
8424 |
|
|
$r = bless \$v, |
8425 |
|
|
'Message::DOM::DOMCore::ManakaiDOMDTDTypeInfo' |
8426 |
|
|
; |
8427 |
|
|
|
8428 |
|
|
|
8429 |
wakaba |
1.3 |
} |
8430 |
wakaba |
1.1 |
|
8431 |
|
|
; |
8432 |
|
|
|
8433 |
|
|
|
8434 |
wakaba |
1.3 |
} |
8435 |
wakaba |
1.1 |
$r; |
8436 |
|
|
} else {my ($self) = @_; |
8437 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Element::ManakaiDOMAttr', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'schema_type_info'; |
8438 |
|
|
} |
8439 |
|
|
} |
8440 |
|
|
sub is_id ($;$) { |
8441 |
|
|
if (@_ == 1) {my ($self) = @_; |
8442 |
|
|
my $r = 0; |
8443 |
|
|
|
8444 |
|
|
{ |
8445 |
|
|
|
8446 |
|
|
T: |
8447 |
|
|
{ |
8448 |
|
|
## DTD Attribute Type |
8449 |
|
|
my $type; |
8450 |
|
|
|
8451 |
|
|
|
8452 |
|
|
{ |
8453 |
|
|
|
8454 |
|
|
|
8455 |
|
|
$type = $self->{ |
8456 |
|
|
'b' |
8457 |
|
|
}->{${$self->{ |
8458 |
|
|
'id' |
8459 |
|
|
}}} |
8460 |
|
|
->{'at'}; |
8461 |
|
|
|
8462 |
|
|
|
8463 |
wakaba |
1.3 |
} |
8464 |
wakaba |
1.1 |
|
8465 |
|
|
; |
8466 |
|
|
if (defined $type and $type == |
8467 |
wakaba |
1.6 |
2 |
8468 |
wakaba |
1.1 |
) { |
8469 |
|
|
$r = |
8470 |
|
|
1 |
8471 |
|
|
; |
8472 |
|
|
last T; |
8473 |
|
|
} |
8474 |
|
|
|
8475 |
|
|
## User-determined ID |
8476 |
|
|
my $udid; |
8477 |
|
|
|
8478 |
|
|
|
8479 |
|
|
{ |
8480 |
|
|
|
8481 |
|
|
|
8482 |
|
|
$udid = $self->{ |
8483 |
|
|
'b' |
8484 |
|
|
}->{${$self->{ |
8485 |
|
|
'id' |
8486 |
|
|
}}} |
8487 |
|
|
->{'isudid'}; |
8488 |
|
|
|
8489 |
|
|
|
8490 |
wakaba |
1.3 |
} |
8491 |
wakaba |
1.1 |
|
8492 |
|
|
; |
8493 |
|
|
if ($udid) { |
8494 |
|
|
$r = |
8495 |
|
|
1 |
8496 |
|
|
; |
8497 |
|
|
last T; |
8498 |
|
|
} |
8499 |
|
|
|
8500 |
|
|
## Application-determined ID |
8501 |
|
|
my $nsuri = $self-> |
8502 |
|
|
namespace_uri |
8503 |
|
|
; |
8504 |
|
|
my $ln = $self-> |
8505 |
|
|
local_name |
8506 |
|
|
; |
8507 |
|
|
if (defined $nsuri and $nsuri eq |
8508 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
8509 |
|
|
|
8510 |
|
|
$ln eq 'id') { |
8511 |
|
|
$r = |
8512 |
|
|
1 |
8513 |
|
|
; |
8514 |
|
|
last T; |
8515 |
|
|
} elsif (not defined $nsuri and $ln eq 'xml:id') { |
8516 |
|
|
$r = |
8517 |
|
|
1 |
8518 |
|
|
; |
8519 |
|
|
last T; |
8520 |
|
|
} |
8521 |
|
|
} # T |
8522 |
|
|
|
8523 |
|
|
|
8524 |
wakaba |
1.3 |
} |
8525 |
wakaba |
1.1 |
$r; |
8526 |
|
|
} else {my ($self, $given) = @_; |
8527 |
|
|
|
8528 |
|
|
{ |
8529 |
|
|
|
8530 |
|
|
|
8531 |
|
|
{ |
8532 |
|
|
|
8533 |
|
|
if |
8534 |
|
|
($self-> |
8535 |
|
|
manakai_read_only |
8536 |
|
|
) { |
8537 |
|
|
|
8538 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
8539 |
|
|
|
8540 |
|
|
; |
8541 |
|
|
} |
8542 |
|
|
|
8543 |
|
|
|
8544 |
wakaba |
1.3 |
} |
8545 |
wakaba |
1.1 |
|
8546 |
|
|
; |
8547 |
|
|
|
8548 |
|
|
|
8549 |
|
|
{ |
8550 |
|
|
|
8551 |
|
|
|
8552 |
|
|
$self->{ |
8553 |
|
|
'b' |
8554 |
|
|
}->{${$self->{ |
8555 |
|
|
'id' |
8556 |
|
|
}}} |
8557 |
|
|
->{'isudid'} = $given; |
8558 |
|
|
|
8559 |
|
|
|
8560 |
wakaba |
1.3 |
} |
8561 |
wakaba |
1.1 |
|
8562 |
|
|
; |
8563 |
|
|
|
8564 |
|
|
|
8565 |
wakaba |
1.3 |
} |
8566 |
wakaba |
1.1 |
} |
8567 |
|
|
} |
8568 |
|
|
sub manakai_attribute_type ($;$) { |
8569 |
|
|
if (@_ == 1) {my ($self) = @_; |
8570 |
|
|
my $r = 0; |
8571 |
|
|
|
8572 |
|
|
{ |
8573 |
|
|
|
8574 |
|
|
|
8575 |
|
|
{ |
8576 |
|
|
|
8577 |
|
|
|
8578 |
|
|
$r = $self->{ |
8579 |
|
|
'b' |
8580 |
|
|
}->{${$self->{ |
8581 |
|
|
'id' |
8582 |
|
|
}}} |
8583 |
|
|
->{'at'}; |
8584 |
|
|
|
8585 |
|
|
|
8586 |
wakaba |
1.3 |
} |
8587 |
wakaba |
1.1 |
|
8588 |
|
|
; |
8589 |
|
|
$r = |
8590 |
wakaba |
1.6 |
0 unless |
8591 |
wakaba |
1.1 |
defined $r; |
8592 |
|
|
|
8593 |
|
|
|
8594 |
wakaba |
1.3 |
} |
8595 |
wakaba |
1.1 |
$r; |
8596 |
|
|
} else {my ($self, $given) = @_; |
8597 |
|
|
|
8598 |
|
|
{ |
8599 |
|
|
|
8600 |
|
|
|
8601 |
|
|
{ |
8602 |
|
|
|
8603 |
|
|
if |
8604 |
|
|
($self-> |
8605 |
|
|
manakai_read_only |
8606 |
|
|
) { |
8607 |
|
|
|
8608 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
8609 |
|
|
|
8610 |
|
|
; |
8611 |
|
|
} |
8612 |
|
|
|
8613 |
|
|
|
8614 |
wakaba |
1.3 |
} |
8615 |
wakaba |
1.1 |
|
8616 |
|
|
; |
8617 |
|
|
|
8618 |
|
|
|
8619 |
|
|
{ |
8620 |
|
|
|
8621 |
|
|
|
8622 |
|
|
$self->{ |
8623 |
|
|
'b' |
8624 |
|
|
}->{${$self->{ |
8625 |
|
|
'id' |
8626 |
|
|
}}} |
8627 |
|
|
->{'at'} = $given; |
8628 |
|
|
|
8629 |
|
|
|
8630 |
wakaba |
1.3 |
} |
8631 |
wakaba |
1.1 |
|
8632 |
|
|
; |
8633 |
|
|
|
8634 |
|
|
|
8635 |
wakaba |
1.3 |
} |
8636 |
wakaba |
1.1 |
} |
8637 |
|
|
} |
8638 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMAttr>}->{has_feature} = {'core', |
8639 |
|
|
{'', |
8640 |
|
|
'1', |
8641 |
|
|
'1.0', |
8642 |
|
|
'1', |
8643 |
|
|
'2.0', |
8644 |
|
|
'1', |
8645 |
|
|
'3.0', |
8646 |
|
|
'1'}, |
8647 |
|
|
'xml', |
8648 |
|
|
{'', |
8649 |
|
|
'1', |
8650 |
|
|
'1.0', |
8651 |
|
|
'1', |
8652 |
|
|
'2.0', |
8653 |
|
|
'1', |
8654 |
|
|
'3.0', |
8655 |
|
|
'1'}, |
8656 |
|
|
'xmlversion', |
8657 |
|
|
{'', |
8658 |
|
|
'1', |
8659 |
|
|
'1.0', |
8660 |
|
|
'1', |
8661 |
|
|
'1.1', |
8662 |
|
|
'1'}}; |
8663 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Element::ManakaiDOMAttr>} = 14.1; |
8664 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMAttr>}->{compat_class}->{q<Message::DOM::Element::ManakaiDOMAttr>} = 1; |
8665 |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Element::ManakaiDOMAttr>} = {'o0', |
8666 |
|
|
['owner'], |
8667 |
|
|
's1a', |
8668 |
|
|
['child'], |
8669 |
|
|
'w0', |
8670 |
|
|
['od']}; |
8671 |
|
|
for ($Message::DOM::IF::Attr::, $Message::DOM::IF::Element::, $Message::DOM::IF::Node::, $Message::DOM::IFLatest::Node::, $Message::DOM::IFLevel1::Attr::, $Message::DOM::IFLevel1::Element::, $Message::DOM::IFLevel1::Node::, $Message::DOM::IFLevel2::Attr::, $Message::DOM::IFLevel2::Element::, $Message::DOM::IFLevel2::Node::, $Message::DOM::IFLevel3::Attr::, $Message::DOM::IFLevel3::Element::, $Message::DOM::IFLevel3::Node::){} |
8672 |
|
|
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
8673 |
|
|
1; |