1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
## This file is automatically generated |
3 |
wakaba |
1.11 |
## at 2006-12-02T09:40:02+00:00, |
4 |
|
|
## from file "../lib/Message/DOM/Document.dis", |
5 |
wakaba |
1.1 |
## module <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.Document>, |
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 |
|
|
require Message::DOM::TreeCore; |
11 |
|
|
require Message::Util::Error::DOMException; |
12 |
|
|
package Message::DOM::Document; |
13 |
wakaba |
1.11 |
our $VERSION = 20061202.0940; |
14 |
wakaba |
1.10 |
package Message::DOM::Document::ManakaiDOMImplementationDocument; |
15 |
wakaba |
1.11 |
our $VERSION = 20061202.0940; |
16 |
wakaba |
1.10 |
push @Message::DOM::DOMCore::ManakaiDOMImplementation::ISA, q<Message::DOM::Document::ManakaiDOMImplementationDocument> unless Message::DOM::DOMCore::ManakaiDOMImplementation->isa (q<Message::DOM::Document::ManakaiDOMImplementationDocument>); |
17 |
|
|
sub create_document ($;$$$) { |
18 |
|
|
my ($self, $namespaceURI, $qualifiedName, $doctype) = @_; |
19 |
|
|
|
20 |
|
|
{ |
21 |
|
|
|
22 |
|
|
if |
23 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
24 |
|
|
require Message::DOM::DOMMain; |
25 |
|
|
|
26 |
wakaba |
1.11 |
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:1165044229:30838:aqhmc7623+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
27 |
wakaba |
1.10 |
|
28 |
|
|
; |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
{ |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
$namespaceURI = undef; |
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
; |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
} |
46 |
|
|
my $r; |
47 |
|
|
|
48 |
|
|
{ |
49 |
|
|
|
50 |
|
|
my |
51 |
|
|
$bag = |
52 |
|
|
$self->{'b'} |
53 |
|
|
; |
54 |
|
|
my $stem; |
55 |
|
|
|
56 |
|
|
|
57 |
|
|
{ |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
$stem = 'Message::DOM::Document::ManakaiDOMDocument'->___create_node_stem ($bag, { |
61 |
|
|
|
62 |
|
|
'rc' |
63 |
|
|
=> 0, |
64 |
|
|
|
65 |
|
|
'id' |
66 |
|
|
=> \ |
67 |
|
|
( |
68 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
69 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
70 |
|
|
) |
71 |
|
|
, |
72 |
|
|
}, { |
73 |
|
|
'impl' => $self, |
74 |
|
|
}); |
75 |
|
|
|
76 |
|
|
|
77 |
|
|
{ |
78 |
|
|
|
79 |
|
|
if |
80 |
|
|
(defined 'Message::DOM::Document::ManakaiDOMDocument') { |
81 |
|
|
if (ref 'Message::DOM::Document::ManakaiDOMDocument' eq 'SCALAR') { |
82 |
|
|
$stem->{'cls'} = 'Message::DOM::Document::ManakaiDOMDocument'; |
83 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocument'}) { |
84 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocument'}; |
85 |
|
|
} else { |
86 |
|
|
require Scalar::Util; |
87 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocument'} = \('Message::DOM::Document::ManakaiDOMDocument'); |
88 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocument'}); |
89 |
|
|
} |
90 |
|
|
} else { |
91 |
|
|
CORE::delete $stem->{'cls'}; |
92 |
|
|
} |
93 |
|
|
|
94 |
|
|
|
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
; |
98 |
|
|
$bag->{${$stem->{ |
99 |
|
|
'id' |
100 |
|
|
}}} = $stem; |
101 |
|
|
|
102 |
|
|
|
103 |
|
|
} |
104 |
|
|
|
105 |
|
|
; |
106 |
|
|
|
107 |
|
|
|
108 |
|
|
{ |
109 |
|
|
|
110 |
|
|
|
111 |
|
|
$r = ${$stem->{ |
112 |
|
|
'cls' |
113 |
|
|
}}->___create_node_ref ({ |
114 |
|
|
|
115 |
|
|
'id' |
116 |
|
|
=> $stem->{ |
117 |
|
|
'id' |
118 |
|
|
}, |
119 |
|
|
|
120 |
|
|
'b' |
121 |
|
|
=> $bag, |
122 |
|
|
}, { |
123 |
|
|
}); |
124 |
|
|
$stem->{ |
125 |
|
|
'rc' |
126 |
|
|
}++; |
127 |
|
|
|
128 |
|
|
|
129 |
|
|
} |
130 |
|
|
|
131 |
|
|
; |
132 |
|
|
|
133 |
|
|
if (defined $doctype) { |
134 |
|
|
|
135 |
|
|
|
136 |
|
|
{ |
137 |
|
|
|
138 |
|
|
local $Error::Depth = $Error::Depth + 1; |
139 |
|
|
|
140 |
|
|
{ |
141 |
|
|
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
$r-> |
145 |
|
|
append_child |
146 |
|
|
($doctype); |
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
} |
151 |
|
|
|
152 |
|
|
|
153 |
|
|
;} |
154 |
|
|
|
155 |
|
|
; |
156 |
|
|
} |
157 |
|
|
|
158 |
|
|
if (defined $qualifiedName) { |
159 |
|
|
|
160 |
|
|
|
161 |
|
|
{ |
162 |
|
|
|
163 |
|
|
local $Error::Depth = $Error::Depth + 1; |
164 |
|
|
|
165 |
|
|
{ |
166 |
|
|
|
167 |
|
|
|
168 |
|
|
my |
169 |
|
|
$el = $r-> |
170 |
|
|
create_element_ns |
171 |
|
|
|
172 |
|
|
($namespaceURI, $qualifiedName); |
173 |
|
|
$r-> |
174 |
|
|
append_child |
175 |
|
|
($el); |
176 |
|
|
$r = $el-> |
177 |
|
|
owner_document |
178 |
|
|
; |
179 |
|
|
## Choose the class based on document element type |
180 |
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
} |
184 |
|
|
|
185 |
|
|
|
186 |
|
|
;} |
187 |
|
|
|
188 |
|
|
; |
189 |
|
|
} elsif (defined $namespaceURI) { |
190 |
|
|
|
191 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'create_document', 'http://www.w3.org/2001/04/infoset#namespaceURI' => $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_NULL_QNAME_WITH_NON_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMImplementationDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'namespaceURI'; |
192 |
|
|
|
193 |
|
|
; |
194 |
|
|
} |
195 |
|
|
|
196 |
|
|
|
197 |
|
|
} |
198 |
|
|
$r} |
199 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMImplementationDocument>}->{has_feature} = {}; |
200 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMImplementationDocument>} = 0; |
201 |
wakaba |
1.1 |
package Message::DOM::IFLatest::Document; |
202 |
wakaba |
1.11 |
our $VERSION = 20061202.0940; |
203 |
wakaba |
1.1 |
package Message::DOM::Document::ManakaiDOMDocument; |
204 |
wakaba |
1.11 |
our $VERSION = 20061202.0940; |
205 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
206 |
|
|
'Message::DOM::IF::Document', |
207 |
|
|
'Message::DOM::IF::Node', |
208 |
|
|
'Message::DOM::IFLatest::Document', |
209 |
|
|
'Message::DOM::IFLatest::Node', |
210 |
|
|
'Message::DOM::IFLevel1::Document', |
211 |
|
|
'Message::DOM::IFLevel1::Node', |
212 |
|
|
'Message::DOM::IFLevel2::Document', |
213 |
|
|
'Message::DOM::IFLevel2::Node', |
214 |
|
|
'Message::DOM::IFLevel3::Document', |
215 |
|
|
'Message::DOM::IFLevel3::Node'; |
216 |
|
|
sub ___create_node_stem ($$$$) { |
217 |
|
|
my ($self, $bag, $obj, $opt) = @_; |
218 |
|
|
my $r = {}; |
219 |
|
|
|
220 |
|
|
{ |
221 |
|
|
|
222 |
|
|
|
223 |
|
|
$obj->{ |
224 |
|
|
'child' |
225 |
|
|
} = []; |
226 |
|
|
$obj->{ |
227 |
|
|
'do' |
228 |
|
|
} = {}; |
229 |
|
|
$obj->{ |
230 |
|
|
'http://www.w3.org/2001/04/infoset#version' |
231 |
|
|
} = '1.0'; |
232 |
|
|
|
233 |
|
|
|
234 |
|
|
{ |
235 |
|
|
|
236 |
|
|
|
237 |
|
|
$obj->{'impl'} = $opt->{'impl'}->{ |
238 |
|
|
'id' |
239 |
|
|
}; |
240 |
|
|
$bag->{${$opt->{'impl'}->{ |
241 |
|
|
'id' |
242 |
|
|
}}} |
243 |
|
|
->{'lpmi'}->{${$obj->{ |
244 |
|
|
'id' |
245 |
|
|
}}} |
246 |
|
|
= $obj->{ |
247 |
|
|
'id' |
248 |
|
|
}; |
249 |
|
|
|
250 |
|
|
|
251 |
wakaba |
1.3 |
} |
252 |
wakaba |
1.1 |
|
253 |
|
|
; |
254 |
|
|
$r = $obj; |
255 |
|
|
|
256 |
|
|
|
257 |
wakaba |
1.3 |
} |
258 |
wakaba |
1.1 |
$r} |
259 |
|
|
sub node_type ($;$) { |
260 |
|
|
if (@_ == 1) {my ($self) = @_; |
261 |
|
|
my $r; |
262 |
wakaba |
1.7 |
$r = 9; |
263 |
wakaba |
1.1 |
$r; |
264 |
|
|
} else {my ($self) = @_; |
265 |
|
|
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::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
266 |
|
|
} |
267 |
|
|
} |
268 |
|
|
sub append_child ($$) { |
269 |
|
|
my ($self, $newChild) = @_; |
270 |
|
|
my $r; |
271 |
|
|
|
272 |
|
|
{ |
273 |
|
|
|
274 |
|
|
my |
275 |
|
|
$strictc = $self-> |
276 |
|
|
dom_config |
277 |
|
|
|
278 |
|
|
-> |
279 |
|
|
get_parameter |
280 |
|
|
|
281 |
|
|
( |
282 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
283 |
|
|
); |
284 |
|
|
my $child_od = $newChild-> |
285 |
|
|
owner_document |
286 |
|
|
|| $self; |
287 |
|
|
my $child_nt = $newChild-> |
288 |
|
|
node_type |
289 |
|
|
; |
290 |
|
|
if ($strictc and $self-> |
291 |
|
|
strict_error_checking |
292 |
|
|
) { |
293 |
|
|
|
294 |
|
|
|
295 |
|
|
{ |
296 |
|
|
|
297 |
|
|
local $Error::Depth = $Error::Depth + 1; |
298 |
|
|
|
299 |
|
|
{ |
300 |
|
|
|
301 |
|
|
|
302 |
|
|
my |
303 |
|
|
$has_el; |
304 |
|
|
my $has_dt; |
305 |
|
|
if ($child_nt == |
306 |
wakaba |
1.7 |
1 |
307 |
wakaba |
1.1 |
) { |
308 |
|
|
$has_el = |
309 |
|
|
1 |
310 |
|
|
; |
311 |
|
|
} elsif ($child_nt == |
312 |
wakaba |
1.7 |
10 |
313 |
wakaba |
1.1 |
) { |
314 |
|
|
$has_dt = |
315 |
|
|
1 |
316 |
|
|
; |
317 |
|
|
} elsif ($child_nt == |
318 |
wakaba |
1.7 |
11 |
319 |
wakaba |
1.1 |
) { |
320 |
|
|
for my $cn (@{$newChild-> |
321 |
|
|
child_nodes |
322 |
|
|
}) { |
323 |
|
|
my $cnt = $cn-> |
324 |
|
|
node_type |
325 |
|
|
; |
326 |
|
|
if ($cnt == |
327 |
wakaba |
1.7 |
1 |
328 |
wakaba |
1.1 |
) { |
329 |
|
|
if ($has_el) { |
330 |
|
|
|
331 |
|
|
|
332 |
|
|
{ |
333 |
|
|
|
334 |
|
|
local $Error::Depth = $Error::Depth - 1; |
335 |
|
|
|
336 |
|
|
{ |
337 |
|
|
|
338 |
|
|
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#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
339 |
|
|
|
340 |
|
|
|
341 |
wakaba |
1.3 |
} |
342 |
wakaba |
1.1 |
|
343 |
|
|
|
344 |
|
|
;} |
345 |
|
|
|
346 |
|
|
; |
347 |
|
|
} |
348 |
|
|
$has_el = |
349 |
|
|
1 |
350 |
|
|
; |
351 |
|
|
} |
352 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
353 |
|
|
} |
354 |
|
|
} |
355 |
|
|
|
356 |
|
|
if ($has_el) { |
357 |
|
|
my $anode = $self-> |
358 |
|
|
last_child |
359 |
|
|
; |
360 |
|
|
while (defined $anode) { |
361 |
|
|
if ($anode-> |
362 |
|
|
node_type |
363 |
|
|
== |
364 |
wakaba |
1.7 |
1 |
365 |
wakaba |
1.1 |
) { |
366 |
|
|
|
367 |
|
|
|
368 |
|
|
{ |
369 |
|
|
|
370 |
|
|
local $Error::Depth = $Error::Depth - 1; |
371 |
|
|
|
372 |
|
|
{ |
373 |
|
|
|
374 |
|
|
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#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
375 |
|
|
|
376 |
|
|
|
377 |
wakaba |
1.3 |
} |
378 |
wakaba |
1.1 |
|
379 |
|
|
|
380 |
|
|
;} |
381 |
|
|
|
382 |
|
|
; |
383 |
|
|
} |
384 |
|
|
$anode = $anode-> |
385 |
|
|
previous_sibling |
386 |
|
|
; |
387 |
|
|
} |
388 |
|
|
} # has_el |
389 |
|
|
if ($has_dt) { |
390 |
|
|
my $anode = $self-> |
391 |
|
|
last_child |
392 |
|
|
; |
393 |
|
|
while (defined $anode) { |
394 |
|
|
my $ant = $anode-> |
395 |
|
|
node_type |
396 |
|
|
; |
397 |
|
|
if ($ant == |
398 |
wakaba |
1.7 |
1 |
399 |
wakaba |
1.1 |
) { |
400 |
|
|
|
401 |
|
|
|
402 |
|
|
{ |
403 |
|
|
|
404 |
|
|
local $Error::Depth = $Error::Depth - 1; |
405 |
|
|
|
406 |
|
|
{ |
407 |
|
|
|
408 |
|
|
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/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
409 |
|
|
|
410 |
|
|
|
411 |
wakaba |
1.3 |
} |
412 |
wakaba |
1.1 |
|
413 |
|
|
|
414 |
|
|
;} |
415 |
|
|
|
416 |
|
|
; |
417 |
|
|
} elsif ($ant == |
418 |
wakaba |
1.7 |
10 |
419 |
wakaba |
1.1 |
) { |
420 |
|
|
|
421 |
|
|
|
422 |
|
|
{ |
423 |
|
|
|
424 |
|
|
local $Error::Depth = $Error::Depth - 1; |
425 |
|
|
|
426 |
|
|
{ |
427 |
|
|
|
428 |
|
|
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#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
429 |
|
|
|
430 |
|
|
|
431 |
wakaba |
1.3 |
} |
432 |
wakaba |
1.1 |
|
433 |
|
|
|
434 |
|
|
;} |
435 |
|
|
|
436 |
|
|
; |
437 |
|
|
} |
438 |
|
|
$anode = $anode-> |
439 |
|
|
previous_sibling |
440 |
|
|
; |
441 |
|
|
} |
442 |
|
|
} # has_dt |
443 |
|
|
|
444 |
|
|
|
445 |
|
|
|
446 |
wakaba |
1.3 |
} |
447 |
wakaba |
1.1 |
|
448 |
|
|
|
449 |
|
|
;} |
450 |
|
|
|
451 |
|
|
; |
452 |
|
|
} |
453 |
|
|
|
454 |
|
|
|
455 |
|
|
{ |
456 |
|
|
|
457 |
|
|
|
458 |
|
|
{ |
459 |
|
|
|
460 |
|
|
local $Error::Depth = $Error::Depth + 1; |
461 |
|
|
|
462 |
|
|
{ |
463 |
|
|
|
464 |
|
|
|
465 |
|
|
my |
466 |
|
|
$strict = $self-> |
467 |
|
|
strict_error_checking |
468 |
|
|
; |
469 |
|
|
|
470 |
|
|
## -- Node Type check |
471 |
|
|
my @new_child; |
472 |
|
|
if ({ |
473 |
wakaba |
1.7 |
3 => (not $strictc), |
474 |
|
|
5 => (not $strictc), |
475 |
|
|
1 => 1, |
476 |
|
|
4 => (not $strictc), |
477 |
|
|
7 => 1, |
478 |
|
|
8 => 1, |
479 |
|
|
10 => 1, |
480 |
wakaba |
1.1 |
}->{$child_nt}) { |
481 |
|
|
push @new_child, $newChild; |
482 |
|
|
} elsif ($child_nt == |
483 |
wakaba |
1.7 |
11 |
484 |
wakaba |
1.1 |
) { |
485 |
|
|
for my $cn (@{$newChild-> |
486 |
|
|
child_nodes |
487 |
|
|
}) { |
488 |
|
|
unless ({ |
489 |
wakaba |
1.7 |
3 => (not $strictc), |
490 |
|
|
5 => (not $strictc), |
491 |
|
|
1 => 1, |
492 |
|
|
4 => (not $strictc), |
493 |
|
|
7 => 1, |
494 |
|
|
8 => 1, |
495 |
|
|
10 => 1, |
496 |
wakaba |
1.1 |
}->{$cn-> |
497 |
|
|
node_type |
498 |
|
|
}) { |
499 |
|
|
|
500 |
|
|
|
501 |
|
|
{ |
502 |
|
|
|
503 |
|
|
local $Error::Depth = $Error::Depth - 1; |
504 |
|
|
|
505 |
|
|
{ |
506 |
|
|
|
507 |
|
|
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; |
508 |
|
|
|
509 |
|
|
|
510 |
wakaba |
1.3 |
} |
511 |
wakaba |
1.1 |
|
512 |
|
|
|
513 |
|
|
;} |
514 |
|
|
|
515 |
|
|
; |
516 |
|
|
} |
517 |
|
|
push @new_child, $cn; |
518 |
|
|
} |
519 |
|
|
} else { |
520 |
|
|
|
521 |
|
|
|
522 |
|
|
{ |
523 |
|
|
|
524 |
|
|
local $Error::Depth = $Error::Depth - 1; |
525 |
|
|
|
526 |
|
|
{ |
527 |
|
|
|
528 |
|
|
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; |
529 |
|
|
|
530 |
|
|
|
531 |
wakaba |
1.3 |
} |
532 |
wakaba |
1.1 |
|
533 |
|
|
|
534 |
|
|
;} |
535 |
|
|
|
536 |
|
|
; |
537 |
|
|
} |
538 |
|
|
|
539 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
540 |
|
|
parent_node |
541 |
|
|
: |
542 |
|
|
|
543 |
|
|
undef |
544 |
|
|
; |
545 |
|
|
if ($strict) { |
546 |
|
|
## -- Wrong-document check |
547 |
|
|
unless ($self eq $child_od) { |
548 |
|
|
|
549 |
|
|
|
550 |
|
|
{ |
551 |
|
|
|
552 |
|
|
local $Error::Depth = $Error::Depth - 1; |
553 |
|
|
|
554 |
|
|
{ |
555 |
|
|
|
556 |
|
|
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; |
557 |
|
|
|
558 |
|
|
|
559 |
wakaba |
1.3 |
} |
560 |
wakaba |
1.1 |
|
561 |
|
|
|
562 |
|
|
;} |
563 |
|
|
|
564 |
|
|
; |
565 |
|
|
} |
566 |
|
|
|
567 |
|
|
## -- Read-onlyness check |
568 |
|
|
if ($self-> |
569 |
|
|
manakai_read_only |
570 |
|
|
) { |
571 |
|
|
|
572 |
|
|
|
573 |
|
|
{ |
574 |
|
|
|
575 |
|
|
local $Error::Depth = $Error::Depth - 1; |
576 |
|
|
|
577 |
|
|
{ |
578 |
|
|
|
579 |
|
|
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'; |
580 |
|
|
|
581 |
|
|
|
582 |
wakaba |
1.3 |
} |
583 |
wakaba |
1.1 |
|
584 |
|
|
|
585 |
|
|
;} |
586 |
|
|
|
587 |
|
|
; |
588 |
|
|
} |
589 |
|
|
if (@new_child) { |
590 |
|
|
if ($nc_parent and |
591 |
|
|
$nc_parent-> |
592 |
|
|
manakai_read_only |
593 |
|
|
) { |
594 |
|
|
|
595 |
|
|
|
596 |
|
|
{ |
597 |
|
|
|
598 |
|
|
local $Error::Depth = $Error::Depth - 1; |
599 |
|
|
|
600 |
|
|
{ |
601 |
|
|
|
602 |
|
|
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'; |
603 |
|
|
|
604 |
|
|
|
605 |
wakaba |
1.3 |
} |
606 |
wakaba |
1.1 |
|
607 |
|
|
|
608 |
|
|
;} |
609 |
|
|
|
610 |
|
|
; |
611 |
|
|
} |
612 |
|
|
} |
613 |
|
|
} |
614 |
|
|
|
615 |
|
|
## -- Insert at... |
616 |
|
|
my $index = -1; # last |
617 |
|
|
|
618 |
|
|
|
619 |
|
|
; # FOR !tc:ForAppendChild |
620 |
|
|
|
621 |
|
|
## -- Removes from parent |
622 |
|
|
if ($nc_parent) { |
623 |
|
|
if ($child_nt == |
624 |
wakaba |
1.7 |
11 |
625 |
wakaba |
1.1 |
) { |
626 |
|
|
|
627 |
|
|
|
628 |
|
|
{ |
629 |
|
|
|
630 |
|
|
|
631 |
|
|
$newChild->{ |
632 |
|
|
'b' |
633 |
|
|
}->{${$newChild->{ |
634 |
|
|
'id' |
635 |
|
|
}}} |
636 |
|
|
->{'child'} = []; |
637 |
|
|
|
638 |
|
|
|
639 |
wakaba |
1.3 |
} |
640 |
wakaba |
1.1 |
|
641 |
|
|
; |
642 |
|
|
} else { |
643 |
|
|
my $v; |
644 |
|
|
|
645 |
|
|
|
646 |
|
|
{ |
647 |
|
|
|
648 |
|
|
|
649 |
|
|
$v = $nc_parent->{ |
650 |
|
|
'b' |
651 |
|
|
}->{${$nc_parent->{ |
652 |
|
|
'id' |
653 |
|
|
}}} |
654 |
|
|
->{'child'}; |
655 |
|
|
|
656 |
|
|
|
657 |
wakaba |
1.3 |
} |
658 |
wakaba |
1.1 |
|
659 |
|
|
; |
660 |
|
|
RP: for my $i (0..$#$v) { |
661 |
|
|
my $nodeid = $v->[$i]; |
662 |
|
|
if ( |
663 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
664 |
|
|
) { |
665 |
|
|
splice @$v, $i, 1, (); |
666 |
|
|
last RP; |
667 |
|
|
} |
668 |
|
|
} # RP |
669 |
|
|
} |
670 |
|
|
} |
671 |
|
|
|
672 |
|
|
## -- Rewrite the |parentNode| properties |
673 |
|
|
for my $nc (@new_child) { |
674 |
|
|
|
675 |
|
|
|
676 |
|
|
{ |
677 |
|
|
|
678 |
|
|
|
679 |
|
|
$nc->{ |
680 |
|
|
'b' |
681 |
|
|
}->{${$nc->{ |
682 |
|
|
'id' |
683 |
|
|
}}} |
684 |
|
|
->{'parent'} = $self->{ |
685 |
|
|
'id' |
686 |
|
|
}; |
687 |
|
|
|
688 |
|
|
|
689 |
wakaba |
1.3 |
} |
690 |
wakaba |
1.1 |
|
691 |
|
|
; |
692 |
|
|
} |
693 |
|
|
|
694 |
|
|
my $children; |
695 |
|
|
|
696 |
|
|
|
697 |
|
|
{ |
698 |
|
|
|
699 |
|
|
|
700 |
|
|
$children = $self->{ |
701 |
|
|
'b' |
702 |
|
|
}->{${$self->{ |
703 |
|
|
'id' |
704 |
|
|
}}} |
705 |
|
|
->{'child'}; |
706 |
|
|
|
707 |
|
|
|
708 |
wakaba |
1.3 |
} |
709 |
wakaba |
1.1 |
|
710 |
|
|
; |
711 |
|
|
|
712 |
|
|
|
713 |
|
|
|
714 |
|
|
{ |
715 |
|
|
|
716 |
|
|
|
717 |
|
|
## -- Adds to children list |
718 |
|
|
push @$children, map { |
719 |
|
|
|
720 |
|
|
$_->{'id'} |
721 |
|
|
|
722 |
|
|
} @new_child; |
723 |
|
|
$r = $newChild; |
724 |
|
|
|
725 |
|
|
|
726 |
|
|
|
727 |
wakaba |
1.3 |
} |
728 |
wakaba |
1.1 |
|
729 |
|
|
; |
730 |
|
|
|
731 |
|
|
|
732 |
|
|
|
733 |
|
|
; |
734 |
|
|
|
735 |
|
|
|
736 |
|
|
|
737 |
|
|
; |
738 |
|
|
|
739 |
|
|
|
740 |
|
|
|
741 |
wakaba |
1.3 |
} |
742 |
wakaba |
1.1 |
|
743 |
|
|
|
744 |
|
|
;} |
745 |
|
|
|
746 |
|
|
; |
747 |
|
|
|
748 |
|
|
|
749 |
wakaba |
1.3 |
} |
750 |
wakaba |
1.1 |
|
751 |
|
|
; |
752 |
|
|
if ($child_nt == |
753 |
wakaba |
1.7 |
10 and |
754 |
wakaba |
1.1 |
|
755 |
|
|
not defined $newChild-> |
756 |
|
|
owner_document |
757 |
|
|
) { |
758 |
|
|
my $bag = |
759 |
|
|
$self->{'b'} |
760 |
|
|
; |
761 |
|
|
|
762 |
|
|
|
763 |
|
|
{ |
764 |
|
|
|
765 |
|
|
CORE::delete |
766 |
|
|
$bag->{${$bag->{${$newChild->{ |
767 |
|
|
'id' |
768 |
|
|
}}} |
769 |
|
|
->{'impl'} or \''}} |
770 |
|
|
->{'lpmi'}; |
771 |
wakaba |
1.2 |
$bag->{ |
772 |
wakaba |
1.1 |
'm' |
773 |
wakaba |
1.3 |
}++; |
774 |
wakaba |
1.1 |
CORE::delete $bag->{${$newChild->{ |
775 |
|
|
'id' |
776 |
|
|
}}} |
777 |
|
|
->{'impl'}; |
778 |
|
|
|
779 |
|
|
|
780 |
wakaba |
1.3 |
} |
781 |
wakaba |
1.1 |
|
782 |
|
|
; |
783 |
|
|
|
784 |
|
|
|
785 |
|
|
{ |
786 |
|
|
|
787 |
|
|
|
788 |
|
|
$bag->{${$newChild->{ |
789 |
|
|
'id' |
790 |
|
|
}}}->{'od'} |
791 |
|
|
= $self->{ |
792 |
|
|
'id' |
793 |
|
|
}; |
794 |
|
|
$bag->{${$self->{ |
795 |
|
|
'id' |
796 |
|
|
}}} |
797 |
|
|
->{'do'}->{${$newChild->{ |
798 |
|
|
'id' |
799 |
|
|
}}} |
800 |
|
|
= $newChild->{ |
801 |
|
|
'id' |
802 |
|
|
}; |
803 |
|
|
|
804 |
|
|
|
805 |
wakaba |
1.3 |
} |
806 |
wakaba |
1.1 |
|
807 |
|
|
; |
808 |
|
|
} |
809 |
|
|
|
810 |
|
|
|
811 |
wakaba |
1.3 |
} |
812 |
wakaba |
1.1 |
$r} |
813 |
|
|
sub insert_before ($$;$) { |
814 |
|
|
my ($self, $newChild, $refChild) = @_; |
815 |
|
|
my $r; |
816 |
|
|
|
817 |
|
|
{ |
818 |
|
|
|
819 |
|
|
my |
820 |
|
|
$strictc = $self-> |
821 |
|
|
dom_config |
822 |
|
|
|
823 |
|
|
-> |
824 |
|
|
get_parameter |
825 |
|
|
|
826 |
|
|
( |
827 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
828 |
|
|
); |
829 |
|
|
my $child_od = $newChild-> |
830 |
|
|
owner_document |
831 |
|
|
|| $self; |
832 |
|
|
my $child_nt = $newChild-> |
833 |
|
|
node_type |
834 |
|
|
; |
835 |
|
|
if ($strictc and $self-> |
836 |
|
|
strict_error_checking |
837 |
|
|
) { |
838 |
|
|
|
839 |
|
|
|
840 |
|
|
{ |
841 |
|
|
|
842 |
|
|
local $Error::Depth = $Error::Depth + 1; |
843 |
|
|
|
844 |
|
|
{ |
845 |
|
|
|
846 |
|
|
|
847 |
|
|
my |
848 |
|
|
$has_el; |
849 |
|
|
my $has_dt; |
850 |
|
|
if ($child_nt == |
851 |
wakaba |
1.7 |
1 |
852 |
wakaba |
1.1 |
) { |
853 |
|
|
$has_el = |
854 |
|
|
1 |
855 |
|
|
; |
856 |
|
|
} elsif ($child_nt == |
857 |
wakaba |
1.7 |
10 |
858 |
wakaba |
1.1 |
) { |
859 |
|
|
$has_dt = |
860 |
|
|
1 |
861 |
|
|
; |
862 |
|
|
} elsif ($child_nt == |
863 |
wakaba |
1.7 |
11 |
864 |
wakaba |
1.1 |
) { |
865 |
|
|
for my $cn (@{$newChild-> |
866 |
|
|
child_nodes |
867 |
|
|
}) { |
868 |
|
|
my $cnt = $cn-> |
869 |
|
|
node_type |
870 |
|
|
; |
871 |
|
|
if ($cnt == |
872 |
wakaba |
1.7 |
1 |
873 |
wakaba |
1.1 |
) { |
874 |
|
|
if ($has_el) { |
875 |
|
|
|
876 |
|
|
|
877 |
|
|
{ |
878 |
|
|
|
879 |
|
|
local $Error::Depth = $Error::Depth - 1; |
880 |
|
|
|
881 |
|
|
{ |
882 |
|
|
|
883 |
|
|
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#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
884 |
|
|
|
885 |
|
|
|
886 |
wakaba |
1.3 |
} |
887 |
wakaba |
1.1 |
|
888 |
|
|
|
889 |
|
|
;} |
890 |
|
|
|
891 |
|
|
; |
892 |
|
|
} |
893 |
|
|
$has_el = |
894 |
|
|
1 |
895 |
|
|
; |
896 |
|
|
} |
897 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
898 |
|
|
} |
899 |
|
|
} |
900 |
|
|
|
901 |
|
|
if ($has_el) { |
902 |
|
|
my $anode = $refChild ? $refChild-> |
903 |
|
|
previous_sibling |
904 |
|
|
: |
905 |
|
|
$self-> |
906 |
|
|
last_child |
907 |
|
|
; |
908 |
|
|
while (defined $anode) { |
909 |
|
|
if ($anode-> |
910 |
|
|
node_type |
911 |
|
|
== |
912 |
wakaba |
1.7 |
1 |
913 |
wakaba |
1.1 |
) { |
914 |
|
|
|
915 |
|
|
|
916 |
|
|
{ |
917 |
|
|
|
918 |
|
|
local $Error::Depth = $Error::Depth - 1; |
919 |
|
|
|
920 |
|
|
{ |
921 |
|
|
|
922 |
|
|
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#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
923 |
|
|
|
924 |
|
|
|
925 |
wakaba |
1.3 |
} |
926 |
wakaba |
1.1 |
|
927 |
|
|
|
928 |
|
|
;} |
929 |
|
|
|
930 |
|
|
; |
931 |
|
|
} |
932 |
|
|
$anode = $anode-> |
933 |
|
|
previous_sibling |
934 |
|
|
; |
935 |
|
|
} |
936 |
|
|
$anode = $refChild; |
937 |
|
|
while (defined $anode) { |
938 |
|
|
my $ant = $anode-> |
939 |
|
|
node_type |
940 |
|
|
; |
941 |
|
|
if ($ant == |
942 |
wakaba |
1.7 |
1 |
943 |
wakaba |
1.1 |
) { |
944 |
|
|
|
945 |
|
|
|
946 |
|
|
{ |
947 |
|
|
|
948 |
|
|
local $Error::Depth = $Error::Depth - 1; |
949 |
|
|
|
950 |
|
|
{ |
951 |
|
|
|
952 |
|
|
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#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
953 |
|
|
|
954 |
|
|
|
955 |
wakaba |
1.3 |
} |
956 |
wakaba |
1.1 |
|
957 |
|
|
|
958 |
|
|
;} |
959 |
|
|
|
960 |
|
|
; |
961 |
|
|
} elsif ($ant == |
962 |
wakaba |
1.7 |
10 |
963 |
wakaba |
1.1 |
) { |
964 |
|
|
|
965 |
|
|
|
966 |
|
|
{ |
967 |
|
|
|
968 |
|
|
local $Error::Depth = $Error::Depth - 1; |
969 |
|
|
|
970 |
|
|
{ |
971 |
|
|
|
972 |
|
|
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/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
973 |
|
|
|
974 |
|
|
|
975 |
wakaba |
1.3 |
} |
976 |
wakaba |
1.1 |
|
977 |
|
|
|
978 |
|
|
;} |
979 |
|
|
|
980 |
|
|
; |
981 |
|
|
} |
982 |
|
|
$anode = $anode-> |
983 |
|
|
next_sibling |
984 |
|
|
; |
985 |
|
|
} |
986 |
|
|
} # has_el |
987 |
|
|
if ($has_dt) { |
988 |
|
|
my $anode = $refChild ? $refChild-> |
989 |
|
|
previous_sibling |
990 |
|
|
: |
991 |
|
|
$self-> |
992 |
|
|
last_child |
993 |
|
|
; |
994 |
|
|
while (defined $anode) { |
995 |
|
|
my $ant = $anode-> |
996 |
|
|
node_type |
997 |
|
|
; |
998 |
|
|
if ($ant == |
999 |
wakaba |
1.7 |
1 |
1000 |
wakaba |
1.1 |
) { |
1001 |
|
|
|
1002 |
|
|
|
1003 |
|
|
{ |
1004 |
|
|
|
1005 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1006 |
|
|
|
1007 |
|
|
{ |
1008 |
|
|
|
1009 |
|
|
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/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1010 |
|
|
|
1011 |
|
|
|
1012 |
wakaba |
1.3 |
} |
1013 |
wakaba |
1.1 |
|
1014 |
|
|
|
1015 |
|
|
;} |
1016 |
|
|
|
1017 |
|
|
; |
1018 |
|
|
} elsif ($ant == |
1019 |
wakaba |
1.7 |
10 |
1020 |
wakaba |
1.1 |
) { |
1021 |
|
|
|
1022 |
|
|
|
1023 |
|
|
{ |
1024 |
|
|
|
1025 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1026 |
|
|
|
1027 |
|
|
{ |
1028 |
|
|
|
1029 |
|
|
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#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1030 |
|
|
|
1031 |
|
|
|
1032 |
wakaba |
1.3 |
} |
1033 |
wakaba |
1.1 |
|
1034 |
|
|
|
1035 |
|
|
;} |
1036 |
|
|
|
1037 |
|
|
; |
1038 |
|
|
} |
1039 |
|
|
$anode = $anode-> |
1040 |
|
|
previous_sibling |
1041 |
|
|
; |
1042 |
|
|
} |
1043 |
|
|
$anode = $refChild; |
1044 |
|
|
while (defined $anode) { |
1045 |
|
|
if ($anode-> |
1046 |
|
|
node_type |
1047 |
|
|
|
1048 |
|
|
== |
1049 |
wakaba |
1.7 |
10 |
1050 |
wakaba |
1.1 |
) { |
1051 |
|
|
|
1052 |
|
|
|
1053 |
|
|
{ |
1054 |
|
|
|
1055 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1056 |
|
|
|
1057 |
|
|
{ |
1058 |
|
|
|
1059 |
|
|
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#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1060 |
|
|
|
1061 |
|
|
|
1062 |
wakaba |
1.3 |
} |
1063 |
wakaba |
1.1 |
|
1064 |
|
|
|
1065 |
|
|
;} |
1066 |
|
|
|
1067 |
|
|
; |
1068 |
|
|
} |
1069 |
|
|
$anode = $anode-> |
1070 |
|
|
next_sibling |
1071 |
|
|
; |
1072 |
|
|
} |
1073 |
|
|
} # has_dt |
1074 |
|
|
|
1075 |
|
|
|
1076 |
|
|
|
1077 |
wakaba |
1.3 |
} |
1078 |
wakaba |
1.1 |
|
1079 |
|
|
|
1080 |
|
|
;} |
1081 |
|
|
|
1082 |
|
|
; |
1083 |
|
|
} |
1084 |
|
|
|
1085 |
|
|
|
1086 |
|
|
{ |
1087 |
|
|
|
1088 |
|
|
|
1089 |
|
|
{ |
1090 |
|
|
|
1091 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1092 |
|
|
|
1093 |
|
|
{ |
1094 |
|
|
|
1095 |
|
|
|
1096 |
|
|
my |
1097 |
|
|
$strict = $self-> |
1098 |
|
|
strict_error_checking |
1099 |
|
|
; |
1100 |
|
|
|
1101 |
|
|
## -- Node Type check |
1102 |
|
|
my @new_child; |
1103 |
|
|
if ({ |
1104 |
wakaba |
1.7 |
3 => (not $strictc), |
1105 |
|
|
5 => (not $strictc), |
1106 |
|
|
1 => 1, |
1107 |
|
|
4 => (not $strictc), |
1108 |
|
|
7 => 1, |
1109 |
|
|
8 => 1, |
1110 |
|
|
10 => 1, |
1111 |
wakaba |
1.1 |
}->{$child_nt}) { |
1112 |
|
|
push @new_child, $newChild; |
1113 |
|
|
} elsif ($child_nt == |
1114 |
wakaba |
1.7 |
11 |
1115 |
wakaba |
1.1 |
) { |
1116 |
|
|
for my $cn (@{$newChild-> |
1117 |
|
|
child_nodes |
1118 |
|
|
}) { |
1119 |
|
|
unless ({ |
1120 |
wakaba |
1.7 |
3 => (not $strictc), |
1121 |
|
|
5 => (not $strictc), |
1122 |
|
|
1 => 1, |
1123 |
|
|
4 => (not $strictc), |
1124 |
|
|
7 => 1, |
1125 |
|
|
8 => 1, |
1126 |
|
|
10 => 1, |
1127 |
wakaba |
1.1 |
}->{$cn-> |
1128 |
|
|
node_type |
1129 |
|
|
}) { |
1130 |
|
|
|
1131 |
|
|
|
1132 |
|
|
{ |
1133 |
|
|
|
1134 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1135 |
|
|
|
1136 |
|
|
{ |
1137 |
|
|
|
1138 |
|
|
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; |
1139 |
|
|
|
1140 |
|
|
|
1141 |
wakaba |
1.3 |
} |
1142 |
wakaba |
1.1 |
|
1143 |
|
|
|
1144 |
|
|
;} |
1145 |
|
|
|
1146 |
|
|
; |
1147 |
|
|
} |
1148 |
|
|
push @new_child, $cn; |
1149 |
|
|
} |
1150 |
|
|
} else { |
1151 |
|
|
|
1152 |
|
|
|
1153 |
|
|
{ |
1154 |
|
|
|
1155 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1156 |
|
|
|
1157 |
|
|
{ |
1158 |
|
|
|
1159 |
|
|
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; |
1160 |
|
|
|
1161 |
|
|
|
1162 |
wakaba |
1.3 |
} |
1163 |
wakaba |
1.1 |
|
1164 |
|
|
|
1165 |
|
|
;} |
1166 |
|
|
|
1167 |
|
|
; |
1168 |
|
|
} |
1169 |
|
|
|
1170 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
1171 |
|
|
parent_node |
1172 |
|
|
: |
1173 |
|
|
|
1174 |
|
|
undef |
1175 |
|
|
; |
1176 |
|
|
if ($strict) { |
1177 |
|
|
## -- Wrong-document check |
1178 |
|
|
unless ($self eq $child_od) { |
1179 |
|
|
|
1180 |
|
|
|
1181 |
|
|
{ |
1182 |
|
|
|
1183 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1184 |
|
|
|
1185 |
|
|
{ |
1186 |
|
|
|
1187 |
|
|
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; |
1188 |
|
|
|
1189 |
|
|
|
1190 |
wakaba |
1.3 |
} |
1191 |
wakaba |
1.1 |
|
1192 |
|
|
|
1193 |
|
|
;} |
1194 |
|
|
|
1195 |
|
|
; |
1196 |
|
|
} |
1197 |
|
|
|
1198 |
|
|
## -- Read-onlyness check |
1199 |
|
|
if ($self-> |
1200 |
|
|
manakai_read_only |
1201 |
|
|
) { |
1202 |
|
|
|
1203 |
|
|
|
1204 |
|
|
{ |
1205 |
|
|
|
1206 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1207 |
|
|
|
1208 |
|
|
{ |
1209 |
|
|
|
1210 |
|
|
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'; |
1211 |
|
|
|
1212 |
|
|
|
1213 |
wakaba |
1.3 |
} |
1214 |
wakaba |
1.1 |
|
1215 |
|
|
|
1216 |
|
|
;} |
1217 |
|
|
|
1218 |
|
|
; |
1219 |
|
|
} |
1220 |
|
|
if (@new_child) { |
1221 |
|
|
if ($nc_parent and |
1222 |
|
|
$nc_parent-> |
1223 |
|
|
manakai_read_only |
1224 |
|
|
) { |
1225 |
|
|
|
1226 |
|
|
|
1227 |
|
|
{ |
1228 |
|
|
|
1229 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1230 |
|
|
|
1231 |
|
|
{ |
1232 |
|
|
|
1233 |
|
|
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'; |
1234 |
|
|
|
1235 |
|
|
|
1236 |
wakaba |
1.3 |
} |
1237 |
wakaba |
1.1 |
|
1238 |
|
|
|
1239 |
|
|
;} |
1240 |
|
|
|
1241 |
|
|
; |
1242 |
|
|
} |
1243 |
|
|
} |
1244 |
|
|
} |
1245 |
|
|
|
1246 |
|
|
## -- Insert at... |
1247 |
|
|
my $index = -1; # last |
1248 |
|
|
|
1249 |
|
|
|
1250 |
|
|
{ |
1251 |
|
|
|
1252 |
|
|
|
1253 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
1254 |
|
|
if (defined $refChild) { |
1255 |
|
|
if ($refChild eq $newChild) { |
1256 |
|
|
|
1257 |
|
|
|
1258 |
|
|
{ |
1259 |
|
|
|
1260 |
|
|
|
1261 |
|
|
{ |
1262 |
|
|
|
1263 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1264 |
|
|
|
1265 |
|
|
{ |
1266 |
|
|
|
1267 |
|
|
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'; |
1268 |
|
|
|
1269 |
|
|
|
1270 |
wakaba |
1.3 |
} |
1271 |
wakaba |
1.1 |
|
1272 |
|
|
|
1273 |
|
|
;} |
1274 |
|
|
|
1275 |
|
|
; |
1276 |
|
|
|
1277 |
|
|
|
1278 |
|
|
|
1279 |
wakaba |
1.3 |
} |
1280 |
wakaba |
1.1 |
|
1281 |
|
|
; |
1282 |
|
|
|
1283 |
|
|
|
1284 |
|
|
; |
1285 |
|
|
} |
1286 |
|
|
|
1287 |
|
|
my $cns = $self-> |
1288 |
|
|
child_nodes |
1289 |
|
|
; |
1290 |
|
|
my $cnsl = @$cns; |
1291 |
|
|
C: { |
1292 |
|
|
$index = 0; |
1293 |
|
|
for my $i (0..($cnsl-1)) { |
1294 |
|
|
my $cn = $cns->[$i]; |
1295 |
|
|
if ($cn eq $refChild) { |
1296 |
|
|
$index += $i; |
1297 |
|
|
last C; |
1298 |
|
|
} elsif ($cn eq $newChild) { |
1299 |
|
|
$index = -1; # offset |
1300 |
|
|
} |
1301 |
|
|
} |
1302 |
|
|
|
1303 |
|
|
|
1304 |
|
|
{ |
1305 |
|
|
|
1306 |
|
|
|
1307 |
|
|
{ |
1308 |
|
|
|
1309 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1310 |
|
|
|
1311 |
|
|
{ |
1312 |
|
|
|
1313 |
|
|
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; |
1314 |
|
|
|
1315 |
|
|
|
1316 |
wakaba |
1.3 |
} |
1317 |
wakaba |
1.1 |
|
1318 |
|
|
|
1319 |
|
|
;} |
1320 |
|
|
|
1321 |
|
|
; |
1322 |
|
|
|
1323 |
|
|
|
1324 |
|
|
|
1325 |
wakaba |
1.3 |
} |
1326 |
wakaba |
1.1 |
|
1327 |
|
|
; |
1328 |
|
|
|
1329 |
|
|
|
1330 |
|
|
; |
1331 |
|
|
} # C |
1332 |
|
|
} else { # |oldChild| is not defined |
1333 |
|
|
|
1334 |
|
|
|
1335 |
|
|
; |
1336 |
|
|
} |
1337 |
|
|
|
1338 |
|
|
|
1339 |
|
|
|
1340 |
wakaba |
1.3 |
} |
1341 |
wakaba |
1.1 |
|
1342 |
|
|
; # FOR !tc:ForAppendChild |
1343 |
|
|
|
1344 |
|
|
## -- Removes from parent |
1345 |
|
|
if ($nc_parent) { |
1346 |
|
|
if ($child_nt == |
1347 |
wakaba |
1.7 |
11 |
1348 |
wakaba |
1.1 |
) { |
1349 |
|
|
|
1350 |
|
|
|
1351 |
|
|
{ |
1352 |
|
|
|
1353 |
|
|
|
1354 |
|
|
$newChild->{ |
1355 |
|
|
'b' |
1356 |
|
|
}->{${$newChild->{ |
1357 |
|
|
'id' |
1358 |
|
|
}}} |
1359 |
|
|
->{'child'} = []; |
1360 |
|
|
|
1361 |
|
|
|
1362 |
wakaba |
1.3 |
} |
1363 |
wakaba |
1.1 |
|
1364 |
|
|
; |
1365 |
|
|
} else { |
1366 |
|
|
my $v; |
1367 |
|
|
|
1368 |
|
|
|
1369 |
|
|
{ |
1370 |
|
|
|
1371 |
|
|
|
1372 |
|
|
$v = $nc_parent->{ |
1373 |
|
|
'b' |
1374 |
|
|
}->{${$nc_parent->{ |
1375 |
|
|
'id' |
1376 |
|
|
}}} |
1377 |
|
|
->{'child'}; |
1378 |
|
|
|
1379 |
|
|
|
1380 |
wakaba |
1.3 |
} |
1381 |
wakaba |
1.1 |
|
1382 |
|
|
; |
1383 |
|
|
RP: for my $i (0..$#$v) { |
1384 |
|
|
my $nodeid = $v->[$i]; |
1385 |
|
|
if ( |
1386 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
1387 |
|
|
) { |
1388 |
|
|
splice @$v, $i, 1, (); |
1389 |
|
|
last RP; |
1390 |
|
|
} |
1391 |
|
|
} # RP |
1392 |
|
|
} |
1393 |
|
|
} |
1394 |
|
|
|
1395 |
|
|
## -- Rewrite the |parentNode| properties |
1396 |
|
|
for my $nc (@new_child) { |
1397 |
|
|
|
1398 |
|
|
|
1399 |
|
|
{ |
1400 |
|
|
|
1401 |
|
|
|
1402 |
|
|
$nc->{ |
1403 |
|
|
'b' |
1404 |
|
|
}->{${$nc->{ |
1405 |
|
|
'id' |
1406 |
|
|
}}} |
1407 |
|
|
->{'parent'} = $self->{ |
1408 |
|
|
'id' |
1409 |
|
|
}; |
1410 |
|
|
|
1411 |
|
|
|
1412 |
wakaba |
1.3 |
} |
1413 |
wakaba |
1.1 |
|
1414 |
|
|
; |
1415 |
|
|
} |
1416 |
|
|
|
1417 |
|
|
my $children; |
1418 |
|
|
|
1419 |
|
|
|
1420 |
|
|
{ |
1421 |
|
|
|
1422 |
|
|
|
1423 |
|
|
$children = $self->{ |
1424 |
|
|
'b' |
1425 |
|
|
}->{${$self->{ |
1426 |
|
|
'id' |
1427 |
|
|
}}} |
1428 |
|
|
->{'child'}; |
1429 |
|
|
|
1430 |
|
|
|
1431 |
wakaba |
1.3 |
} |
1432 |
wakaba |
1.1 |
|
1433 |
|
|
; |
1434 |
|
|
|
1435 |
|
|
|
1436 |
|
|
|
1437 |
|
|
; |
1438 |
|
|
|
1439 |
|
|
|
1440 |
|
|
|
1441 |
|
|
{ |
1442 |
|
|
|
1443 |
|
|
|
1444 |
|
|
## -- Adds to children list |
1445 |
|
|
if ($index == -1) { |
1446 |
|
|
push @$children, map { |
1447 |
|
|
|
1448 |
|
|
$_->{'id'} |
1449 |
|
|
|
1450 |
|
|
} @new_child; |
1451 |
|
|
} else { |
1452 |
|
|
splice @$children, $index, 0, map { |
1453 |
|
|
|
1454 |
|
|
$_->{'id'} |
1455 |
|
|
|
1456 |
|
|
} @new_child; |
1457 |
|
|
} |
1458 |
|
|
$r = $newChild; |
1459 |
|
|
|
1460 |
|
|
|
1461 |
|
|
|
1462 |
wakaba |
1.3 |
} |
1463 |
wakaba |
1.1 |
|
1464 |
|
|
; |
1465 |
|
|
|
1466 |
|
|
|
1467 |
|
|
|
1468 |
|
|
; |
1469 |
|
|
|
1470 |
|
|
|
1471 |
|
|
|
1472 |
wakaba |
1.3 |
} |
1473 |
wakaba |
1.1 |
|
1474 |
|
|
|
1475 |
|
|
;} |
1476 |
|
|
|
1477 |
|
|
; |
1478 |
|
|
|
1479 |
|
|
|
1480 |
wakaba |
1.3 |
} |
1481 |
wakaba |
1.1 |
|
1482 |
|
|
; |
1483 |
|
|
if ($child_nt == |
1484 |
wakaba |
1.7 |
10 and |
1485 |
wakaba |
1.1 |
|
1486 |
|
|
not defined $newChild-> |
1487 |
|
|
owner_document |
1488 |
|
|
) { |
1489 |
|
|
my $bag = |
1490 |
|
|
$self->{'b'} |
1491 |
|
|
; |
1492 |
|
|
|
1493 |
|
|
|
1494 |
|
|
{ |
1495 |
|
|
|
1496 |
|
|
CORE::delete |
1497 |
|
|
$bag->{${$bag->{${$newChild->{ |
1498 |
|
|
'id' |
1499 |
|
|
}}} |
1500 |
|
|
->{'impl'} or \''}} |
1501 |
|
|
->{'lpmi'}; |
1502 |
wakaba |
1.2 |
$bag->{ |
1503 |
wakaba |
1.1 |
'm' |
1504 |
wakaba |
1.3 |
}++; |
1505 |
wakaba |
1.1 |
CORE::delete $bag->{${$newChild->{ |
1506 |
|
|
'id' |
1507 |
|
|
}}} |
1508 |
|
|
->{'impl'}; |
1509 |
|
|
|
1510 |
|
|
|
1511 |
wakaba |
1.3 |
} |
1512 |
wakaba |
1.1 |
|
1513 |
|
|
; |
1514 |
|
|
|
1515 |
|
|
|
1516 |
|
|
{ |
1517 |
|
|
|
1518 |
|
|
|
1519 |
|
|
$bag->{${$newChild->{ |
1520 |
|
|
'id' |
1521 |
|
|
}}}->{'od'} |
1522 |
|
|
= $self->{ |
1523 |
|
|
'id' |
1524 |
|
|
}; |
1525 |
|
|
$bag->{${$self->{ |
1526 |
|
|
'id' |
1527 |
|
|
}}} |
1528 |
|
|
->{'do'}->{${$newChild->{ |
1529 |
|
|
'id' |
1530 |
|
|
}}} |
1531 |
|
|
= $newChild->{ |
1532 |
|
|
'id' |
1533 |
|
|
}; |
1534 |
|
|
|
1535 |
|
|
|
1536 |
wakaba |
1.3 |
} |
1537 |
wakaba |
1.1 |
|
1538 |
|
|
; |
1539 |
|
|
} |
1540 |
|
|
|
1541 |
|
|
|
1542 |
wakaba |
1.3 |
} |
1543 |
wakaba |
1.1 |
$r} |
1544 |
|
|
sub replace_child ($$$) { |
1545 |
|
|
my ($self, $newChild, $oldChild) = @_; |
1546 |
|
|
my $r; |
1547 |
|
|
|
1548 |
|
|
{ |
1549 |
|
|
|
1550 |
|
|
my |
1551 |
|
|
$strictc = $self-> |
1552 |
|
|
dom_config |
1553 |
|
|
|
1554 |
|
|
-> |
1555 |
|
|
get_parameter |
1556 |
|
|
|
1557 |
|
|
( |
1558 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
1559 |
|
|
); |
1560 |
|
|
my $child_od = $newChild-> |
1561 |
|
|
owner_document |
1562 |
|
|
|| $self; |
1563 |
|
|
my $child_nt = $newChild-> |
1564 |
|
|
node_type |
1565 |
|
|
; |
1566 |
|
|
if ($strictc and $self-> |
1567 |
|
|
strict_error_checking |
1568 |
|
|
) { |
1569 |
|
|
|
1570 |
|
|
|
1571 |
|
|
{ |
1572 |
|
|
|
1573 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1574 |
|
|
|
1575 |
|
|
{ |
1576 |
|
|
|
1577 |
|
|
|
1578 |
|
|
my |
1579 |
|
|
$has_el; |
1580 |
|
|
my $has_dt; |
1581 |
|
|
if ($child_nt == |
1582 |
wakaba |
1.7 |
1 |
1583 |
wakaba |
1.1 |
) { |
1584 |
|
|
$has_el = |
1585 |
|
|
1 |
1586 |
|
|
; |
1587 |
|
|
} elsif ($child_nt == |
1588 |
wakaba |
1.7 |
10 |
1589 |
wakaba |
1.1 |
) { |
1590 |
|
|
$has_dt = |
1591 |
|
|
1 |
1592 |
|
|
; |
1593 |
|
|
} elsif ($child_nt == |
1594 |
wakaba |
1.7 |
11 |
1595 |
wakaba |
1.1 |
) { |
1596 |
|
|
for my $cn (@{$newChild-> |
1597 |
|
|
child_nodes |
1598 |
|
|
}) { |
1599 |
|
|
my $cnt = $cn-> |
1600 |
|
|
node_type |
1601 |
|
|
; |
1602 |
|
|
if ($cnt == |
1603 |
wakaba |
1.7 |
1 |
1604 |
wakaba |
1.1 |
) { |
1605 |
|
|
if ($has_el) { |
1606 |
|
|
|
1607 |
|
|
|
1608 |
|
|
{ |
1609 |
|
|
|
1610 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1611 |
|
|
|
1612 |
|
|
{ |
1613 |
|
|
|
1614 |
|
|
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#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1615 |
|
|
|
1616 |
|
|
|
1617 |
wakaba |
1.3 |
} |
1618 |
wakaba |
1.1 |
|
1619 |
|
|
|
1620 |
|
|
;} |
1621 |
|
|
|
1622 |
|
|
; |
1623 |
|
|
} |
1624 |
|
|
$has_el = |
1625 |
|
|
1 |
1626 |
|
|
; |
1627 |
|
|
} |
1628 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
1629 |
|
|
} |
1630 |
|
|
} |
1631 |
|
|
|
1632 |
|
|
if ($has_el) { |
1633 |
|
|
my $anode = $oldChild-> |
1634 |
|
|
previous_sibling |
1635 |
|
|
; |
1636 |
|
|
while (defined $anode) { |
1637 |
|
|
if ($anode-> |
1638 |
|
|
node_type |
1639 |
|
|
== |
1640 |
wakaba |
1.7 |
1 |
1641 |
wakaba |
1.1 |
) { |
1642 |
|
|
|
1643 |
|
|
|
1644 |
|
|
{ |
1645 |
|
|
|
1646 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1647 |
|
|
|
1648 |
|
|
{ |
1649 |
|
|
|
1650 |
|
|
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#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1651 |
|
|
|
1652 |
|
|
|
1653 |
wakaba |
1.3 |
} |
1654 |
wakaba |
1.1 |
|
1655 |
|
|
|
1656 |
|
|
;} |
1657 |
|
|
|
1658 |
|
|
; |
1659 |
|
|
} |
1660 |
|
|
$anode = $anode-> |
1661 |
|
|
previous_sibling |
1662 |
|
|
; |
1663 |
|
|
} |
1664 |
|
|
$anode = $oldChild-> |
1665 |
|
|
next_sibling |
1666 |
|
|
; |
1667 |
|
|
while (defined $anode) { |
1668 |
|
|
my $ant = $anode-> |
1669 |
|
|
node_type |
1670 |
|
|
; |
1671 |
|
|
if ($ant == |
1672 |
wakaba |
1.7 |
1 |
1673 |
wakaba |
1.1 |
) { |
1674 |
|
|
|
1675 |
|
|
|
1676 |
|
|
{ |
1677 |
|
|
|
1678 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1679 |
|
|
|
1680 |
|
|
{ |
1681 |
|
|
|
1682 |
|
|
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#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1683 |
|
|
|
1684 |
|
|
|
1685 |
wakaba |
1.3 |
} |
1686 |
wakaba |
1.1 |
|
1687 |
|
|
|
1688 |
|
|
;} |
1689 |
|
|
|
1690 |
|
|
; |
1691 |
|
|
} elsif ($ant == |
1692 |
wakaba |
1.7 |
10 |
1693 |
wakaba |
1.1 |
) { |
1694 |
|
|
|
1695 |
|
|
|
1696 |
|
|
{ |
1697 |
|
|
|
1698 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1699 |
|
|
|
1700 |
|
|
{ |
1701 |
|
|
|
1702 |
|
|
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/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1703 |
|
|
|
1704 |
|
|
|
1705 |
wakaba |
1.3 |
} |
1706 |
wakaba |
1.1 |
|
1707 |
|
|
|
1708 |
|
|
;} |
1709 |
|
|
|
1710 |
|
|
; |
1711 |
|
|
} |
1712 |
|
|
$anode = $anode-> |
1713 |
|
|
next_sibling |
1714 |
|
|
; |
1715 |
|
|
} |
1716 |
|
|
} # has_el |
1717 |
|
|
if ($has_dt) { |
1718 |
|
|
my $anode = $oldChild-> |
1719 |
|
|
previous_sibling |
1720 |
|
|
; |
1721 |
|
|
while (defined $anode) { |
1722 |
|
|
my $ant = $anode-> |
1723 |
|
|
node_type |
1724 |
|
|
; |
1725 |
|
|
if ($ant == |
1726 |
wakaba |
1.7 |
1 |
1727 |
wakaba |
1.1 |
) { |
1728 |
|
|
|
1729 |
|
|
|
1730 |
|
|
{ |
1731 |
|
|
|
1732 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1733 |
|
|
|
1734 |
|
|
{ |
1735 |
|
|
|
1736 |
|
|
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/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1737 |
|
|
|
1738 |
|
|
|
1739 |
wakaba |
1.3 |
} |
1740 |
wakaba |
1.1 |
|
1741 |
|
|
|
1742 |
|
|
;} |
1743 |
|
|
|
1744 |
|
|
; |
1745 |
|
|
} elsif ($ant == |
1746 |
wakaba |
1.7 |
10 |
1747 |
wakaba |
1.1 |
) { |
1748 |
|
|
|
1749 |
|
|
|
1750 |
|
|
{ |
1751 |
|
|
|
1752 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1753 |
|
|
|
1754 |
|
|
{ |
1755 |
|
|
|
1756 |
|
|
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#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1757 |
|
|
|
1758 |
|
|
|
1759 |
wakaba |
1.3 |
} |
1760 |
wakaba |
1.1 |
|
1761 |
|
|
|
1762 |
|
|
;} |
1763 |
|
|
|
1764 |
|
|
; |
1765 |
|
|
} |
1766 |
|
|
$anode = $anode-> |
1767 |
|
|
previous_sibling |
1768 |
|
|
; |
1769 |
|
|
} |
1770 |
|
|
$anode = $oldChild-> |
1771 |
|
|
next_sibling |
1772 |
|
|
; |
1773 |
|
|
while (defined $anode) { |
1774 |
|
|
if ($anode-> |
1775 |
|
|
node_type |
1776 |
|
|
|
1777 |
|
|
== |
1778 |
wakaba |
1.7 |
10 |
1779 |
wakaba |
1.1 |
) { |
1780 |
|
|
|
1781 |
|
|
|
1782 |
|
|
{ |
1783 |
|
|
|
1784 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1785 |
|
|
|
1786 |
|
|
{ |
1787 |
|
|
|
1788 |
|
|
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#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', '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; |
1789 |
|
|
|
1790 |
|
|
|
1791 |
wakaba |
1.3 |
} |
1792 |
wakaba |
1.1 |
|
1793 |
|
|
|
1794 |
|
|
;} |
1795 |
|
|
|
1796 |
|
|
; |
1797 |
|
|
} |
1798 |
|
|
$anode = $anode-> |
1799 |
|
|
next_sibling |
1800 |
|
|
; |
1801 |
|
|
} |
1802 |
|
|
} # has_dt |
1803 |
|
|
|
1804 |
|
|
|
1805 |
|
|
|
1806 |
wakaba |
1.3 |
} |
1807 |
wakaba |
1.1 |
|
1808 |
|
|
|
1809 |
|
|
;} |
1810 |
|
|
|
1811 |
|
|
; |
1812 |
|
|
} |
1813 |
|
|
|
1814 |
|
|
|
1815 |
|
|
{ |
1816 |
|
|
|
1817 |
|
|
|
1818 |
|
|
{ |
1819 |
|
|
|
1820 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1821 |
|
|
|
1822 |
|
|
{ |
1823 |
|
|
|
1824 |
|
|
|
1825 |
|
|
my |
1826 |
|
|
$strict = $self-> |
1827 |
|
|
strict_error_checking |
1828 |
|
|
; |
1829 |
|
|
|
1830 |
|
|
## -- Node Type check |
1831 |
|
|
my @new_child; |
1832 |
|
|
if ({ |
1833 |
wakaba |
1.7 |
3 => (not $strictc), |
1834 |
|
|
5 => (not $strictc), |
1835 |
|
|
1 => 1, |
1836 |
|
|
4 => (not $strictc), |
1837 |
|
|
7 => 1, |
1838 |
|
|
8 => 1, |
1839 |
|
|
10 => 1, |
1840 |
wakaba |
1.1 |
}->{$child_nt}) { |
1841 |
|
|
push @new_child, $newChild; |
1842 |
|
|
} elsif ($child_nt == |
1843 |
wakaba |
1.7 |
11 |
1844 |
wakaba |
1.1 |
) { |
1845 |
|
|
for my $cn (@{$newChild-> |
1846 |
|
|
child_nodes |
1847 |
|
|
}) { |
1848 |
|
|
unless ({ |
1849 |
wakaba |
1.7 |
3 => (not $strictc), |
1850 |
|
|
5 => (not $strictc), |
1851 |
|
|
1 => 1, |
1852 |
|
|
4 => (not $strictc), |
1853 |
|
|
7 => 1, |
1854 |
|
|
8 => 1, |
1855 |
|
|
10 => 1, |
1856 |
wakaba |
1.1 |
}->{$cn-> |
1857 |
|
|
node_type |
1858 |
|
|
}) { |
1859 |
|
|
|
1860 |
|
|
|
1861 |
|
|
{ |
1862 |
|
|
|
1863 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1864 |
|
|
|
1865 |
|
|
{ |
1866 |
|
|
|
1867 |
|
|
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; |
1868 |
|
|
|
1869 |
|
|
|
1870 |
wakaba |
1.3 |
} |
1871 |
wakaba |
1.1 |
|
1872 |
|
|
|
1873 |
|
|
;} |
1874 |
|
|
|
1875 |
|
|
; |
1876 |
|
|
} |
1877 |
|
|
push @new_child, $cn; |
1878 |
|
|
} |
1879 |
|
|
} else { |
1880 |
|
|
|
1881 |
|
|
|
1882 |
|
|
{ |
1883 |
|
|
|
1884 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1885 |
|
|
|
1886 |
|
|
{ |
1887 |
|
|
|
1888 |
|
|
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; |
1889 |
|
|
|
1890 |
|
|
|
1891 |
wakaba |
1.3 |
} |
1892 |
wakaba |
1.1 |
|
1893 |
|
|
|
1894 |
|
|
;} |
1895 |
|
|
|
1896 |
|
|
; |
1897 |
|
|
} |
1898 |
|
|
|
1899 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
1900 |
|
|
parent_node |
1901 |
|
|
: |
1902 |
|
|
|
1903 |
|
|
undef |
1904 |
|
|
; |
1905 |
|
|
if ($strict) { |
1906 |
|
|
## -- Wrong-document check |
1907 |
|
|
unless ($self eq $child_od) { |
1908 |
|
|
|
1909 |
|
|
|
1910 |
|
|
{ |
1911 |
|
|
|
1912 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1913 |
|
|
|
1914 |
|
|
{ |
1915 |
|
|
|
1916 |
|
|
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; |
1917 |
|
|
|
1918 |
|
|
|
1919 |
wakaba |
1.3 |
} |
1920 |
wakaba |
1.1 |
|
1921 |
|
|
|
1922 |
|
|
;} |
1923 |
|
|
|
1924 |
|
|
; |
1925 |
|
|
} |
1926 |
|
|
|
1927 |
|
|
## -- Read-onlyness check |
1928 |
|
|
if ($self-> |
1929 |
|
|
manakai_read_only |
1930 |
|
|
) { |
1931 |
|
|
|
1932 |
|
|
|
1933 |
|
|
{ |
1934 |
|
|
|
1935 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1936 |
|
|
|
1937 |
|
|
{ |
1938 |
|
|
|
1939 |
|
|
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'; |
1940 |
|
|
|
1941 |
|
|
|
1942 |
wakaba |
1.3 |
} |
1943 |
wakaba |
1.1 |
|
1944 |
|
|
|
1945 |
|
|
;} |
1946 |
|
|
|
1947 |
|
|
; |
1948 |
|
|
} |
1949 |
|
|
if (@new_child) { |
1950 |
|
|
if ($nc_parent and |
1951 |
|
|
$nc_parent-> |
1952 |
|
|
manakai_read_only |
1953 |
|
|
) { |
1954 |
|
|
|
1955 |
|
|
|
1956 |
|
|
{ |
1957 |
|
|
|
1958 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1959 |
|
|
|
1960 |
|
|
{ |
1961 |
|
|
|
1962 |
|
|
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'; |
1963 |
|
|
|
1964 |
|
|
|
1965 |
wakaba |
1.3 |
} |
1966 |
wakaba |
1.1 |
|
1967 |
|
|
|
1968 |
|
|
;} |
1969 |
|
|
|
1970 |
|
|
; |
1971 |
|
|
} |
1972 |
|
|
} |
1973 |
|
|
} |
1974 |
|
|
|
1975 |
|
|
## -- Insert at... |
1976 |
|
|
my $index = -1; # last |
1977 |
|
|
|
1978 |
|
|
|
1979 |
|
|
{ |
1980 |
|
|
|
1981 |
|
|
|
1982 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
1983 |
|
|
if (defined $oldChild) { |
1984 |
|
|
if ($oldChild eq $newChild) { |
1985 |
|
|
|
1986 |
|
|
|
1987 |
|
|
; |
1988 |
|
|
|
1989 |
|
|
|
1990 |
|
|
{ |
1991 |
|
|
|
1992 |
|
|
|
1993 |
|
|
{ |
1994 |
|
|
|
1995 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1996 |
|
|
|
1997 |
|
|
{ |
1998 |
|
|
|
1999 |
|
|
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'; |
2000 |
|
|
|
2001 |
|
|
|
2002 |
wakaba |
1.3 |
} |
2003 |
wakaba |
1.1 |
|
2004 |
|
|
|
2005 |
|
|
;} |
2006 |
|
|
|
2007 |
|
|
; |
2008 |
|
|
|
2009 |
|
|
|
2010 |
|
|
|
2011 |
wakaba |
1.3 |
} |
2012 |
wakaba |
1.1 |
|
2013 |
|
|
; |
2014 |
|
|
} |
2015 |
|
|
|
2016 |
|
|
my $cns = $self-> |
2017 |
|
|
child_nodes |
2018 |
|
|
; |
2019 |
|
|
my $cnsl = @$cns; |
2020 |
|
|
C: { |
2021 |
|
|
$index = 0; |
2022 |
|
|
for my $i (0..($cnsl-1)) { |
2023 |
|
|
my $cn = $cns->[$i]; |
2024 |
|
|
if ($cn eq $oldChild) { |
2025 |
|
|
$index += $i; |
2026 |
|
|
last C; |
2027 |
|
|
} elsif ($cn eq $newChild) { |
2028 |
|
|
$index = -1; # offset |
2029 |
|
|
} |
2030 |
|
|
} |
2031 |
|
|
|
2032 |
|
|
|
2033 |
|
|
; |
2034 |
|
|
|
2035 |
|
|
|
2036 |
|
|
{ |
2037 |
|
|
|
2038 |
|
|
|
2039 |
|
|
{ |
2040 |
|
|
|
2041 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2042 |
|
|
|
2043 |
|
|
{ |
2044 |
|
|
|
2045 |
|
|
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; |
2046 |
|
|
|
2047 |
|
|
|
2048 |
wakaba |
1.3 |
} |
2049 |
wakaba |
1.1 |
|
2050 |
|
|
|
2051 |
|
|
;} |
2052 |
|
|
|
2053 |
|
|
; |
2054 |
|
|
|
2055 |
|
|
|
2056 |
|
|
|
2057 |
wakaba |
1.3 |
} |
2058 |
wakaba |
1.1 |
|
2059 |
|
|
; |
2060 |
|
|
} # C |
2061 |
|
|
} else { # |oldChild| is not defined |
2062 |
|
|
|
2063 |
|
|
|
2064 |
|
|
{ |
2065 |
|
|
|
2066 |
|
|
|
2067 |
|
|
{ |
2068 |
|
|
|
2069 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2070 |
|
|
|
2071 |
|
|
{ |
2072 |
|
|
|
2073 |
|
|
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; |
2074 |
|
|
|
2075 |
|
|
|
2076 |
wakaba |
1.3 |
} |
2077 |
wakaba |
1.1 |
|
2078 |
|
|
|
2079 |
|
|
;} |
2080 |
|
|
|
2081 |
|
|
; |
2082 |
|
|
|
2083 |
|
|
|
2084 |
|
|
|
2085 |
wakaba |
1.3 |
} |
2086 |
wakaba |
1.1 |
|
2087 |
|
|
; |
2088 |
|
|
} |
2089 |
|
|
|
2090 |
|
|
|
2091 |
|
|
|
2092 |
wakaba |
1.3 |
} |
2093 |
wakaba |
1.1 |
|
2094 |
|
|
; # FOR !tc:ForAppendChild |
2095 |
|
|
|
2096 |
|
|
## -- Removes from parent |
2097 |
|
|
if ($nc_parent) { |
2098 |
|
|
if ($child_nt == |
2099 |
wakaba |
1.7 |
11 |
2100 |
wakaba |
1.1 |
) { |
2101 |
|
|
|
2102 |
|
|
|
2103 |
|
|
{ |
2104 |
|
|
|
2105 |
|
|
|
2106 |
|
|
$newChild->{ |
2107 |
|
|
'b' |
2108 |
|
|
}->{${$newChild->{ |
2109 |
|
|
'id' |
2110 |
|
|
}}} |
2111 |
|
|
->{'child'} = []; |
2112 |
|
|
|
2113 |
|
|
|
2114 |
wakaba |
1.3 |
} |
2115 |
wakaba |
1.1 |
|
2116 |
|
|
; |
2117 |
|
|
} else { |
2118 |
|
|
my $v; |
2119 |
|
|
|
2120 |
|
|
|
2121 |
|
|
{ |
2122 |
|
|
|
2123 |
|
|
|
2124 |
|
|
$v = $nc_parent->{ |
2125 |
|
|
'b' |
2126 |
|
|
}->{${$nc_parent->{ |
2127 |
|
|
'id' |
2128 |
|
|
}}} |
2129 |
|
|
->{'child'}; |
2130 |
|
|
|
2131 |
|
|
|
2132 |
wakaba |
1.3 |
} |
2133 |
wakaba |
1.1 |
|
2134 |
|
|
; |
2135 |
|
|
RP: for my $i (0..$#$v) { |
2136 |
|
|
my $nodeid = $v->[$i]; |
2137 |
|
|
if ( |
2138 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
2139 |
|
|
) { |
2140 |
|
|
splice @$v, $i, 1, (); |
2141 |
|
|
last RP; |
2142 |
|
|
} |
2143 |
|
|
} # RP |
2144 |
|
|
} |
2145 |
|
|
} |
2146 |
|
|
|
2147 |
|
|
## -- Rewrite the |parentNode| properties |
2148 |
|
|
for my $nc (@new_child) { |
2149 |
|
|
|
2150 |
|
|
|
2151 |
|
|
{ |
2152 |
|
|
|
2153 |
|
|
|
2154 |
|
|
$nc->{ |
2155 |
|
|
'b' |
2156 |
|
|
}->{${$nc->{ |
2157 |
|
|
'id' |
2158 |
|
|
}}} |
2159 |
|
|
->{'parent'} = $self->{ |
2160 |
|
|
'id' |
2161 |
|
|
}; |
2162 |
|
|
|
2163 |
|
|
|
2164 |
wakaba |
1.3 |
} |
2165 |
wakaba |
1.1 |
|
2166 |
|
|
; |
2167 |
|
|
} |
2168 |
|
|
|
2169 |
|
|
my $children; |
2170 |
|
|
|
2171 |
|
|
|
2172 |
|
|
{ |
2173 |
|
|
|
2174 |
|
|
|
2175 |
|
|
$children = $self->{ |
2176 |
|
|
'b' |
2177 |
|
|
}->{${$self->{ |
2178 |
|
|
'id' |
2179 |
|
|
}}} |
2180 |
|
|
->{'child'}; |
2181 |
|
|
|
2182 |
|
|
|
2183 |
wakaba |
1.3 |
} |
2184 |
wakaba |
1.1 |
|
2185 |
|
|
; |
2186 |
|
|
|
2187 |
|
|
|
2188 |
|
|
|
2189 |
|
|
; |
2190 |
|
|
|
2191 |
|
|
|
2192 |
|
|
|
2193 |
|
|
; |
2194 |
|
|
|
2195 |
|
|
|
2196 |
|
|
|
2197 |
|
|
{ |
2198 |
|
|
|
2199 |
|
|
|
2200 |
|
|
## -- Replaces the node |
2201 |
|
|
splice @$children, $index, 1, map { |
2202 |
|
|
|
2203 |
|
|
$_->{'id'} |
2204 |
|
|
|
2205 |
|
|
} @new_child; |
2206 |
|
|
|
2207 |
|
|
|
2208 |
|
|
{ |
2209 |
|
|
|
2210 |
|
|
CORE::delete |
2211 |
|
|
$oldChild->{ |
2212 |
|
|
'b' |
2213 |
|
|
}->{${$oldChild->{ |
2214 |
|
|
'id' |
2215 |
|
|
}}} |
2216 |
|
|
->{'parent'}; |
2217 |
|
|
|
2218 |
|
|
|
2219 |
wakaba |
1.3 |
} |
2220 |
wakaba |
1.1 |
|
2221 |
|
|
; |
2222 |
|
|
$r = $oldChild; |
2223 |
|
|
|
2224 |
|
|
|
2225 |
|
|
|
2226 |
wakaba |
1.3 |
} |
2227 |
wakaba |
1.1 |
|
2228 |
|
|
; |
2229 |
|
|
|
2230 |
|
|
|
2231 |
|
|
|
2232 |
wakaba |
1.3 |
} |
2233 |
wakaba |
1.1 |
|
2234 |
|
|
|
2235 |
|
|
;} |
2236 |
|
|
|
2237 |
|
|
; |
2238 |
|
|
|
2239 |
|
|
|
2240 |
wakaba |
1.3 |
} |
2241 |
wakaba |
1.1 |
|
2242 |
|
|
; |
2243 |
|
|
if ($child_nt == |
2244 |
wakaba |
1.7 |
10 and |
2245 |
wakaba |
1.1 |
|
2246 |
|
|
not defined $newChild-> |
2247 |
|
|
owner_document |
2248 |
|
|
) { |
2249 |
|
|
my $bag = |
2250 |
|
|
$self->{'b'} |
2251 |
|
|
; |
2252 |
|
|
|
2253 |
|
|
|
2254 |
|
|
{ |
2255 |
|
|
|
2256 |
|
|
CORE::delete |
2257 |
|
|
$bag->{${$bag->{${$newChild->{ |
2258 |
|
|
'id' |
2259 |
|
|
}}} |
2260 |
|
|
->{'impl'} or \''}} |
2261 |
|
|
->{'lpmi'}; |
2262 |
wakaba |
1.2 |
$bag->{ |
2263 |
wakaba |
1.1 |
'm' |
2264 |
wakaba |
1.3 |
}++; |
2265 |
wakaba |
1.1 |
CORE::delete $bag->{${$newChild->{ |
2266 |
|
|
'id' |
2267 |
|
|
}}} |
2268 |
|
|
->{'impl'}; |
2269 |
|
|
|
2270 |
|
|
|
2271 |
wakaba |
1.3 |
} |
2272 |
wakaba |
1.1 |
|
2273 |
|
|
; |
2274 |
|
|
|
2275 |
|
|
|
2276 |
|
|
{ |
2277 |
|
|
|
2278 |
|
|
|
2279 |
|
|
$bag->{${$newChild->{ |
2280 |
|
|
'id' |
2281 |
|
|
}}}->{'od'} |
2282 |
|
|
= $self->{ |
2283 |
|
|
'id' |
2284 |
|
|
}; |
2285 |
|
|
$bag->{${$self->{ |
2286 |
|
|
'id' |
2287 |
|
|
}}} |
2288 |
|
|
->{'do'}->{${$newChild->{ |
2289 |
|
|
'id' |
2290 |
|
|
}}} |
2291 |
|
|
= $newChild->{ |
2292 |
|
|
'id' |
2293 |
|
|
}; |
2294 |
|
|
|
2295 |
|
|
|
2296 |
wakaba |
1.3 |
} |
2297 |
wakaba |
1.1 |
|
2298 |
|
|
; |
2299 |
|
|
} |
2300 |
|
|
|
2301 |
|
|
|
2302 |
wakaba |
1.3 |
} |
2303 |
wakaba |
1.1 |
$r} |
2304 |
|
|
sub manakai_append_text ($$) { |
2305 |
|
|
my ($self, $string) = @_; |
2306 |
|
|
my $r; |
2307 |
|
|
|
2308 |
|
|
{ |
2309 |
|
|
|
2310 |
|
|
|
2311 |
|
|
{ |
2312 |
|
|
|
2313 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2314 |
|
|
|
2315 |
|
|
{ |
2316 |
|
|
|
2317 |
|
|
|
2318 |
|
|
unless |
2319 |
|
|
($self-> |
2320 |
|
|
dom_config |
2321 |
|
|
|
2322 |
|
|
-> |
2323 |
|
|
get_parameter |
2324 |
|
|
|
2325 |
|
|
( |
2326 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
2327 |
|
|
)) { |
2328 |
|
|
my $lc = $self-> |
2329 |
|
|
last_child |
2330 |
|
|
; |
2331 |
|
|
if (defined $lc and |
2332 |
|
|
$lc-> |
2333 |
|
|
node_type |
2334 |
|
|
== |
2335 |
wakaba |
1.7 |
3 |
2336 |
wakaba |
1.1 |
) { |
2337 |
|
|
$lc-> |
2338 |
|
|
manakai_append_text |
2339 |
|
|
|
2340 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
2341 |
|
|
} else { |
2342 |
|
|
my $text = $self-> |
2343 |
|
|
create_text_node |
2344 |
|
|
|
2345 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
2346 |
|
|
$self-> |
2347 |
|
|
append_child |
2348 |
|
|
($text); |
2349 |
|
|
} |
2350 |
|
|
} |
2351 |
|
|
$r = $self; |
2352 |
|
|
|
2353 |
|
|
|
2354 |
|
|
|
2355 |
wakaba |
1.3 |
} |
2356 |
wakaba |
1.1 |
|
2357 |
|
|
|
2358 |
|
|
;} |
2359 |
|
|
|
2360 |
|
|
; |
2361 |
|
|
|
2362 |
|
|
|
2363 |
wakaba |
1.3 |
} |
2364 |
wakaba |
1.1 |
$r} |
2365 |
|
|
sub remove_child ($$) { |
2366 |
|
|
my ($self, $oldChild) = @_; |
2367 |
|
|
my $r; |
2368 |
|
|
|
2369 |
|
|
{ |
2370 |
|
|
|
2371 |
|
|
if |
2372 |
|
|
($self-> |
2373 |
|
|
strict_error_checking and |
2374 |
|
|
|
2375 |
|
|
$self-> |
2376 |
|
|
manakai_read_only |
2377 |
|
|
) { |
2378 |
|
|
|
2379 |
|
|
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_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#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
2380 |
|
|
|
2381 |
|
|
; |
2382 |
|
|
} |
2383 |
|
|
|
2384 |
|
|
|
2385 |
|
|
{ |
2386 |
|
|
|
2387 |
|
|
F: |
2388 |
|
|
{ |
2389 |
|
|
my $i = -1; |
2390 |
|
|
for my $cld (@{$self-> |
2391 |
|
|
child_nodes |
2392 |
|
|
}) { |
2393 |
|
|
$i++; |
2394 |
|
|
if ($cld eq $oldChild) { |
2395 |
|
|
my $v; |
2396 |
|
|
|
2397 |
|
|
|
2398 |
|
|
{ |
2399 |
|
|
|
2400 |
|
|
|
2401 |
|
|
$v = $self->{ |
2402 |
|
|
'b' |
2403 |
|
|
}->{${$self->{ |
2404 |
|
|
'id' |
2405 |
|
|
}}} |
2406 |
|
|
->{'child'}; |
2407 |
|
|
|
2408 |
|
|
|
2409 |
wakaba |
1.3 |
} |
2410 |
wakaba |
1.1 |
|
2411 |
|
|
; |
2412 |
|
|
splice @$v, $i, 1, (); |
2413 |
|
|
|
2414 |
|
|
|
2415 |
|
|
{ |
2416 |
|
|
|
2417 |
|
|
CORE::delete |
2418 |
|
|
$oldChild->{ |
2419 |
|
|
'b' |
2420 |
|
|
}->{${$oldChild->{ |
2421 |
|
|
'id' |
2422 |
|
|
}}} |
2423 |
|
|
->{'parent'}; |
2424 |
|
|
|
2425 |
|
|
|
2426 |
wakaba |
1.3 |
} |
2427 |
wakaba |
1.1 |
|
2428 |
|
|
; |
2429 |
|
|
$r = $oldChild; |
2430 |
|
|
last F; |
2431 |
|
|
} |
2432 |
|
|
} |
2433 |
|
|
|
2434 |
|
|
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/removeChildImpl+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; |
2435 |
|
|
|
2436 |
|
|
; |
2437 |
|
|
} # F |
2438 |
|
|
|
2439 |
|
|
|
2440 |
wakaba |
1.3 |
} |
2441 |
wakaba |
1.1 |
|
2442 |
|
|
; |
2443 |
|
|
|
2444 |
|
|
|
2445 |
wakaba |
1.3 |
} |
2446 |
wakaba |
1.1 |
$r} |
2447 |
|
|
sub node_name ($;$) { |
2448 |
|
|
if (@_ == 1) {my ($self) = @_; |
2449 |
wakaba |
1.11 |
my $r; |
2450 |
wakaba |
1.1 |
$r = '#document'; |
2451 |
|
|
$r; |
2452 |
|
|
} else {my ($self) = @_; |
2453 |
|
|
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::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
2454 |
|
|
} |
2455 |
|
|
} |
2456 |
|
|
sub text_content ($;$) { |
2457 |
|
|
if (@_ == 1) {my ($self) = @_; |
2458 |
wakaba |
1.11 |
my $r; |
2459 |
wakaba |
1.1 |
|
2460 |
|
|
{ |
2461 |
|
|
|
2462 |
|
|
|
2463 |
|
|
{ |
2464 |
|
|
|
2465 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2466 |
|
|
|
2467 |
|
|
{ |
2468 |
|
|
|
2469 |
|
|
|
2470 |
|
|
if |
2471 |
|
|
($self-> |
2472 |
|
|
dom_config |
2473 |
|
|
|
2474 |
|
|
-> |
2475 |
|
|
get_parameter |
2476 |
|
|
|
2477 |
|
|
( |
2478 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
2479 |
|
|
)) { |
2480 |
|
|
$r = |
2481 |
|
|
undef |
2482 |
|
|
; |
2483 |
|
|
} else { |
2484 |
|
|
$r = ''; |
2485 |
|
|
my @target = @{$self-> |
2486 |
|
|
child_nodes |
2487 |
|
|
}; |
2488 |
|
|
C: for my $node (@target) { |
2489 |
|
|
my $nt = $node-> |
2490 |
|
|
node_type |
2491 |
|
|
; |
2492 |
|
|
if ($nt == |
2493 |
wakaba |
1.7 |
3 or |
2494 |
wakaba |
1.1 |
|
2495 |
|
|
$nt == |
2496 |
wakaba |
1.7 |
4 |
2497 |
wakaba |
1.1 |
) { |
2498 |
|
|
$r .= $node-> |
2499 |
|
|
data |
2500 |
|
|
unless |
2501 |
|
|
$node-> |
2502 |
|
|
is_element_content_whitespace |
2503 |
|
|
; |
2504 |
|
|
} elsif ($nt == |
2505 |
wakaba |
1.7 |
1 or |
2506 |
wakaba |
1.1 |
|
2507 |
|
|
$nt == |
2508 |
wakaba |
1.7 |
5 |
2509 |
wakaba |
1.1 |
) { |
2510 |
|
|
unshift @target, @{$node-> |
2511 |
|
|
child_nodes |
2512 |
|
|
}; |
2513 |
|
|
} |
2514 |
|
|
} |
2515 |
|
|
} |
2516 |
|
|
|
2517 |
|
|
|
2518 |
|
|
|
2519 |
wakaba |
1.3 |
} |
2520 |
wakaba |
1.1 |
|
2521 |
|
|
|
2522 |
|
|
;} |
2523 |
|
|
|
2524 |
|
|
; |
2525 |
|
|
|
2526 |
|
|
|
2527 |
wakaba |
1.3 |
} |
2528 |
wakaba |
1.1 |
$r; |
2529 |
|
|
} else {my ($self, $given) = @_; |
2530 |
|
|
|
2531 |
|
|
{ |
2532 |
|
|
|
2533 |
|
|
if |
2534 |
|
|
($self-> |
2535 |
|
|
dom_config |
2536 |
|
|
|
2537 |
|
|
-> |
2538 |
|
|
get_parameter |
2539 |
|
|
|
2540 |
|
|
( |
2541 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
2542 |
|
|
)) { |
2543 |
|
|
|
2544 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#setting-node-value-no-effect', 'rdata' => $self, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'text_content'; |
2545 |
|
|
|
2546 |
|
|
; |
2547 |
|
|
} else { |
2548 |
|
|
|
2549 |
|
|
|
2550 |
|
|
{ |
2551 |
|
|
|
2552 |
|
|
|
2553 |
|
|
{ |
2554 |
|
|
|
2555 |
|
|
if |
2556 |
|
|
($self-> |
2557 |
|
|
manakai_read_only |
2558 |
|
|
) { |
2559 |
|
|
|
2560 |
|
|
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'; |
2561 |
|
|
|
2562 |
|
|
; |
2563 |
|
|
} |
2564 |
|
|
|
2565 |
|
|
|
2566 |
wakaba |
1.3 |
} |
2567 |
wakaba |
1.1 |
|
2568 |
|
|
; |
2569 |
wakaba |
1.10 |
|
2570 |
|
|
my @__old_children = @{$self-> |
2571 |
|
|
child_nodes |
2572 |
|
|
}; |
2573 |
|
|
for my $__old_child (@__old_children) { |
2574 |
|
|
|
2575 |
|
|
|
2576 |
|
|
{ |
2577 |
|
|
|
2578 |
|
|
CORE::delete |
2579 |
|
|
$__old_child->{ |
2580 |
|
|
'b' |
2581 |
|
|
}->{${$__old_child->{ |
2582 |
wakaba |
1.1 |
'id' |
2583 |
wakaba |
1.10 |
}}} |
2584 |
|
|
->{'parent'}; |
2585 |
wakaba |
1.1 |
|
2586 |
|
|
|
2587 |
wakaba |
1.3 |
} |
2588 |
wakaba |
1.1 |
|
2589 |
|
|
; |
2590 |
wakaba |
1.10 |
} |
2591 |
wakaba |
1.1 |
|
2592 |
wakaba |
1.10 |
my @__new_children; |
2593 |
|
|
if (defined $given and length $given) { |
2594 |
|
|
my $__text = $self-> |
2595 |
|
|
create_text_node |
2596 |
|
|
($given); |
2597 |
|
|
push @__new_children, |
2598 |
|
|
$__text->{'id'} |
2599 |
|
|
; |
2600 |
|
|
|
2601 |
wakaba |
1.1 |
|
2602 |
|
|
{ |
2603 |
|
|
|
2604 |
|
|
|
2605 |
wakaba |
1.10 |
$__text->{ |
2606 |
|
|
'b' |
2607 |
|
|
}->{${$__text->{ |
2608 |
wakaba |
1.1 |
'id' |
2609 |
wakaba |
1.10 |
}}} |
2610 |
|
|
->{'parent'} = $self->{ |
2611 |
wakaba |
1.1 |
'id' |
2612 |
wakaba |
1.10 |
}; |
2613 |
wakaba |
1.1 |
|
2614 |
|
|
|
2615 |
wakaba |
1.3 |
} |
2616 |
wakaba |
1.1 |
|
2617 |
|
|
; |
2618 |
wakaba |
1.10 |
} |
2619 |
wakaba |
1.1 |
|
2620 |
|
|
|
2621 |
|
|
|
2622 |
|
|
{ |
2623 |
|
|
|
2624 |
|
|
|
2625 |
wakaba |
1.10 |
$self->{ |
2626 |
|
|
'b' |
2627 |
|
|
}->{${$self->{ |
2628 |
|
|
'id' |
2629 |
|
|
}}} |
2630 |
|
|
->{'child'} = \@__new_children; |
2631 |
wakaba |
1.1 |
|
2632 |
|
|
|
2633 |
wakaba |
1.10 |
} |
2634 |
wakaba |
1.1 |
|
2635 |
|
|
; |
2636 |
|
|
|
2637 |
|
|
|
2638 |
wakaba |
1.3 |
} |
2639 |
wakaba |
1.1 |
|
2640 |
|
|
; |
2641 |
|
|
} |
2642 |
|
|
|
2643 |
|
|
|
2644 |
wakaba |
1.3 |
} |
2645 |
wakaba |
1.1 |
} |
2646 |
wakaba |
1.10 |
} |
2647 |
|
|
sub get_feature ($$$) { |
2648 |
|
|
my ($self, $feature, $version) = @_; |
2649 |
wakaba |
1.1 |
|
2650 |
wakaba |
1.10 |
{ |
2651 |
wakaba |
1.1 |
|
2652 |
|
|
|
2653 |
wakaba |
1.10 |
$feature = lc $feature; |
2654 |
wakaba |
1.1 |
|
2655 |
|
|
|
2656 |
wakaba |
1.10 |
} |
2657 |
wakaba |
1.1 |
|
2658 |
wakaba |
1.10 |
{ |
2659 |
wakaba |
1.1 |
|
2660 |
|
|
|
2661 |
wakaba |
1.10 |
$version = '' unless defined $version; |
2662 |
wakaba |
1.1 |
|
2663 |
|
|
|
2664 |
wakaba |
1.3 |
} |
2665 |
wakaba |
1.10 |
my $r; |
2666 |
|
|
|
2667 |
|
|
{ |
2668 |
wakaba |
1.1 |
|
2669 |
|
|
|
2670 |
wakaba |
1.10 |
$feature =~ s/^\+//; |
2671 |
wakaba |
1.1 |
|
2672 |
wakaba |
1.10 |
## TODO: Remove this code and implement autoload |
2673 |
|
|
if ($feature eq |
2674 |
|
|
'http://suika.fam.cx/www/2006/feature/xdoctype' |
2675 |
|
|
) { |
2676 |
|
|
require Message::DOM::XDoctype; |
2677 |
wakaba |
1.3 |
} |
2678 |
wakaba |
1.1 |
|
2679 |
|
|
|
2680 |
|
|
|
2681 |
|
|
{ |
2682 |
|
|
|
2683 |
wakaba |
1.10 |
if |
2684 |
|
|
($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { |
2685 |
|
|
$r = $self; |
2686 |
|
|
} |
2687 |
wakaba |
1.1 |
|
2688 |
|
|
|
2689 |
wakaba |
1.3 |
} |
2690 |
wakaba |
1.1 |
|
2691 |
|
|
; |
2692 |
wakaba |
1.10 |
unless (defined $r) { |
2693 |
|
|
|
2694 |
wakaba |
1.1 |
|
2695 |
|
|
{ |
2696 |
|
|
|
2697 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2698 |
|
|
|
2699 |
|
|
{ |
2700 |
|
|
|
2701 |
|
|
|
2702 |
|
|
|
2703 |
wakaba |
1.10 |
$r = $self->SUPER::get_feature ($feature, $version); |
2704 |
|
|
|
2705 |
wakaba |
1.1 |
|
2706 |
|
|
|
2707 |
wakaba |
1.3 |
} |
2708 |
wakaba |
1.1 |
|
2709 |
|
|
|
2710 |
|
|
;} |
2711 |
|
|
|
2712 |
|
|
; |
2713 |
wakaba |
1.10 |
} |
2714 |
wakaba |
1.1 |
|
2715 |
|
|
|
2716 |
wakaba |
1.3 |
} |
2717 |
wakaba |
1.1 |
$r} |
2718 |
wakaba |
1.10 |
sub base_uri ($;$) { |
2719 |
|
|
if (@_ == 1) {my ($self) = @_; |
2720 |
wakaba |
1.11 |
my $r; |
2721 |
wakaba |
1.10 |
|
2722 |
|
|
{ |
2723 |
|
|
|
2724 |
wakaba |
1.1 |
|
2725 |
|
|
{ |
2726 |
|
|
|
2727 |
|
|
|
2728 |
wakaba |
1.10 |
$r = $self->{ |
2729 |
|
|
'b' |
2730 |
|
|
}->{${$self->{ |
2731 |
|
|
'id' |
2732 |
|
|
}}} |
2733 |
|
|
->{'buri'}; |
2734 |
|
|
|
2735 |
wakaba |
1.1 |
|
2736 |
wakaba |
1.10 |
} |
2737 |
wakaba |
1.1 |
|
2738 |
wakaba |
1.10 |
; |
2739 |
|
|
unless (defined $r) { |
2740 |
wakaba |
1.1 |
|
2741 |
|
|
|
2742 |
|
|
{ |
2743 |
|
|
|
2744 |
|
|
|
2745 |
wakaba |
1.10 |
$r = $self->{ |
2746 |
|
|
'b' |
2747 |
|
|
}->{${$self->{ |
2748 |
|
|
'id' |
2749 |
|
|
}}} |
2750 |
|
|
->{'duri'}; |
2751 |
wakaba |
1.1 |
|
2752 |
|
|
|
2753 |
wakaba |
1.3 |
} |
2754 |
wakaba |
1.1 |
|
2755 |
|
|
; |
2756 |
|
|
} |
2757 |
|
|
|
2758 |
|
|
|
2759 |
wakaba |
1.3 |
} |
2760 |
wakaba |
1.10 |
$r; |
2761 |
|
|
} else {my ($self) = @_; |
2762 |
|
|
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::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
2763 |
|
|
} |
2764 |
|
|
} |
2765 |
|
|
sub create_document_fragment ($) { |
2766 |
|
|
my ($self) = @_; |
2767 |
|
|
my $r; |
2768 |
wakaba |
1.1 |
|
2769 |
wakaba |
1.10 |
{ |
2770 |
wakaba |
1.1 |
|
2771 |
wakaba |
1.10 |
my |
2772 |
|
|
$bag = |
2773 |
wakaba |
1.1 |
$self->{'b'} |
2774 |
|
|
; |
2775 |
|
|
my $stem; |
2776 |
|
|
|
2777 |
|
|
|
2778 |
|
|
{ |
2779 |
|
|
|
2780 |
|
|
|
2781 |
wakaba |
1.10 |
$stem = 'Message::DOM::Document::ManakaiDOMDocumentFragment'->___create_node_stem ($bag, { |
2782 |
wakaba |
1.1 |
|
2783 |
|
|
'rc' |
2784 |
|
|
=> 0, |
2785 |
|
|
|
2786 |
|
|
'id' |
2787 |
|
|
=> \ |
2788 |
|
|
( |
2789 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
2790 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
2791 |
|
|
) |
2792 |
|
|
, |
2793 |
|
|
}, { |
2794 |
|
|
'od' => $self, |
2795 |
|
|
}); |
2796 |
|
|
|
2797 |
|
|
|
2798 |
|
|
{ |
2799 |
|
|
|
2800 |
|
|
if |
2801 |
wakaba |
1.10 |
(defined 'Message::DOM::Document::ManakaiDOMDocumentFragment') { |
2802 |
|
|
if (ref 'Message::DOM::Document::ManakaiDOMDocumentFragment' eq 'SCALAR') { |
2803 |
|
|
$stem->{'cls'} = 'Message::DOM::Document::ManakaiDOMDocumentFragment'; |
2804 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}) { |
2805 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}; |
2806 |
wakaba |
1.1 |
} else { |
2807 |
|
|
require Scalar::Util; |
2808 |
wakaba |
1.10 |
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'} = \('Message::DOM::Document::ManakaiDOMDocumentFragment'); |
2809 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}); |
2810 |
wakaba |
1.1 |
} |
2811 |
|
|
} else { |
2812 |
|
|
CORE::delete $stem->{'cls'}; |
2813 |
|
|
} |
2814 |
|
|
|
2815 |
|
|
|
2816 |
wakaba |
1.3 |
} |
2817 |
wakaba |
1.1 |
|
2818 |
|
|
; |
2819 |
|
|
$bag->{${$stem->{ |
2820 |
|
|
'id' |
2821 |
|
|
}}} = $stem; |
2822 |
|
|
|
2823 |
|
|
|
2824 |
wakaba |
1.3 |
} |
2825 |
wakaba |
1.1 |
|
2826 |
|
|
; |
2827 |
|
|
|
2828 |
|
|
|
2829 |
|
|
{ |
2830 |
|
|
|
2831 |
|
|
|
2832 |
|
|
$r = ${$stem->{ |
2833 |
|
|
'cls' |
2834 |
|
|
}}->___create_node_ref ({ |
2835 |
|
|
|
2836 |
|
|
'id' |
2837 |
|
|
=> $stem->{ |
2838 |
|
|
'id' |
2839 |
|
|
}, |
2840 |
|
|
|
2841 |
|
|
'b' |
2842 |
|
|
=> $bag, |
2843 |
|
|
}, { |
2844 |
|
|
}); |
2845 |
|
|
$stem->{ |
2846 |
|
|
'rc' |
2847 |
|
|
}++; |
2848 |
|
|
|
2849 |
|
|
|
2850 |
wakaba |
1.3 |
} |
2851 |
wakaba |
1.1 |
|
2852 |
|
|
; |
2853 |
|
|
|
2854 |
|
|
|
2855 |
wakaba |
1.3 |
} |
2856 |
wakaba |
1.1 |
$r} |
2857 |
|
|
sub strict_error_checking ($;$) { |
2858 |
|
|
if (@_ == 1) {my ($self) = @_; |
2859 |
|
|
my $r = 0; |
2860 |
|
|
|
2861 |
|
|
{ |
2862 |
|
|
|
2863 |
|
|
|
2864 |
|
|
{ |
2865 |
|
|
|
2866 |
|
|
|
2867 |
|
|
$r = $self->{ |
2868 |
|
|
'b' |
2869 |
|
|
}->{${$self->{ |
2870 |
|
|
'id' |
2871 |
|
|
}}} |
2872 |
|
|
->{'chk'}; |
2873 |
|
|
|
2874 |
|
|
|
2875 |
wakaba |
1.3 |
} |
2876 |
wakaba |
1.1 |
|
2877 |
|
|
; |
2878 |
|
|
$r = |
2879 |
|
|
1 unless |
2880 |
|
|
defined $r; |
2881 |
|
|
|
2882 |
|
|
|
2883 |
wakaba |
1.3 |
} |
2884 |
wakaba |
1.1 |
$r; |
2885 |
|
|
} else {my ($self, $given) = @_; |
2886 |
|
|
|
2887 |
|
|
{ |
2888 |
|
|
|
2889 |
|
|
|
2890 |
|
|
{ |
2891 |
|
|
|
2892 |
|
|
|
2893 |
|
|
$self->{ |
2894 |
|
|
'b' |
2895 |
|
|
}->{${$self->{ |
2896 |
|
|
'id' |
2897 |
|
|
}}} |
2898 |
|
|
->{'chk'} = $given ? 1 : 0; |
2899 |
|
|
|
2900 |
|
|
|
2901 |
wakaba |
1.3 |
} |
2902 |
wakaba |
1.1 |
|
2903 |
|
|
; |
2904 |
|
|
|
2905 |
|
|
|
2906 |
wakaba |
1.3 |
} |
2907 |
wakaba |
1.1 |
} |
2908 |
|
|
} |
2909 |
|
|
sub dom_config ($;$) { |
2910 |
|
|
if (@_ == 1) {my ($self) = @_; |
2911 |
|
|
my $r; |
2912 |
|
|
|
2913 |
|
|
{ |
2914 |
|
|
|
2915 |
|
|
|
2916 |
|
|
{ |
2917 |
|
|
|
2918 |
|
|
|
2919 |
|
|
$r = bless [$self, ($self->{'b'}->{${$self->{'id'}}}), 'Message::DOM::IFLatest::Document'], |
2920 |
|
|
|
2921 |
|
|
'Message::DOM::DOMCore::ManakaiDOMConfiguration' |
2922 |
|
|
; |
2923 |
|
|
|
2924 |
|
|
|
2925 |
wakaba |
1.3 |
} |
2926 |
wakaba |
1.1 |
|
2927 |
|
|
; |
2928 |
|
|
|
2929 |
|
|
|
2930 |
wakaba |
1.3 |
} |
2931 |
wakaba |
1.1 |
$r; |
2932 |
|
|
} else {my ($self) = @_; |
2933 |
|
|
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::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'dom_config'; |
2934 |
|
|
} |
2935 |
|
|
} |
2936 |
|
|
sub document_element ($;$) { |
2937 |
|
|
if (@_ == 1) {my ($self) = @_; |
2938 |
|
|
my $r; |
2939 |
|
|
|
2940 |
|
|
{ |
2941 |
|
|
|
2942 |
|
|
|
2943 |
|
|
{ |
2944 |
|
|
|
2945 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2946 |
|
|
|
2947 |
|
|
{ |
2948 |
|
|
|
2949 |
|
|
|
2950 |
|
|
F: |
2951 |
|
|
for my $child (@{$self-> |
2952 |
|
|
child_nodes |
2953 |
|
|
}) { |
2954 |
|
|
if ($child-> |
2955 |
|
|
node_type |
2956 |
|
|
== |
2957 |
wakaba |
1.7 |
1 |
2958 |
wakaba |
1.1 |
) { |
2959 |
|
|
$r = $child; |
2960 |
|
|
last F; |
2961 |
|
|
} |
2962 |
|
|
} # F |
2963 |
|
|
|
2964 |
|
|
|
2965 |
|
|
|
2966 |
wakaba |
1.3 |
} |
2967 |
wakaba |
1.1 |
|
2968 |
|
|
|
2969 |
|
|
;} |
2970 |
|
|
|
2971 |
|
|
; |
2972 |
|
|
|
2973 |
|
|
|
2974 |
wakaba |
1.3 |
} |
2975 |
wakaba |
1.1 |
$r; |
2976 |
|
|
} else {my ($self) = @_; |
2977 |
|
|
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::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'document_element'; |
2978 |
|
|
} |
2979 |
|
|
} |
2980 |
|
|
sub implementation ($;$) { |
2981 |
|
|
if (@_ == 1) {my ($self) = @_; |
2982 |
|
|
my $r; |
2983 |
|
|
|
2984 |
|
|
{ |
2985 |
|
|
|
2986 |
|
|
|
2987 |
|
|
{ |
2988 |
|
|
|
2989 |
|
|
my |
2990 |
|
|
$__v = $self->{ |
2991 |
|
|
'b' |
2992 |
|
|
}->{${$self->{ |
2993 |
|
|
'id' |
2994 |
|
|
}}} |
2995 |
|
|
->{'impl'}; |
2996 |
|
|
if (defined $__v) { |
2997 |
|
|
|
2998 |
|
|
|
2999 |
|
|
{ |
3000 |
|
|
|
3001 |
|
|
|
3002 |
|
|
$r = ${$self->{'b'}->{${$__v}}->{ |
3003 |
|
|
'cls' |
3004 |
|
|
}}->___create_node_ref ({ |
3005 |
|
|
|
3006 |
|
|
'id' |
3007 |
|
|
=> $__v, |
3008 |
|
|
|
3009 |
|
|
'b' |
3010 |
|
|
=> $self->{'b'}, |
3011 |
wakaba |
1.10 |
}, {}); |
3012 |
wakaba |
1.1 |
$self->{'b'}->{${$__v}}->{ |
3013 |
|
|
'rc' |
3014 |
|
|
}++; |
3015 |
|
|
|
3016 |
|
|
|
3017 |
wakaba |
1.3 |
} |
3018 |
wakaba |
1.1 |
|
3019 |
|
|
; |
3020 |
|
|
} |
3021 |
|
|
|
3022 |
|
|
|
3023 |
wakaba |
1.3 |
} |
3024 |
wakaba |
1.1 |
|
3025 |
|
|
; |
3026 |
|
|
|
3027 |
|
|
|
3028 |
wakaba |
1.3 |
} |
3029 |
wakaba |
1.1 |
$r; |
3030 |
|
|
} else {my ($self) = @_; |
3031 |
|
|
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::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'implementation'; |
3032 |
|
|
} |
3033 |
|
|
} |
3034 |
|
|
sub xml_version ($;$) { |
3035 |
|
|
if (@_ == 1) {my ($self) = @_; |
3036 |
wakaba |
1.11 |
my $r; |
3037 |
wakaba |
1.1 |
|
3038 |
|
|
{ |
3039 |
|
|
|
3040 |
|
|
|
3041 |
|
|
{ |
3042 |
|
|
|
3043 |
|
|
|
3044 |
|
|
$r = $self->{ |
3045 |
|
|
'b' |
3046 |
|
|
}->{${$self->{ |
3047 |
|
|
'id' |
3048 |
|
|
}}} |
3049 |
|
|
->{'http://www.w3.org/2001/04/infoset#version'}; |
3050 |
|
|
|
3051 |
|
|
|
3052 |
wakaba |
1.3 |
} |
3053 |
wakaba |
1.1 |
|
3054 |
|
|
; |
3055 |
|
|
$r = '1.0' unless defined $r; |
3056 |
|
|
|
3057 |
|
|
|
3058 |
wakaba |
1.3 |
} |
3059 |
wakaba |
1.1 |
$r; |
3060 |
|
|
} else {my ($self, $given) = @_; |
3061 |
|
|
|
3062 |
|
|
{ |
3063 |
|
|
|
3064 |
|
|
|
3065 |
|
|
{ |
3066 |
|
|
|
3067 |
|
|
if |
3068 |
|
|
($self-> |
3069 |
|
|
manakai_read_only |
3070 |
|
|
) { |
3071 |
|
|
|
3072 |
|
|
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'; |
3073 |
|
|
|
3074 |
|
|
; |
3075 |
|
|
} |
3076 |
|
|
|
3077 |
|
|
|
3078 |
wakaba |
1.3 |
} |
3079 |
wakaba |
1.1 |
|
3080 |
|
|
; |
3081 |
|
|
if (defined $given and |
3082 |
|
|
($given eq '1.0' or $given eq '1.1' or |
3083 |
|
|
not $self-> |
3084 |
|
|
strict_error_checking |
3085 |
|
|
)) { |
3086 |
|
|
|
3087 |
|
|
|
3088 |
|
|
{ |
3089 |
|
|
|
3090 |
|
|
|
3091 |
|
|
$self->{ |
3092 |
|
|
'b' |
3093 |
|
|
}->{${$self->{ |
3094 |
|
|
'id' |
3095 |
|
|
}}} |
3096 |
|
|
->{'http://www.w3.org/2001/04/infoset#version'} = $given; |
3097 |
|
|
|
3098 |
|
|
|
3099 |
wakaba |
1.3 |
} |
3100 |
wakaba |
1.1 |
|
3101 |
|
|
; |
3102 |
|
|
} else { |
3103 |
|
|
|
3104 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', '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_IMPL_NOSUPPORT_XMLVER', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'xml_version', 'http://www.w3.org/2001/04/infoset#version' => $given; |
3105 |
|
|
|
3106 |
|
|
; |
3107 |
|
|
} |
3108 |
|
|
|
3109 |
|
|
|
3110 |
wakaba |
1.3 |
} |
3111 |
wakaba |
1.1 |
} |
3112 |
|
|
} |
3113 |
|
|
sub doctype ($;$) { |
3114 |
|
|
if (@_ == 1) {my ($self) = @_; |
3115 |
|
|
my $r; |
3116 |
|
|
|
3117 |
|
|
{ |
3118 |
|
|
|
3119 |
|
|
|
3120 |
|
|
{ |
3121 |
|
|
|
3122 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3123 |
|
|
|
3124 |
|
|
{ |
3125 |
|
|
|
3126 |
|
|
|
3127 |
|
|
F: |
3128 |
|
|
for my $child (@{$self-> |
3129 |
|
|
child_nodes |
3130 |
|
|
}) { |
3131 |
|
|
my $nt = $child-> |
3132 |
|
|
node_type |
3133 |
|
|
; |
3134 |
|
|
if ($nt == |
3135 |
wakaba |
1.7 |
10 |
3136 |
wakaba |
1.1 |
) { |
3137 |
|
|
$r = $child; |
3138 |
|
|
last F; |
3139 |
|
|
} elsif ($nt == |
3140 |
wakaba |
1.7 |
1 |
3141 |
wakaba |
1.1 |
) { # document element |
3142 |
|
|
last F; |
3143 |
|
|
} |
3144 |
|
|
} # F |
3145 |
|
|
|
3146 |
|
|
|
3147 |
|
|
|
3148 |
wakaba |
1.3 |
} |
3149 |
wakaba |
1.1 |
|
3150 |
|
|
|
3151 |
|
|
;} |
3152 |
|
|
|
3153 |
|
|
; |
3154 |
|
|
|
3155 |
|
|
|
3156 |
wakaba |
1.3 |
} |
3157 |
wakaba |
1.1 |
$r; |
3158 |
|
|
} else {my ($self) = @_; |
3159 |
|
|
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::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'doctype'; |
3160 |
|
|
} |
3161 |
|
|
} |
3162 |
|
|
sub document_uri ($;$) { |
3163 |
|
|
if (@_ == 1) {my ($self) = @_; |
3164 |
|
|
my $r = ''; |
3165 |
|
|
|
3166 |
|
|
{ |
3167 |
|
|
|
3168 |
|
|
|
3169 |
|
|
{ |
3170 |
|
|
|
3171 |
|
|
|
3172 |
|
|
$r = $self->{ |
3173 |
|
|
'b' |
3174 |
|
|
}->{${$self->{ |
3175 |
|
|
'id' |
3176 |
|
|
}}} |
3177 |
|
|
->{'duri'}; |
3178 |
|
|
|
3179 |
|
|
|
3180 |
wakaba |
1.3 |
} |
3181 |
wakaba |
1.1 |
|
3182 |
|
|
; |
3183 |
|
|
|
3184 |
|
|
|
3185 |
wakaba |
1.3 |
} |
3186 |
wakaba |
1.1 |
$r; |
3187 |
|
|
} else {my ($self, $given) = @_; |
3188 |
|
|
|
3189 |
|
|
{ |
3190 |
|
|
|
3191 |
|
|
|
3192 |
|
|
{ |
3193 |
|
|
|
3194 |
|
|
if |
3195 |
|
|
($self-> |
3196 |
|
|
manakai_read_only |
3197 |
|
|
) { |
3198 |
|
|
|
3199 |
|
|
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'; |
3200 |
|
|
|
3201 |
|
|
; |
3202 |
|
|
} |
3203 |
|
|
|
3204 |
|
|
|
3205 |
wakaba |
1.3 |
} |
3206 |
wakaba |
1.1 |
|
3207 |
|
|
; |
3208 |
|
|
|
3209 |
|
|
|
3210 |
|
|
{ |
3211 |
|
|
|
3212 |
|
|
|
3213 |
|
|
$self->{ |
3214 |
|
|
'b' |
3215 |
|
|
}->{${$self->{ |
3216 |
|
|
'id' |
3217 |
|
|
}}} |
3218 |
|
|
->{'duri'} = $given; |
3219 |
|
|
|
3220 |
|
|
|
3221 |
wakaba |
1.3 |
} |
3222 |
wakaba |
1.1 |
|
3223 |
|
|
; |
3224 |
|
|
|
3225 |
|
|
|
3226 |
wakaba |
1.3 |
} |
3227 |
wakaba |
1.1 |
} |
3228 |
|
|
} |
3229 |
|
|
sub input_encoding ($;$) { |
3230 |
|
|
if (@_ == 1) {my ($self) = @_; |
3231 |
wakaba |
1.11 |
my $r; |
3232 |
wakaba |
1.1 |
|
3233 |
|
|
{ |
3234 |
|
|
|
3235 |
|
|
|
3236 |
|
|
{ |
3237 |
|
|
|
3238 |
|
|
|
3239 |
|
|
$r = $self->{ |
3240 |
|
|
'b' |
3241 |
|
|
}->{${$self->{ |
3242 |
|
|
'id' |
3243 |
|
|
}}} |
3244 |
|
|
->{'ces'}; |
3245 |
|
|
|
3246 |
|
|
|
3247 |
wakaba |
1.3 |
} |
3248 |
wakaba |
1.1 |
|
3249 |
|
|
; |
3250 |
|
|
|
3251 |
|
|
|
3252 |
wakaba |
1.3 |
} |
3253 |
wakaba |
1.1 |
$r; |
3254 |
|
|
} else {my ($self, $given) = @_; |
3255 |
|
|
|
3256 |
|
|
{ |
3257 |
|
|
|
3258 |
|
|
|
3259 |
|
|
{ |
3260 |
|
|
|
3261 |
|
|
if |
3262 |
|
|
($self-> |
3263 |
|
|
manakai_read_only |
3264 |
|
|
) { |
3265 |
|
|
|
3266 |
|
|
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'; |
3267 |
|
|
|
3268 |
|
|
; |
3269 |
|
|
} |
3270 |
|
|
|
3271 |
|
|
|
3272 |
wakaba |
1.3 |
} |
3273 |
wakaba |
1.1 |
|
3274 |
|
|
; |
3275 |
|
|
|
3276 |
|
|
|
3277 |
|
|
{ |
3278 |
|
|
|
3279 |
|
|
|
3280 |
|
|
$self->{ |
3281 |
|
|
'b' |
3282 |
|
|
}->{${$self->{ |
3283 |
|
|
'id' |
3284 |
|
|
}}} |
3285 |
|
|
->{'ces'} = $given; |
3286 |
|
|
|
3287 |
|
|
|
3288 |
wakaba |
1.3 |
} |
3289 |
wakaba |
1.1 |
|
3290 |
|
|
; |
3291 |
|
|
|
3292 |
|
|
|
3293 |
wakaba |
1.3 |
} |
3294 |
wakaba |
1.1 |
} |
3295 |
|
|
} |
3296 |
|
|
sub xml_encoding ($;$) { |
3297 |
|
|
if (@_ == 1) {my ($self) = @_; |
3298 |
wakaba |
1.11 |
my $r; |
3299 |
wakaba |
1.1 |
|
3300 |
|
|
{ |
3301 |
|
|
|
3302 |
|
|
|
3303 |
|
|
{ |
3304 |
|
|
|
3305 |
|
|
|
3306 |
|
|
$r = $self->{ |
3307 |
|
|
'b' |
3308 |
|
|
}->{${$self->{ |
3309 |
|
|
'id' |
3310 |
|
|
}}} |
3311 |
|
|
->{'xcs'}; |
3312 |
|
|
|
3313 |
|
|
|
3314 |
wakaba |
1.3 |
} |
3315 |
wakaba |
1.1 |
|
3316 |
|
|
; |
3317 |
|
|
|
3318 |
|
|
|
3319 |
wakaba |
1.3 |
} |
3320 |
wakaba |
1.1 |
$r; |
3321 |
|
|
} else {my ($self, $given) = @_; |
3322 |
|
|
|
3323 |
|
|
{ |
3324 |
|
|
|
3325 |
|
|
|
3326 |
|
|
{ |
3327 |
|
|
|
3328 |
|
|
if |
3329 |
|
|
($self-> |
3330 |
|
|
manakai_read_only |
3331 |
|
|
) { |
3332 |
|
|
|
3333 |
|
|
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'; |
3334 |
|
|
|
3335 |
|
|
; |
3336 |
|
|
} |
3337 |
|
|
|
3338 |
|
|
|
3339 |
wakaba |
1.3 |
} |
3340 |
wakaba |
1.1 |
|
3341 |
|
|
; |
3342 |
|
|
|
3343 |
|
|
|
3344 |
|
|
{ |
3345 |
|
|
|
3346 |
|
|
|
3347 |
|
|
$self->{ |
3348 |
|
|
'b' |
3349 |
|
|
}->{${$self->{ |
3350 |
|
|
'id' |
3351 |
|
|
}}} |
3352 |
|
|
->{'xcs'} = $given; |
3353 |
|
|
|
3354 |
|
|
|
3355 |
wakaba |
1.3 |
} |
3356 |
wakaba |
1.1 |
|
3357 |
|
|
; |
3358 |
|
|
|
3359 |
|
|
|
3360 |
wakaba |
1.3 |
} |
3361 |
wakaba |
1.1 |
} |
3362 |
|
|
} |
3363 |
|
|
sub xml_standalone ($;$) { |
3364 |
|
|
if (@_ == 1) {my ($self) = @_; |
3365 |
|
|
my $r = 0; |
3366 |
|
|
|
3367 |
|
|
{ |
3368 |
|
|
|
3369 |
|
|
|
3370 |
|
|
{ |
3371 |
|
|
|
3372 |
|
|
|
3373 |
|
|
$r = $self->{ |
3374 |
|
|
'b' |
3375 |
|
|
}->{${$self->{ |
3376 |
|
|
'id' |
3377 |
|
|
}}} |
3378 |
|
|
->{'http://www.w3.org/2001/04/infoset#standalone'}; |
3379 |
|
|
|
3380 |
|
|
|
3381 |
wakaba |
1.3 |
} |
3382 |
wakaba |
1.1 |
|
3383 |
|
|
; |
3384 |
|
|
|
3385 |
|
|
|
3386 |
wakaba |
1.3 |
} |
3387 |
wakaba |
1.1 |
$r; |
3388 |
|
|
} else {my ($self, $given) = @_; |
3389 |
|
|
|
3390 |
|
|
{ |
3391 |
|
|
|
3392 |
|
|
|
3393 |
|
|
{ |
3394 |
|
|
|
3395 |
|
|
if |
3396 |
|
|
($self-> |
3397 |
|
|
manakai_read_only |
3398 |
|
|
) { |
3399 |
|
|
|
3400 |
|
|
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'; |
3401 |
|
|
|
3402 |
|
|
; |
3403 |
|
|
} |
3404 |
|
|
|
3405 |
|
|
|
3406 |
wakaba |
1.3 |
} |
3407 |
wakaba |
1.1 |
|
3408 |
|
|
; |
3409 |
|
|
|
3410 |
|
|
|
3411 |
|
|
{ |
3412 |
|
|
|
3413 |
|
|
|
3414 |
|
|
$self->{ |
3415 |
|
|
'b' |
3416 |
|
|
}->{${$self->{ |
3417 |
|
|
'id' |
3418 |
|
|
}}} |
3419 |
|
|
->{'http://www.w3.org/2001/04/infoset#standalone'} = $given; |
3420 |
|
|
|
3421 |
|
|
|
3422 |
wakaba |
1.3 |
} |
3423 |
wakaba |
1.1 |
|
3424 |
|
|
; |
3425 |
|
|
|
3426 |
|
|
|
3427 |
wakaba |
1.3 |
} |
3428 |
wakaba |
1.1 |
} |
3429 |
|
|
} |
3430 |
|
|
sub adopt_node ($$) { |
3431 |
|
|
my ($self, $source) = @_; |
3432 |
|
|
my $r; |
3433 |
|
|
|
3434 |
|
|
{ |
3435 |
|
|
|
3436 |
wakaba |
1.3 |
ADOPT: |
3437 |
|
|
{ |
3438 |
|
|
last ADOPT |
3439 |
|
|
unless $source->isa ( |
3440 |
wakaba |
1.1 |
'Message::DOM::TreeCore::ManakaiDOMNode' |
3441 |
|
|
) and |
3442 |
wakaba |
1.3 |
|
3443 |
wakaba |
1.1 |
$self->{'b'} |
3444 |
wakaba |
1.3 |
eq |
3445 |
wakaba |
1.1 |
|
3446 |
|
|
$source->{'b'} |
3447 |
wakaba |
1.3 |
; |
3448 |
|
|
|
3449 |
wakaba |
1.2 |
my $strict = $self-> |
3450 |
|
|
strict_error_checking |
3451 |
|
|
; |
3452 |
|
|
if ($strict and $self-> |
3453 |
wakaba |
1.1 |
manakai_read_only |
3454 |
|
|
) { |
3455 |
|
|
|
3456 |
|
|
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' => 'adopt_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::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'source'; |
3457 |
|
|
|
3458 |
|
|
; |
3459 |
|
|
} |
3460 |
|
|
my $parent = $source-> |
3461 |
|
|
parent_node |
3462 |
|
|
; |
3463 |
wakaba |
1.2 |
if ($strict and defined $parent and |
3464 |
|
|
$parent-> |
3465 |
wakaba |
1.1 |
manakai_read_only |
3466 |
|
|
) { |
3467 |
|
|
|
3468 |
|
|
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' => 'adopt_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_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'parent'; |
3469 |
|
|
|
3470 |
|
|
; |
3471 |
|
|
} |
3472 |
|
|
my $nt = $source-> |
3473 |
|
|
node_type |
3474 |
|
|
; |
3475 |
|
|
my $oe; |
3476 |
|
|
if ($nt == |
3477 |
wakaba |
1.7 |
2 |
3478 |
wakaba |
1.1 |
) { |
3479 |
|
|
$oe = $source-> |
3480 |
|
|
owner_element |
3481 |
|
|
; |
3482 |
wakaba |
1.2 |
if ($strict and defined $oe and $oe-> |
3483 |
wakaba |
1.1 |
manakai_read_only |
3484 |
|
|
) { |
3485 |
|
|
|
3486 |
|
|
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' => 'adopt_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_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'oe'; |
3487 |
|
|
|
3488 |
|
|
; |
3489 |
|
|
} |
3490 |
|
|
} elsif ($nt == |
3491 |
wakaba |
1.7 |
9 or |
3492 |
wakaba |
1.1 |
|
3493 |
|
|
$nt == |
3494 |
wakaba |
1.7 |
10 or |
3495 |
wakaba |
1.1 |
|
3496 |
|
|
$nt == |
3497 |
wakaba |
1.7 |
6 or |
3498 |
wakaba |
1.1 |
|
3499 |
|
|
$nt == |
3500 |
wakaba |
1.7 |
12 |
3501 |
wakaba |
1.1 |
) { |
3502 |
|
|
|
3503 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_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#ADOPT_NODE_TYPE_NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'source'; |
3504 |
|
|
|
3505 |
|
|
; |
3506 |
|
|
} |
3507 |
|
|
|
3508 |
|
|
my @change_od; |
3509 |
|
|
my @nodes = ($source); |
3510 |
|
|
while (@nodes) { |
3511 |
|
|
my $node = shift @nodes; |
3512 |
|
|
my $nt = $node-> |
3513 |
|
|
node_type |
3514 |
|
|
; |
3515 |
wakaba |
1.2 |
if ($strict and $node-> |
3516 |
wakaba |
1.1 |
manakai_read_only |
3517 |
|
|
) { |
3518 |
|
|
|
3519 |
|
|
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' => 'adopt_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#NOMOD_DESCENDANT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $node; |
3520 |
|
|
|
3521 |
|
|
; |
3522 |
|
|
} |
3523 |
|
|
if ($nt == |
3524 |
wakaba |
1.7 |
1 |
3525 |
wakaba |
1.1 |
) { |
3526 |
|
|
push @change_od, $node; |
3527 |
|
|
push @nodes, @{$node-> |
3528 |
|
|
child_nodes |
3529 |
|
|
}; |
3530 |
|
|
my $attrs = $node-> |
3531 |
|
|
attributes |
3532 |
|
|
; |
3533 |
|
|
my $attrsLength = $attrs-> |
3534 |
|
|
length |
3535 |
|
|
; |
3536 |
|
|
for my $i (0..($attrsLength - 1)) { |
3537 |
|
|
push @nodes, $attrs-> |
3538 |
|
|
item |
3539 |
|
|
($i); |
3540 |
|
|
} |
3541 |
|
|
} elsif ($nt == |
3542 |
wakaba |
1.7 |
2 or |
3543 |
wakaba |
1.1 |
|
3544 |
|
|
$nt == |
3545 |
wakaba |
1.7 |
5 or |
3546 |
wakaba |
1.1 |
|
3547 |
|
|
$nt == |
3548 |
wakaba |
1.7 |
11 |
3549 |
wakaba |
1.1 |
) { |
3550 |
|
|
push @change_od, $node; |
3551 |
|
|
push @nodes, @{$node-> |
3552 |
|
|
child_nodes |
3553 |
|
|
}; |
3554 |
|
|
} elsif ($nt == |
3555 |
wakaba |
1.7 |
3 or |
3556 |
wakaba |
1.1 |
|
3557 |
|
|
$nt == |
3558 |
wakaba |
1.7 |
8 or |
3559 |
wakaba |
1.1 |
|
3560 |
|
|
$nt == |
3561 |
wakaba |
1.7 |
7 or |
3562 |
wakaba |
1.1 |
|
3563 |
|
|
$nt == |
3564 |
wakaba |
1.7 |
4 |
3565 |
wakaba |
1.1 |
) { |
3566 |
|
|
push @change_od, $node; |
3567 |
|
|
} else { |
3568 |
|
|
## TODO: assertion |
3569 |
|
|
} |
3570 |
|
|
} # nodes |
3571 |
|
|
|
3572 |
wakaba |
1.2 |
|
3573 |
wakaba |
1.1 |
|
3574 |
|
|
{ |
3575 |
|
|
|
3576 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3577 |
|
|
|
3578 |
|
|
{ |
3579 |
|
|
|
3580 |
|
|
|
3581 |
wakaba |
1.2 |
if |
3582 |
|
|
(defined $parent) { |
3583 |
wakaba |
1.1 |
$parent-> |
3584 |
|
|
remove_child |
3585 |
|
|
($source); |
3586 |
wakaba |
1.2 |
} elsif (defined $oe) { |
3587 |
wakaba |
1.1 |
$oe-> |
3588 |
|
|
remove_attribute_node |
3589 |
|
|
($source); |
3590 |
wakaba |
1.2 |
} |
3591 |
|
|
|
3592 |
wakaba |
1.1 |
|
3593 |
|
|
|
3594 |
wakaba |
1.3 |
} |
3595 |
wakaba |
1.1 |
|
3596 |
|
|
|
3597 |
|
|
;} |
3598 |
|
|
|
3599 |
|
|
; |
3600 |
|
|
|
3601 |
wakaba |
1.3 |
$r = $source; |
3602 |
wakaba |
1.1 |
my $old_od = $change_od[0]-> |
3603 |
|
|
owner_document |
3604 |
|
|
; |
3605 |
|
|
## NOTE: The array must have more than zero |
3606 |
|
|
## nodes by definition. In addition, |
3607 |
|
|
## it cannot contain document or document |
3608 |
|
|
## type nodes in current implementation. |
3609 |
wakaba |
1.3 |
|
3610 |
|
|
if ($old_od eq $self) { |
3611 |
|
|
last ADOPT; |
3612 |
|
|
} |
3613 |
|
|
|
3614 |
wakaba |
1.1 |
my $old_od_list; |
3615 |
|
|
|
3616 |
|
|
|
3617 |
|
|
{ |
3618 |
|
|
|
3619 |
|
|
|
3620 |
|
|
$old_od_list = $old_od->{ |
3621 |
|
|
'b' |
3622 |
|
|
}->{${$old_od->{ |
3623 |
|
|
'id' |
3624 |
|
|
}}} |
3625 |
|
|
->{'do'}; |
3626 |
|
|
|
3627 |
|
|
|
3628 |
wakaba |
1.3 |
} |
3629 |
wakaba |
1.1 |
|
3630 |
|
|
; |
3631 |
|
|
my $new_od_list; |
3632 |
|
|
|
3633 |
|
|
|
3634 |
|
|
{ |
3635 |
|
|
|
3636 |
|
|
|
3637 |
|
|
$new_od_list = $self->{ |
3638 |
|
|
'b' |
3639 |
|
|
}->{${$self->{ |
3640 |
|
|
'id' |
3641 |
|
|
}}} |
3642 |
|
|
->{'do'}; |
3643 |
|
|
|
3644 |
|
|
|
3645 |
wakaba |
1.3 |
} |
3646 |
wakaba |
1.1 |
|
3647 |
|
|
; |
3648 |
|
|
for my $n (@change_od) { |
3649 |
|
|
|
3650 |
|
|
|
3651 |
|
|
{ |
3652 |
|
|
|
3653 |
|
|
|
3654 |
|
|
$n->{ |
3655 |
|
|
'b' |
3656 |
|
|
}->{${$n->{ |
3657 |
|
|
'id' |
3658 |
|
|
}}} |
3659 |
|
|
->{'od'} = $self->{ |
3660 |
|
|
'id' |
3661 |
|
|
}; |
3662 |
|
|
|
3663 |
|
|
|
3664 |
wakaba |
1.3 |
} |
3665 |
wakaba |
1.1 |
|
3666 |
|
|
; |
3667 |
|
|
my $nid = |
3668 |
|
|
$n->{'id'} |
3669 |
|
|
; |
3670 |
|
|
CORE::delete $old_od_list->{$$nid}; |
3671 |
|
|
$new_od_list->{$$nid} = $nid; |
3672 |
|
|
} |
3673 |
|
|
|
3674 |
|
|
for my $src (@change_od) { |
3675 |
|
|
my $src_ud; |
3676 |
|
|
|
3677 |
|
|
|
3678 |
|
|
{ |
3679 |
|
|
|
3680 |
|
|
|
3681 |
|
|
$src_ud = $src->{ |
3682 |
|
|
'b' |
3683 |
|
|
}->{${$src->{ |
3684 |
|
|
'id' |
3685 |
|
|
}}} |
3686 |
|
|
->{'ud'}; |
3687 |
|
|
|
3688 |
|
|
|
3689 |
wakaba |
1.3 |
} |
3690 |
wakaba |
1.1 |
|
3691 |
|
|
; |
3692 |
|
|
for my $key (keys %{$src_ud or {}}) { |
3693 |
|
|
my $dh = $src_ud->{$key}->[1]; |
3694 |
|
|
if ($dh) { |
3695 |
|
|
$dh-> |
3696 |
|
|
handle |
3697 |
|
|
|
3698 |
|
|
( |
3699 |
wakaba |
1.7 |
5 |
3700 |
wakaba |
1.1 |
, |
3701 |
|
|
$key, $src_ud->{$key}->[0], $src, |
3702 |
|
|
undef |
3703 |
|
|
); |
3704 |
|
|
} |
3705 |
|
|
} |
3706 |
|
|
} |
3707 |
wakaba |
1.3 |
} # ADOPT |
3708 |
wakaba |
1.1 |
|
3709 |
|
|
|
3710 |
wakaba |
1.3 |
} |
3711 |
wakaba |
1.1 |
$r} |
3712 |
|
|
sub get_element_by_id ($$) { |
3713 |
|
|
my ($self, $elementId) = @_; |
3714 |
|
|
my $r; |
3715 |
|
|
|
3716 |
|
|
{ |
3717 |
|
|
|
3718 |
|
|
|
3719 |
|
|
{ |
3720 |
|
|
|
3721 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3722 |
|
|
|
3723 |
|
|
{ |
3724 |
|
|
|
3725 |
|
|
|
3726 |
|
|
my |
3727 |
|
|
@nodes = @{$self-> |
3728 |
|
|
child_nodes |
3729 |
|
|
}; |
3730 |
|
|
N: while (@nodes) { |
3731 |
|
|
my $node = shift @nodes; |
3732 |
|
|
next N unless $node-> |
3733 |
|
|
node_type |
3734 |
|
|
== |
3735 |
wakaba |
1.7 |
1 |
3736 |
wakaba |
1.1 |
; |
3737 |
|
|
for my $attr (@{$node-> |
3738 |
|
|
attributes |
3739 |
|
|
}) { |
3740 |
|
|
if ($attr-> |
3741 |
|
|
is_id and |
3742 |
|
|
|
3743 |
|
|
$attr-> |
3744 |
|
|
value eq |
3745 |
|
|
$elementId) { |
3746 |
|
|
$r = $attr; |
3747 |
|
|
last N; |
3748 |
|
|
} |
3749 |
|
|
} |
3750 |
|
|
unshift @nodes, @{$node-> |
3751 |
|
|
child_nodes |
3752 |
|
|
}; |
3753 |
|
|
} # N |
3754 |
|
|
|
3755 |
|
|
|
3756 |
|
|
|
3757 |
wakaba |
1.3 |
} |
3758 |
wakaba |
1.1 |
|
3759 |
|
|
|
3760 |
|
|
;} |
3761 |
|
|
|
3762 |
|
|
; |
3763 |
|
|
|
3764 |
|
|
|
3765 |
wakaba |
1.3 |
} |
3766 |
wakaba |
1.1 |
$r} |
3767 |
|
|
sub get_elements_by_tag_name ($$) { |
3768 |
|
|
my ($self, $name) = @_; |
3769 |
|
|
my $r; |
3770 |
|
|
|
3771 |
|
|
{ |
3772 |
|
|
|
3773 |
|
|
|
3774 |
|
|
$name = "$name"; |
3775 |
|
|
my $chk; |
3776 |
|
|
if ($name eq '*') { |
3777 |
|
|
$chk = sub { |
3778 |
|
|
1 |
3779 |
|
|
}; |
3780 |
|
|
} else { |
3781 |
|
|
$chk = sub { |
3782 |
|
|
my $node = shift; |
3783 |
|
|
my $nodeName = $node-> |
3784 |
|
|
node_name |
3785 |
|
|
; |
3786 |
|
|
($nodeName eq $name); |
3787 |
|
|
}; |
3788 |
|
|
} |
3789 |
|
|
|
3790 |
|
|
|
3791 |
|
|
{ |
3792 |
|
|
|
3793 |
|
|
|
3794 |
|
|
$r = bless \[$self, $chk], |
3795 |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
3796 |
|
|
; |
3797 |
|
|
|
3798 |
|
|
|
3799 |
wakaba |
1.3 |
} |
3800 |
wakaba |
1.1 |
|
3801 |
|
|
; |
3802 |
|
|
|
3803 |
|
|
|
3804 |
wakaba |
1.3 |
} |
3805 |
wakaba |
1.1 |
$r} |
3806 |
|
|
sub get_elements_by_tag_name_ns ($$$) { |
3807 |
|
|
my ($self, $namespaceURI, $localName) = @_; |
3808 |
|
|
|
3809 |
|
|
{ |
3810 |
|
|
|
3811 |
|
|
if |
3812 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
3813 |
wakaba |
1.10 |
require Message::DOM::DOMMain; |
3814 |
wakaba |
1.1 |
|
3815 |
wakaba |
1.11 |
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:1165044229:30838:aqhmc7623+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3816 |
wakaba |
1.1 |
|
3817 |
|
|
; |
3818 |
|
|
|
3819 |
|
|
|
3820 |
|
|
|
3821 |
|
|
{ |
3822 |
|
|
|
3823 |
|
|
|
3824 |
|
|
$namespaceURI = undef; |
3825 |
|
|
|
3826 |
|
|
|
3827 |
|
|
|
3828 |
wakaba |
1.3 |
} |
3829 |
wakaba |
1.1 |
|
3830 |
|
|
; |
3831 |
|
|
} |
3832 |
|
|
|
3833 |
|
|
|
3834 |
wakaba |
1.3 |
} |
3835 |
wakaba |
1.1 |
my $r; |
3836 |
|
|
|
3837 |
|
|
{ |
3838 |
|
|
|
3839 |
|
|
|
3840 |
|
|
$namespaceURI = "$namespaceURI" if defined $namespaceURI; |
3841 |
|
|
$localName = "$localName"; |
3842 |
|
|
my $chk; |
3843 |
|
|
if (not defined $namespaceURI) { |
3844 |
|
|
if ($localName eq '*') { |
3845 |
|
|
$chk = sub { |
3846 |
|
|
my $node = shift; |
3847 |
|
|
(not defined $node-> |
3848 |
|
|
namespace_uri |
3849 |
|
|
); |
3850 |
|
|
}; |
3851 |
|
|
} else { |
3852 |
|
|
$chk = sub { |
3853 |
|
|
my $node = shift; |
3854 |
|
|
(not defined $node-> |
3855 |
|
|
namespace_uri and |
3856 |
|
|
|
3857 |
|
|
$node-> |
3858 |
|
|
local_name eq |
3859 |
|
|
$localName); |
3860 |
|
|
}; |
3861 |
|
|
} |
3862 |
|
|
} elsif ($namespaceURI eq '*') { |
3863 |
|
|
if ($localName eq '*') { |
3864 |
|
|
$chk = sub { |
3865 |
|
|
1 |
3866 |
|
|
}; |
3867 |
|
|
} else { |
3868 |
|
|
$chk = sub { |
3869 |
|
|
my $node = shift; |
3870 |
|
|
($node-> |
3871 |
|
|
local_name eq |
3872 |
|
|
$localName); |
3873 |
|
|
}; |
3874 |
|
|
} |
3875 |
|
|
} else { |
3876 |
|
|
if ($localName eq '*') { |
3877 |
|
|
$chk = sub { |
3878 |
|
|
my $node = shift; |
3879 |
|
|
my $nsuri = $node-> |
3880 |
|
|
namespace_uri |
3881 |
|
|
; |
3882 |
|
|
(defined $nsuri and $nsuri eq $namespaceURI); |
3883 |
|
|
}; |
3884 |
|
|
} else { |
3885 |
|
|
$chk = sub { |
3886 |
|
|
my $node = shift; |
3887 |
|
|
my $nsuri = $node-> |
3888 |
|
|
namespace_uri |
3889 |
|
|
; |
3890 |
|
|
(defined $nsuri and $nsuri eq $namespaceURI and |
3891 |
|
|
$node-> |
3892 |
|
|
local_name eq |
3893 |
|
|
$localName); |
3894 |
|
|
}; |
3895 |
|
|
} |
3896 |
|
|
} |
3897 |
|
|
|
3898 |
|
|
|
3899 |
|
|
{ |
3900 |
|
|
|
3901 |
|
|
|
3902 |
|
|
$r = bless \[$self, $chk], |
3903 |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
3904 |
|
|
; |
3905 |
|
|
|
3906 |
|
|
|
3907 |
wakaba |
1.3 |
} |
3908 |
wakaba |
1.1 |
|
3909 |
|
|
; |
3910 |
|
|
|
3911 |
|
|
|
3912 |
wakaba |
1.3 |
} |
3913 |
wakaba |
1.1 |
$r} |
3914 |
|
|
sub import_node ($$;$) { |
3915 |
|
|
my ($self, $importedNode, $deep) = @_; |
3916 |
|
|
my $r; |
3917 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'import_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#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
3918 |
|
|
$r} |
3919 |
|
|
sub normalize_document ($) { |
3920 |
|
|
my ($self) = @_; |
3921 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'normalize_document', '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_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
3922 |
|
|
} |
3923 |
|
|
sub rename_node ($$$$) { |
3924 |
|
|
my ($self, $n, $namespaceURI, $qualifiedName) = @_; |
3925 |
|
|
|
3926 |
|
|
{ |
3927 |
|
|
|
3928 |
|
|
if |
3929 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
3930 |
wakaba |
1.10 |
require Message::DOM::DOMMain; |
3931 |
wakaba |
1.1 |
|
3932 |
wakaba |
1.11 |
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:1165044229:30838:aqhmc7623+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3933 |
wakaba |
1.1 |
|
3934 |
|
|
; |
3935 |
|
|
|
3936 |
|
|
|
3937 |
|
|
|
3938 |
|
|
{ |
3939 |
|
|
|
3940 |
|
|
|
3941 |
|
|
$namespaceURI = undef; |
3942 |
|
|
|
3943 |
|
|
|
3944 |
|
|
|
3945 |
wakaba |
1.3 |
} |
3946 |
wakaba |
1.1 |
|
3947 |
|
|
; |
3948 |
|
|
} |
3949 |
|
|
|
3950 |
|
|
|
3951 |
wakaba |
1.3 |
} |
3952 |
wakaba |
1.1 |
my $r; |
3953 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'rename_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#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
3954 |
|
|
$r} |
3955 |
|
|
sub manakai_entity_base_uri ($;$) { |
3956 |
|
|
if (@_ == 1) {my ($self) = @_; |
3957 |
wakaba |
1.11 |
my $r; |
3958 |
wakaba |
1.1 |
|
3959 |
|
|
{ |
3960 |
|
|
|
3961 |
|
|
|
3962 |
|
|
{ |
3963 |
|
|
|
3964 |
|
|
|
3965 |
|
|
$r = $self->{ |
3966 |
|
|
'b' |
3967 |
|
|
}->{${$self->{ |
3968 |
|
|
'id' |
3969 |
|
|
}}} |
3970 |
|
|
->{'buri'}; |
3971 |
|
|
|
3972 |
|
|
|
3973 |
wakaba |
1.3 |
} |
3974 |
wakaba |
1.1 |
|
3975 |
|
|
; |
3976 |
|
|
unless (defined $r) { |
3977 |
|
|
|
3978 |
|
|
|
3979 |
|
|
{ |
3980 |
|
|
|
3981 |
|
|
|
3982 |
|
|
$r = $self->{ |
3983 |
|
|
'b' |
3984 |
|
|
}->{${$self->{ |
3985 |
|
|
'id' |
3986 |
|
|
}}} |
3987 |
|
|
->{'duri'}; |
3988 |
|
|
|
3989 |
|
|
|
3990 |
wakaba |
1.3 |
} |
3991 |
wakaba |
1.1 |
|
3992 |
|
|
; |
3993 |
|
|
} |
3994 |
|
|
|
3995 |
|
|
|
3996 |
wakaba |
1.3 |
} |
3997 |
wakaba |
1.1 |
$r; |
3998 |
|
|
} else {my ($self, $given) = @_; |
3999 |
|
|
|
4000 |
|
|
{ |
4001 |
|
|
|
4002 |
|
|
|
4003 |
|
|
{ |
4004 |
|
|
|
4005 |
|
|
if |
4006 |
|
|
($self-> |
4007 |
|
|
manakai_read_only |
4008 |
|
|
) { |
4009 |
|
|
|
4010 |
|
|
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'; |
4011 |
|
|
|
4012 |
|
|
; |
4013 |
|
|
} |
4014 |
|
|
|
4015 |
|
|
|
4016 |
wakaba |
1.3 |
} |
4017 |
wakaba |
1.1 |
|
4018 |
|
|
; |
4019 |
|
|
|
4020 |
|
|
|
4021 |
|
|
{ |
4022 |
|
|
|
4023 |
|
|
|
4024 |
|
|
$self->{ |
4025 |
|
|
'b' |
4026 |
|
|
}->{${$self->{ |
4027 |
|
|
'id' |
4028 |
|
|
}}} |
4029 |
|
|
->{'buri'} = $given; |
4030 |
|
|
|
4031 |
|
|
|
4032 |
wakaba |
1.3 |
} |
4033 |
wakaba |
1.1 |
|
4034 |
|
|
; |
4035 |
|
|
|
4036 |
|
|
|
4037 |
wakaba |
1.3 |
} |
4038 |
wakaba |
1.1 |
} |
4039 |
|
|
} |
4040 |
|
|
sub all_declarations_processed ($;$) { |
4041 |
|
|
if (@_ == 1) {my ($self) = @_; |
4042 |
|
|
my $r = 0; |
4043 |
|
|
|
4044 |
|
|
{ |
4045 |
|
|
|
4046 |
|
|
|
4047 |
|
|
{ |
4048 |
|
|
|
4049 |
|
|
|
4050 |
|
|
$r = $self->{ |
4051 |
|
|
'b' |
4052 |
|
|
}->{${$self->{ |
4053 |
|
|
'id' |
4054 |
|
|
}}} |
4055 |
|
|
->{'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed'}; |
4056 |
|
|
|
4057 |
|
|
|
4058 |
wakaba |
1.3 |
} |
4059 |
wakaba |
1.1 |
|
4060 |
|
|
; |
4061 |
|
|
|
4062 |
|
|
|
4063 |
wakaba |
1.3 |
} |
4064 |
wakaba |
1.1 |
$r; |
4065 |
|
|
} else {my ($self, $given) = @_; |
4066 |
|
|
|
4067 |
|
|
{ |
4068 |
|
|
|
4069 |
|
|
|
4070 |
|
|
{ |
4071 |
|
|
|
4072 |
|
|
if |
4073 |
|
|
($self-> |
4074 |
|
|
manakai_read_only |
4075 |
|
|
) { |
4076 |
|
|
|
4077 |
|
|
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'; |
4078 |
|
|
|
4079 |
|
|
; |
4080 |
|
|
} |
4081 |
|
|
|
4082 |
|
|
|
4083 |
wakaba |
1.3 |
} |
4084 |
wakaba |
1.1 |
|
4085 |
|
|
; |
4086 |
|
|
|
4087 |
|
|
|
4088 |
|
|
{ |
4089 |
|
|
|
4090 |
|
|
|
4091 |
|
|
$self->{ |
4092 |
|
|
'b' |
4093 |
|
|
}->{${$self->{ |
4094 |
|
|
'id' |
4095 |
|
|
}}} |
4096 |
|
|
->{'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed'} = $given; |
4097 |
|
|
|
4098 |
|
|
|
4099 |
wakaba |
1.3 |
} |
4100 |
wakaba |
1.1 |
|
4101 |
|
|
; |
4102 |
|
|
|
4103 |
|
|
|
4104 |
wakaba |
1.3 |
} |
4105 |
wakaba |
1.1 |
} |
4106 |
|
|
} |
4107 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocument>}->{has_feature} = {'core', |
4108 |
|
|
{'', |
4109 |
|
|
'1', |
4110 |
|
|
'1.0', |
4111 |
|
|
'1', |
4112 |
|
|
'2.0', |
4113 |
|
|
'1', |
4114 |
|
|
'3.0', |
4115 |
|
|
'1'}, |
4116 |
|
|
'xml', |
4117 |
|
|
{'', |
4118 |
|
|
'1', |
4119 |
|
|
'1.0', |
4120 |
|
|
'1', |
4121 |
|
|
'2.0', |
4122 |
|
|
'1', |
4123 |
|
|
'3.0', |
4124 |
|
|
'1'}, |
4125 |
|
|
'xmlversion', |
4126 |
|
|
{'', |
4127 |
|
|
'1', |
4128 |
|
|
'1.0', |
4129 |
|
|
'1', |
4130 |
|
|
'1.1', |
4131 |
|
|
'1'}}; |
4132 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocument>} = 14.1; |
4133 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocument>}->{compat_class}->{q<Message::DOM::Document::ManakaiDOMDocument>} = 1; |
4134 |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Document::ManakaiDOMDocument>} = {'s1a', |
4135 |
|
|
['child'], |
4136 |
|
|
'v1h', |
4137 |
|
|
['do'], |
4138 |
|
|
'w0', |
4139 |
|
|
['impl']}; |
4140 |
|
|
package Message::DOM::IFLatest::DocumentFragment; |
4141 |
wakaba |
1.11 |
our $VERSION = 20061202.0940; |
4142 |
wakaba |
1.1 |
package Message::DOM::Document::ManakaiDOMDocumentFragment; |
4143 |
wakaba |
1.11 |
our $VERSION = 20061202.0940; |
4144 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
4145 |
|
|
'Message::DOM::IF::DocumentFragment', |
4146 |
|
|
'Message::DOM::IF::Node', |
4147 |
|
|
'Message::DOM::IFLatest::DocumentFragment', |
4148 |
|
|
'Message::DOM::IFLatest::Node', |
4149 |
|
|
'Message::DOM::IFLevel1::DocumentFragment', |
4150 |
|
|
'Message::DOM::IFLevel1::Node', |
4151 |
|
|
'Message::DOM::IFLevel2::DocumentFragment', |
4152 |
|
|
'Message::DOM::IFLevel2::Node', |
4153 |
|
|
'Message::DOM::IFLevel3::DocumentFragment', |
4154 |
|
|
'Message::DOM::IFLevel3::Node'; |
4155 |
|
|
sub ___create_node_stem ($$$$) { |
4156 |
|
|
my ($self, $bag, $obj, $opt) = @_; |
4157 |
|
|
my $r = {}; |
4158 |
|
|
|
4159 |
|
|
{ |
4160 |
|
|
|
4161 |
|
|
|
4162 |
|
|
$obj->{ |
4163 |
|
|
'child' |
4164 |
|
|
} = []; |
4165 |
|
|
|
4166 |
|
|
|
4167 |
|
|
{ |
4168 |
|
|
|
4169 |
|
|
|
4170 |
|
|
$obj->{'od'} = $opt->{'od'}->{ |
4171 |
|
|
'id' |
4172 |
|
|
}; |
4173 |
|
|
$bag->{${$opt->{'od'}->{ |
4174 |
|
|
'id' |
4175 |
|
|
}}} |
4176 |
|
|
->{'do'}->{${$obj->{ |
4177 |
|
|
'id' |
4178 |
|
|
}}} |
4179 |
|
|
= $obj->{ |
4180 |
|
|
'id' |
4181 |
|
|
}; |
4182 |
|
|
|
4183 |
|
|
|
4184 |
wakaba |
1.3 |
} |
4185 |
wakaba |
1.1 |
|
4186 |
|
|
; |
4187 |
|
|
$r = $obj; |
4188 |
|
|
|
4189 |
|
|
|
4190 |
wakaba |
1.3 |
} |
4191 |
wakaba |
1.1 |
$r} |
4192 |
|
|
sub node_type ($;$) { |
4193 |
|
|
if (@_ == 1) {my ($self) = @_; |
4194 |
|
|
my $r; |
4195 |
wakaba |
1.7 |
$r = 11; |
4196 |
wakaba |
1.1 |
$r; |
4197 |
|
|
} else {my ($self) = @_; |
4198 |
|
|
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::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
4199 |
|
|
} |
4200 |
|
|
} |
4201 |
|
|
sub append_child ($$) { |
4202 |
|
|
my ($self, $newChild) = @_; |
4203 |
|
|
my $r; |
4204 |
|
|
|
4205 |
|
|
{ |
4206 |
|
|
|
4207 |
|
|
if |
4208 |
|
|
($self eq $newChild) { |
4209 |
|
|
|
4210 |
|
|
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/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
4211 |
|
|
|
4212 |
|
|
; |
4213 |
|
|
} |
4214 |
|
|
my $self_od = $self-> |
4215 |
|
|
owner_document |
4216 |
|
|
; |
4217 |
|
|
my $child_od = $newChild-> |
4218 |
|
|
owner_document |
4219 |
|
|
; |
4220 |
|
|
my $child_nt = $newChild-> |
4221 |
|
|
node_type |
4222 |
|
|
; |
4223 |
|
|
|
4224 |
|
|
|
4225 |
|
|
{ |
4226 |
|
|
|
4227 |
|
|
|
4228 |
|
|
{ |
4229 |
|
|
|
4230 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4231 |
|
|
|
4232 |
|
|
{ |
4233 |
|
|
|
4234 |
|
|
|
4235 |
|
|
my |
4236 |
|
|
$strict = $self_od-> |
4237 |
|
|
strict_error_checking |
4238 |
|
|
; |
4239 |
|
|
|
4240 |
|
|
## -- Node Type check |
4241 |
|
|
my @new_child; |
4242 |
|
|
if ({ |
4243 |
wakaba |
1.7 |
3 => 1, |
4244 |
|
|
5 => 1, |
4245 |
|
|
1 => 1, |
4246 |
|
|
7 => 1, |
4247 |
|
|
4 => 1, |
4248 |
|
|
8 => 1, |
4249 |
wakaba |
1.1 |
}->{$child_nt}) { |
4250 |
|
|
push @new_child, $newChild; |
4251 |
|
|
} elsif ($child_nt == |
4252 |
wakaba |
1.7 |
11 |
4253 |
wakaba |
1.1 |
) { |
4254 |
|
|
for my $cn (@{$newChild-> |
4255 |
|
|
child_nodes |
4256 |
|
|
}) { |
4257 |
|
|
unless ({ |
4258 |
wakaba |
1.7 |
3 => 1, |
4259 |
|
|
5 => 1, |
4260 |
|
|
1 => 1, |
4261 |
|
|
7 => 1, |
4262 |
|
|
4 => 1, |
4263 |
|
|
8 => 1, |
4264 |
wakaba |
1.1 |
}->{$cn-> |
4265 |
|
|
node_type |
4266 |
|
|
}) { |
4267 |
|
|
|
4268 |
|
|
|
4269 |
|
|
{ |
4270 |
|
|
|
4271 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4272 |
|
|
|
4273 |
|
|
{ |
4274 |
|
|
|
4275 |
|
|
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; |
4276 |
|
|
|
4277 |
|
|
|
4278 |
wakaba |
1.3 |
} |
4279 |
wakaba |
1.1 |
|
4280 |
|
|
|
4281 |
|
|
;} |
4282 |
|
|
|
4283 |
|
|
; |
4284 |
|
|
} |
4285 |
|
|
push @new_child, $cn; |
4286 |
|
|
} |
4287 |
|
|
} else { |
4288 |
|
|
|
4289 |
|
|
|
4290 |
|
|
{ |
4291 |
|
|
|
4292 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4293 |
|
|
|
4294 |
|
|
{ |
4295 |
|
|
|
4296 |
|
|
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; |
4297 |
|
|
|
4298 |
|
|
|
4299 |
wakaba |
1.3 |
} |
4300 |
wakaba |
1.1 |
|
4301 |
|
|
|
4302 |
|
|
;} |
4303 |
|
|
|
4304 |
|
|
; |
4305 |
|
|
} |
4306 |
|
|
|
4307 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
4308 |
|
|
parent_node |
4309 |
|
|
: |
4310 |
|
|
|
4311 |
|
|
undef |
4312 |
|
|
; |
4313 |
|
|
if ($strict) { |
4314 |
|
|
## -- Wrong-document check |
4315 |
|
|
unless ($self_od eq $child_od) { |
4316 |
|
|
|
4317 |
|
|
|
4318 |
|
|
{ |
4319 |
|
|
|
4320 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4321 |
|
|
|
4322 |
|
|
{ |
4323 |
|
|
|
4324 |
|
|
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; |
4325 |
|
|
|
4326 |
|
|
|
4327 |
wakaba |
1.3 |
} |
4328 |
wakaba |
1.1 |
|
4329 |
|
|
|
4330 |
|
|
;} |
4331 |
|
|
|
4332 |
|
|
; |
4333 |
|
|
} |
4334 |
|
|
|
4335 |
|
|
## -- Read-onlyness check |
4336 |
|
|
if ($self-> |
4337 |
|
|
manakai_read_only |
4338 |
|
|
) { |
4339 |
|
|
|
4340 |
|
|
|
4341 |
|
|
{ |
4342 |
|
|
|
4343 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4344 |
|
|
|
4345 |
|
|
{ |
4346 |
|
|
|
4347 |
|
|
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'; |
4348 |
|
|
|
4349 |
|
|
|
4350 |
wakaba |
1.3 |
} |
4351 |
wakaba |
1.1 |
|
4352 |
|
|
|
4353 |
|
|
;} |
4354 |
|
|
|
4355 |
|
|
; |
4356 |
|
|
} |
4357 |
|
|
if (@new_child) { |
4358 |
|
|
if ($nc_parent and |
4359 |
|
|
$nc_parent-> |
4360 |
|
|
manakai_read_only |
4361 |
|
|
) { |
4362 |
|
|
|
4363 |
|
|
|
4364 |
|
|
{ |
4365 |
|
|
|
4366 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4367 |
|
|
|
4368 |
|
|
{ |
4369 |
|
|
|
4370 |
|
|
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'; |
4371 |
|
|
|
4372 |
|
|
|
4373 |
wakaba |
1.3 |
} |
4374 |
wakaba |
1.1 |
|
4375 |
|
|
|
4376 |
|
|
;} |
4377 |
|
|
|
4378 |
|
|
; |
4379 |
|
|
} |
4380 |
|
|
} |
4381 |
|
|
} |
4382 |
|
|
|
4383 |
|
|
## -- Insert at... |
4384 |
|
|
my $index = -1; # last |
4385 |
|
|
|
4386 |
|
|
|
4387 |
|
|
; # FOR !tc:ForAppendChild |
4388 |
|
|
|
4389 |
|
|
## -- Removes from parent |
4390 |
|
|
if ($nc_parent) { |
4391 |
|
|
if ($child_nt == |
4392 |
wakaba |
1.7 |
11 |
4393 |
wakaba |
1.1 |
) { |
4394 |
|
|
|
4395 |
|
|
|
4396 |
|
|
{ |
4397 |
|
|
|
4398 |
|
|
|
4399 |
|
|
$newChild->{ |
4400 |
|
|
'b' |
4401 |
|
|
}->{${$newChild->{ |
4402 |
|
|
'id' |
4403 |
|
|
}}} |
4404 |
|
|
->{'child'} = []; |
4405 |
|
|
|
4406 |
|
|
|
4407 |
wakaba |
1.3 |
} |
4408 |
wakaba |
1.1 |
|
4409 |
|
|
; |
4410 |
|
|
} else { |
4411 |
|
|
my $v; |
4412 |
|
|
|
4413 |
|
|
|
4414 |
|
|
{ |
4415 |
|
|
|
4416 |
|
|
|
4417 |
|
|
$v = $nc_parent->{ |
4418 |
|
|
'b' |
4419 |
|
|
}->{${$nc_parent->{ |
4420 |
|
|
'id' |
4421 |
|
|
}}} |
4422 |
|
|
->{'child'}; |
4423 |
|
|
|
4424 |
|
|
|
4425 |
wakaba |
1.3 |
} |
4426 |
wakaba |
1.1 |
|
4427 |
|
|
; |
4428 |
|
|
RP: for my $i (0..$#$v) { |
4429 |
|
|
my $nodeid = $v->[$i]; |
4430 |
|
|
if ( |
4431 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
4432 |
|
|
) { |
4433 |
|
|
splice @$v, $i, 1, (); |
4434 |
|
|
last RP; |
4435 |
|
|
} |
4436 |
|
|
} # RP |
4437 |
|
|
} |
4438 |
|
|
} |
4439 |
|
|
|
4440 |
|
|
## -- Rewrite the |parentNode| properties |
4441 |
|
|
for my $nc (@new_child) { |
4442 |
|
|
|
4443 |
|
|
|
4444 |
|
|
{ |
4445 |
|
|
|
4446 |
|
|
|
4447 |
|
|
$nc->{ |
4448 |
|
|
'b' |
4449 |
|
|
}->{${$nc->{ |
4450 |
|
|
'id' |
4451 |
|
|
}}} |
4452 |
|
|
->{'parent'} = $self->{ |
4453 |
|
|
'id' |
4454 |
|
|
}; |
4455 |
|
|
|
4456 |
|
|
|
4457 |
wakaba |
1.3 |
} |
4458 |
wakaba |
1.1 |
|
4459 |
|
|
; |
4460 |
|
|
} |
4461 |
|
|
|
4462 |
|
|
my $children; |
4463 |
|
|
|
4464 |
|
|
|
4465 |
|
|
{ |
4466 |
|
|
|
4467 |
|
|
|
4468 |
|
|
$children = $self->{ |
4469 |
|
|
'b' |
4470 |
|
|
}->{${$self->{ |
4471 |
|
|
'id' |
4472 |
|
|
}}} |
4473 |
|
|
->{'child'}; |
4474 |
|
|
|
4475 |
|
|
|
4476 |
wakaba |
1.3 |
} |
4477 |
wakaba |
1.1 |
|
4478 |
|
|
; |
4479 |
|
|
|
4480 |
|
|
|
4481 |
|
|
|
4482 |
|
|
{ |
4483 |
|
|
|
4484 |
|
|
|
4485 |
|
|
## -- Adds to children list |
4486 |
|
|
push @$children, map { |
4487 |
|
|
|
4488 |
|
|
$_->{'id'} |
4489 |
|
|
|
4490 |
|
|
} @new_child; |
4491 |
|
|
$r = $newChild; |
4492 |
|
|
|
4493 |
|
|
|
4494 |
|
|
|
4495 |
wakaba |
1.3 |
} |
4496 |
wakaba |
1.1 |
|
4497 |
|
|
; |
4498 |
|
|
|
4499 |
|
|
|
4500 |
|
|
|
4501 |
|
|
; |
4502 |
|
|
|
4503 |
|
|
|
4504 |
|
|
|
4505 |
|
|
; |
4506 |
|
|
|
4507 |
|
|
|
4508 |
|
|
|
4509 |
wakaba |
1.3 |
} |
4510 |
wakaba |
1.1 |
|
4511 |
|
|
|
4512 |
|
|
;} |
4513 |
|
|
|
4514 |
|
|
; |
4515 |
|
|
|
4516 |
|
|
|
4517 |
wakaba |
1.3 |
} |
4518 |
wakaba |
1.1 |
|
4519 |
|
|
; |
4520 |
|
|
|
4521 |
|
|
|
4522 |
wakaba |
1.3 |
} |
4523 |
wakaba |
1.1 |
$r} |
4524 |
|
|
sub insert_before ($$;$) { |
4525 |
|
|
my ($self, $newChild, $refChild) = @_; |
4526 |
|
|
my $r; |
4527 |
|
|
|
4528 |
|
|
{ |
4529 |
|
|
|
4530 |
|
|
if |
4531 |
|
|
($self eq $newChild) { |
4532 |
|
|
|
4533 |
|
|
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/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
4534 |
|
|
|
4535 |
|
|
; |
4536 |
|
|
} |
4537 |
|
|
my $self_od = $self-> |
4538 |
|
|
owner_document |
4539 |
|
|
; |
4540 |
|
|
my $child_od = $newChild-> |
4541 |
|
|
owner_document |
4542 |
|
|
; |
4543 |
|
|
my $child_nt = $newChild-> |
4544 |
|
|
node_type |
4545 |
|
|
; |
4546 |
|
|
|
4547 |
|
|
|
4548 |
|
|
{ |
4549 |
|
|
|
4550 |
|
|
|
4551 |
|
|
{ |
4552 |
|
|
|
4553 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4554 |
|
|
|
4555 |
|
|
{ |
4556 |
|
|
|
4557 |
|
|
|
4558 |
|
|
my |
4559 |
|
|
$strict = $self_od-> |
4560 |
|
|
strict_error_checking |
4561 |
|
|
; |
4562 |
|
|
|
4563 |
|
|
## -- Node Type check |
4564 |
|
|
my @new_child; |
4565 |
|
|
if ({ |
4566 |
wakaba |
1.7 |
3 => 1, |
4567 |
|
|
5 => 1, |
4568 |
|
|
1 => 1, |
4569 |
|
|
7 => 1, |
4570 |
|
|
4 => 1, |
4571 |
|
|
8 => 1, |
4572 |
wakaba |
1.1 |
}->{$child_nt}) { |
4573 |
|
|
push @new_child, $newChild; |
4574 |
|
|
} elsif ($child_nt == |
4575 |
wakaba |
1.7 |
11 |
4576 |
wakaba |
1.1 |
) { |
4577 |
|
|
for my $cn (@{$newChild-> |
4578 |
|
|
child_nodes |
4579 |
|
|
}) { |
4580 |
|
|
unless ({ |
4581 |
wakaba |
1.7 |
3 => 1, |
4582 |
|
|
5 => 1, |
4583 |
|
|
1 => 1, |
4584 |
|
|
7 => 1, |
4585 |
|
|
4 => 1, |
4586 |
|
|
8 => 1, |
4587 |
wakaba |
1.1 |
}->{$cn-> |
4588 |
|
|
node_type |
4589 |
|
|
}) { |
4590 |
|
|
|
4591 |
|
|
|
4592 |
|
|
{ |
4593 |
|
|
|
4594 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4595 |
|
|
|
4596 |
|
|
{ |
4597 |
|
|
|
4598 |
|
|
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; |
4599 |
|
|
|
4600 |
|
|
|
4601 |
wakaba |
1.3 |
} |
4602 |
wakaba |
1.1 |
|
4603 |
|
|
|
4604 |
|
|
;} |
4605 |
|
|
|
4606 |
|
|
; |
4607 |
|
|
} |
4608 |
|
|
push @new_child, $cn; |
4609 |
|
|
} |
4610 |
|
|
} else { |
4611 |
|
|
|
4612 |
|
|
|
4613 |
|
|
{ |
4614 |
|
|
|
4615 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4616 |
|
|
|
4617 |
|
|
{ |
4618 |
|
|
|
4619 |
|
|
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; |
4620 |
|
|
|
4621 |
|
|
|
4622 |
wakaba |
1.3 |
} |
4623 |
wakaba |
1.1 |
|
4624 |
|
|
|
4625 |
|
|
;} |
4626 |
|
|
|
4627 |
|
|
; |
4628 |
|
|
} |
4629 |
|
|
|
4630 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
4631 |
|
|
parent_node |
4632 |
|
|
: |
4633 |
|
|
|
4634 |
|
|
undef |
4635 |
|
|
; |
4636 |
|
|
if ($strict) { |
4637 |
|
|
## -- Wrong-document check |
4638 |
|
|
unless ($self_od eq $child_od) { |
4639 |
|
|
|
4640 |
|
|
|
4641 |
|
|
{ |
4642 |
|
|
|
4643 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4644 |
|
|
|
4645 |
|
|
{ |
4646 |
|
|
|
4647 |
|
|
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; |
4648 |
|
|
|
4649 |
|
|
|
4650 |
wakaba |
1.3 |
} |
4651 |
wakaba |
1.1 |
|
4652 |
|
|
|
4653 |
|
|
;} |
4654 |
|
|
|
4655 |
|
|
; |
4656 |
|
|
} |
4657 |
|
|
|
4658 |
|
|
## -- Read-onlyness check |
4659 |
|
|
if ($self-> |
4660 |
|
|
manakai_read_only |
4661 |
|
|
) { |
4662 |
|
|
|
4663 |
|
|
|
4664 |
|
|
{ |
4665 |
|
|
|
4666 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4667 |
|
|
|
4668 |
|
|
{ |
4669 |
|
|
|
4670 |
|
|
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'; |
4671 |
|
|
|
4672 |
|
|
|
4673 |
wakaba |
1.3 |
} |
4674 |
wakaba |
1.1 |
|
4675 |
|
|
|
4676 |
|
|
;} |
4677 |
|
|
|
4678 |
|
|
; |
4679 |
|
|
} |
4680 |
|
|
if (@new_child) { |
4681 |
|
|
if ($nc_parent and |
4682 |
|
|
$nc_parent-> |
4683 |
|
|
manakai_read_only |
4684 |
|
|
) { |
4685 |
|
|
|
4686 |
|
|
|
4687 |
|
|
{ |
4688 |
|
|
|
4689 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4690 |
|
|
|
4691 |
|
|
{ |
4692 |
|
|
|
4693 |
|
|
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'; |
4694 |
|
|
|
4695 |
|
|
|
4696 |
wakaba |
1.3 |
} |
4697 |
wakaba |
1.1 |
|
4698 |
|
|
|
4699 |
|
|
;} |
4700 |
|
|
|
4701 |
|
|
; |
4702 |
|
|
} |
4703 |
|
|
} |
4704 |
|
|
} |
4705 |
|
|
|
4706 |
|
|
## -- Insert at... |
4707 |
|
|
my $index = -1; # last |
4708 |
|
|
|
4709 |
|
|
|
4710 |
|
|
{ |
4711 |
|
|
|
4712 |
|
|
|
4713 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
4714 |
|
|
if (defined $refChild) { |
4715 |
|
|
if ($refChild eq $newChild) { |
4716 |
|
|
|
4717 |
|
|
|
4718 |
|
|
{ |
4719 |
|
|
|
4720 |
|
|
|
4721 |
|
|
{ |
4722 |
|
|
|
4723 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4724 |
|
|
|
4725 |
|
|
{ |
4726 |
|
|
|
4727 |
|
|
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'; |
4728 |
|
|
|
4729 |
|
|
|
4730 |
wakaba |
1.3 |
} |
4731 |
wakaba |
1.1 |
|
4732 |
|
|
|
4733 |
|
|
;} |
4734 |
|
|
|
4735 |
|
|
; |
4736 |
|
|
|
4737 |
|
|
|
4738 |
|
|
|
4739 |
wakaba |
1.3 |
} |
4740 |
wakaba |
1.1 |
|
4741 |
|
|
; |
4742 |
|
|
|
4743 |
|
|
|
4744 |
|
|
; |
4745 |
|
|
} |
4746 |
|
|
|
4747 |
|
|
my $cns = $self-> |
4748 |
|
|
child_nodes |
4749 |
|
|
; |
4750 |
|
|
my $cnsl = @$cns; |
4751 |
|
|
C: { |
4752 |
|
|
$index = 0; |
4753 |
|
|
for my $i (0..($cnsl-1)) { |
4754 |
|
|
my $cn = $cns->[$i]; |
4755 |
|
|
if ($cn eq $refChild) { |
4756 |
|
|
$index += $i; |
4757 |
|
|
last C; |
4758 |
|
|
} elsif ($cn eq $newChild) { |
4759 |
|
|
$index = -1; # offset |
4760 |
|
|
} |
4761 |
|
|
} |
4762 |
|
|
|
4763 |
|
|
|
4764 |
|
|
{ |
4765 |
|
|
|
4766 |
|
|
|
4767 |
|
|
{ |
4768 |
|
|
|
4769 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4770 |
|
|
|
4771 |
|
|
{ |
4772 |
|
|
|
4773 |
|
|
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; |
4774 |
|
|
|
4775 |
|
|
|
4776 |
wakaba |
1.3 |
} |
4777 |
wakaba |
1.1 |
|
4778 |
|
|
|
4779 |
|
|
;} |
4780 |
|
|
|
4781 |
|
|
; |
4782 |
|
|
|
4783 |
|
|
|
4784 |
|
|
|
4785 |
wakaba |
1.3 |
} |
4786 |
wakaba |
1.1 |
|
4787 |
|
|
; |
4788 |
|
|
|
4789 |
|
|
|
4790 |
|
|
; |
4791 |
|
|
} # C |
4792 |
|
|
} else { # |oldChild| is not defined |
4793 |
|
|
|
4794 |
|
|
|
4795 |
|
|
; |
4796 |
|
|
} |
4797 |
|
|
|
4798 |
|
|
|
4799 |
|
|
|
4800 |
wakaba |
1.3 |
} |
4801 |
wakaba |
1.1 |
|
4802 |
|
|
; # FOR !tc:ForAppendChild |
4803 |
|
|
|
4804 |
|
|
## -- Removes from parent |
4805 |
|
|
if ($nc_parent) { |
4806 |
|
|
if ($child_nt == |
4807 |
wakaba |
1.7 |
11 |
4808 |
wakaba |
1.1 |
) { |
4809 |
|
|
|
4810 |
|
|
|
4811 |
|
|
{ |
4812 |
|
|
|
4813 |
|
|
|
4814 |
|
|
$newChild->{ |
4815 |
|
|
'b' |
4816 |
|
|
}->{${$newChild->{ |
4817 |
|
|
'id' |
4818 |
|
|
}}} |
4819 |
|
|
->{'child'} = []; |
4820 |
|
|
|
4821 |
|
|
|
4822 |
wakaba |
1.3 |
} |
4823 |
wakaba |
1.1 |
|
4824 |
|
|
; |
4825 |
|
|
} else { |
4826 |
|
|
my $v; |
4827 |
|
|
|
4828 |
|
|
|
4829 |
|
|
{ |
4830 |
|
|
|
4831 |
|
|
|
4832 |
|
|
$v = $nc_parent->{ |
4833 |
|
|
'b' |
4834 |
|
|
}->{${$nc_parent->{ |
4835 |
|
|
'id' |
4836 |
|
|
}}} |
4837 |
|
|
->{'child'}; |
4838 |
|
|
|
4839 |
|
|
|
4840 |
wakaba |
1.3 |
} |
4841 |
wakaba |
1.1 |
|
4842 |
|
|
; |
4843 |
|
|
RP: for my $i (0..$#$v) { |
4844 |
|
|
my $nodeid = $v->[$i]; |
4845 |
|
|
if ( |
4846 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
4847 |
|
|
) { |
4848 |
|
|
splice @$v, $i, 1, (); |
4849 |
|
|
last RP; |
4850 |
|
|
} |
4851 |
|
|
} # RP |
4852 |
|
|
} |
4853 |
|
|
} |
4854 |
|
|
|
4855 |
|
|
## -- Rewrite the |parentNode| properties |
4856 |
|
|
for my $nc (@new_child) { |
4857 |
|
|
|
4858 |
|
|
|
4859 |
|
|
{ |
4860 |
|
|
|
4861 |
|
|
|
4862 |
|
|
$nc->{ |
4863 |
|
|
'b' |
4864 |
|
|
}->{${$nc->{ |
4865 |
|
|
'id' |
4866 |
|
|
}}} |
4867 |
|
|
->{'parent'} = $self->{ |
4868 |
|
|
'id' |
4869 |
|
|
}; |
4870 |
|
|
|
4871 |
|
|
|
4872 |
wakaba |
1.3 |
} |
4873 |
wakaba |
1.1 |
|
4874 |
|
|
; |
4875 |
|
|
} |
4876 |
|
|
|
4877 |
|
|
my $children; |
4878 |
|
|
|
4879 |
|
|
|
4880 |
|
|
{ |
4881 |
|
|
|
4882 |
|
|
|
4883 |
|
|
$children = $self->{ |
4884 |
|
|
'b' |
4885 |
|
|
}->{${$self->{ |
4886 |
|
|
'id' |
4887 |
|
|
}}} |
4888 |
|
|
->{'child'}; |
4889 |
|
|
|
4890 |
|
|
|
4891 |
wakaba |
1.3 |
} |
4892 |
wakaba |
1.1 |
|
4893 |
|
|
; |
4894 |
|
|
|
4895 |
|
|
|
4896 |
|
|
|
4897 |
|
|
; |
4898 |
|
|
|
4899 |
|
|
|
4900 |
|
|
|
4901 |
|
|
{ |
4902 |
|
|
|
4903 |
|
|
|
4904 |
|
|
## -- Adds to children list |
4905 |
|
|
if ($index == -1) { |
4906 |
|
|
push @$children, map { |
4907 |
|
|
|
4908 |
|
|
$_->{'id'} |
4909 |
|
|
|
4910 |
|
|
} @new_child; |
4911 |
|
|
} else { |
4912 |
|
|
splice @$children, $index, 0, map { |
4913 |
|
|
|
4914 |
|
|
$_->{'id'} |
4915 |
|
|
|
4916 |
|
|
} @new_child; |
4917 |
|
|
} |
4918 |
|
|
$r = $newChild; |
4919 |
|
|
|
4920 |
|
|
|
4921 |
|
|
|
4922 |
wakaba |
1.3 |
} |
4923 |
wakaba |
1.1 |
|
4924 |
|
|
; |
4925 |
|
|
|
4926 |
|
|
|
4927 |
|
|
|
4928 |
|
|
; |
4929 |
|
|
|
4930 |
|
|
|
4931 |
|
|
|
4932 |
wakaba |
1.3 |
} |
4933 |
wakaba |
1.1 |
|
4934 |
|
|
|
4935 |
|
|
;} |
4936 |
|
|
|
4937 |
|
|
; |
4938 |
|
|
|
4939 |
|
|
|
4940 |
wakaba |
1.3 |
} |
4941 |
wakaba |
1.1 |
|
4942 |
|
|
; |
4943 |
|
|
|
4944 |
|
|
|
4945 |
wakaba |
1.3 |
} |
4946 |
wakaba |
1.1 |
$r} |
4947 |
|
|
sub replace_child ($$$) { |
4948 |
|
|
my ($self, $newChild, $oldChild) = @_; |
4949 |
|
|
my $r; |
4950 |
|
|
|
4951 |
|
|
{ |
4952 |
|
|
|
4953 |
|
|
if |
4954 |
|
|
($self eq $newChild) { |
4955 |
|
|
|
4956 |
|
|
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/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
4957 |
|
|
|
4958 |
|
|
; |
4959 |
|
|
} |
4960 |
|
|
my $self_od = $self-> |
4961 |
|
|
owner_document |
4962 |
|
|
; |
4963 |
|
|
my $child_od = $newChild-> |
4964 |
|
|
owner_document |
4965 |
|
|
; |
4966 |
|
|
my $child_nt = $newChild-> |
4967 |
|
|
node_type |
4968 |
|
|
; |
4969 |
|
|
|
4970 |
|
|
|
4971 |
|
|
{ |
4972 |
|
|
|
4973 |
|
|
|
4974 |
|
|
{ |
4975 |
|
|
|
4976 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4977 |
|
|
|
4978 |
|
|
{ |
4979 |
|
|
|
4980 |
|
|
|
4981 |
|
|
my |
4982 |
|
|
$strict = $self_od-> |
4983 |
|
|
strict_error_checking |
4984 |
|
|
; |
4985 |
|
|
|
4986 |
|
|
## -- Node Type check |
4987 |
|
|
my @new_child; |
4988 |
|
|
if ({ |
4989 |
wakaba |
1.7 |
3 => 1, |
4990 |
|
|
5 => 1, |
4991 |
|
|
1 => 1, |
4992 |
|
|
7 => 1, |
4993 |
|
|
4 => 1, |
4994 |
|
|
8 => 1, |
4995 |
wakaba |
1.1 |
}->{$child_nt}) { |
4996 |
|
|
push @new_child, $newChild; |
4997 |
|
|
} elsif ($child_nt == |
4998 |
wakaba |
1.7 |
11 |
4999 |
wakaba |
1.1 |
) { |
5000 |
|
|
for my $cn (@{$newChild-> |
5001 |
|
|
child_nodes |
5002 |
|
|
}) { |
5003 |
|
|
unless ({ |
5004 |
wakaba |
1.7 |
3 => 1, |
5005 |
|
|
5 => 1, |
5006 |
|
|
1 => 1, |
5007 |
|
|
7 => 1, |
5008 |
|
|
4 => 1, |
5009 |
|
|
8 => 1, |
5010 |
wakaba |
1.1 |
}->{$cn-> |
5011 |
|
|
node_type |
5012 |
|
|
}) { |
5013 |
|
|
|
5014 |
|
|
|
5015 |
|
|
{ |
5016 |
|
|
|
5017 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5018 |
|
|
|
5019 |
|
|
{ |
5020 |
|
|
|
5021 |
|
|
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; |
5022 |
|
|
|
5023 |
|
|
|
5024 |
wakaba |
1.3 |
} |
5025 |
wakaba |
1.1 |
|
5026 |
|
|
|
5027 |
|
|
;} |
5028 |
|
|
|
5029 |
|
|
; |
5030 |
|
|
} |
5031 |
|
|
push @new_child, $cn; |
5032 |
|
|
} |
5033 |
|
|
} else { |
5034 |
|
|
|
5035 |
|
|
|
5036 |
|
|
{ |
5037 |
|
|
|
5038 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5039 |
|
|
|
5040 |
|
|
{ |
5041 |
|
|
|
5042 |
|
|
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; |
5043 |
|
|
|
5044 |
|
|
|
5045 |
wakaba |
1.3 |
} |
5046 |
wakaba |
1.1 |
|
5047 |
|
|
|
5048 |
|
|
;} |
5049 |
|
|
|
5050 |
|
|
; |
5051 |
|
|
} |
5052 |
|
|
|
5053 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
5054 |
|
|
parent_node |
5055 |
|
|
: |
5056 |
|
|
|
5057 |
|
|
undef |
5058 |
|
|
; |
5059 |
|
|
if ($strict) { |
5060 |
|
|
## -- Wrong-document check |
5061 |
|
|
unless ($self_od eq $child_od) { |
5062 |
|
|
|
5063 |
|
|
|
5064 |
|
|
{ |
5065 |
|
|
|
5066 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5067 |
|
|
|
5068 |
|
|
{ |
5069 |
|
|
|
5070 |
|
|
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; |
5071 |
|
|
|
5072 |
|
|
|
5073 |
wakaba |
1.3 |
} |
5074 |
wakaba |
1.1 |
|
5075 |
|
|
|
5076 |
|
|
;} |
5077 |
|
|
|
5078 |
|
|
; |
5079 |
|
|
} |
5080 |
|
|
|
5081 |
|
|
## -- Read-onlyness check |
5082 |
|
|
if ($self-> |
5083 |
|
|
manakai_read_only |
5084 |
|
|
) { |
5085 |
|
|
|
5086 |
|
|
|
5087 |
|
|
{ |
5088 |
|
|
|
5089 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5090 |
|
|
|
5091 |
|
|
{ |
5092 |
|
|
|
5093 |
|
|
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'; |
5094 |
|
|
|
5095 |
|
|
|
5096 |
wakaba |
1.3 |
} |
5097 |
wakaba |
1.1 |
|
5098 |
|
|
|
5099 |
|
|
;} |
5100 |
|
|
|
5101 |
|
|
; |
5102 |
|
|
} |
5103 |
|
|
if (@new_child) { |
5104 |
|
|
if ($nc_parent and |
5105 |
|
|
$nc_parent-> |
5106 |
|
|
manakai_read_only |
5107 |
|
|
) { |
5108 |
|
|
|
5109 |
|
|
|
5110 |
|
|
{ |
5111 |
|
|
|
5112 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5113 |
|
|
|
5114 |
|
|
{ |
5115 |
|
|
|
5116 |
|
|
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'; |
5117 |
|
|
|
5118 |
|
|
|
5119 |
wakaba |
1.3 |
} |
5120 |
wakaba |
1.1 |
|
5121 |
|
|
|
5122 |
|
|
;} |
5123 |
|
|
|
5124 |
|
|
; |
5125 |
|
|
} |
5126 |
|
|
} |
5127 |
|
|
} |
5128 |
|
|
|
5129 |
|
|
## -- Insert at... |
5130 |
|
|
my $index = -1; # last |
5131 |
|
|
|
5132 |
|
|
|
5133 |
|
|
{ |
5134 |
|
|
|
5135 |
|
|
|
5136 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
5137 |
|
|
if (defined $oldChild) { |
5138 |
|
|
if ($oldChild eq $newChild) { |
5139 |
|
|
|
5140 |
|
|
|
5141 |
|
|
; |
5142 |
|
|
|
5143 |
|
|
|
5144 |
|
|
{ |
5145 |
|
|
|
5146 |
|
|
|
5147 |
|
|
{ |
5148 |
|
|
|
5149 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5150 |
|
|
|
5151 |
|
|
{ |
5152 |
|
|
|
5153 |
|
|
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'; |
5154 |
|
|
|
5155 |
|
|
|
5156 |
wakaba |
1.3 |
} |
5157 |
wakaba |
1.1 |
|
5158 |
|
|
|
5159 |
|
|
;} |
5160 |
|
|
|
5161 |
|
|
; |
5162 |
|
|
|
5163 |
|
|
|
5164 |
|
|
|
5165 |
wakaba |
1.3 |
} |
5166 |
wakaba |
1.1 |
|
5167 |
|
|
; |
5168 |
|
|
} |
5169 |
|
|
|
5170 |
|
|
my $cns = $self-> |
5171 |
|
|
child_nodes |
5172 |
|
|
; |
5173 |
|
|
my $cnsl = @$cns; |
5174 |
|
|
C: { |
5175 |
|
|
$index = 0; |
5176 |
|
|
for my $i (0..($cnsl-1)) { |
5177 |
|
|
my $cn = $cns->[$i]; |
5178 |
|
|
if ($cn eq $oldChild) { |
5179 |
|
|
$index += $i; |
5180 |
|
|
last C; |
5181 |
|
|
} elsif ($cn eq $newChild) { |
5182 |
|
|
$index = -1; # offset |
5183 |
|
|
} |
5184 |
|
|
} |
5185 |
|
|
|
5186 |
|
|
|
5187 |
|
|
; |
5188 |
|
|
|
5189 |
|
|
|
5190 |
|
|
{ |
5191 |
|
|
|
5192 |
|
|
|
5193 |
|
|
{ |
5194 |
|
|
|
5195 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5196 |
|
|
|
5197 |
|
|
{ |
5198 |
|
|
|
5199 |
|
|
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; |
5200 |
|
|
|
5201 |
|
|
|
5202 |
wakaba |
1.3 |
} |
5203 |
wakaba |
1.1 |
|
5204 |
|
|
|
5205 |
|
|
;} |
5206 |
|
|
|
5207 |
|
|
; |
5208 |
|
|
|
5209 |
|
|
|
5210 |
|
|
|
5211 |
wakaba |
1.3 |
} |
5212 |
wakaba |
1.1 |
|
5213 |
|
|
; |
5214 |
|
|
} # C |
5215 |
|
|
} else { # |oldChild| is not defined |
5216 |
|
|
|
5217 |
|
|
|
5218 |
|
|
{ |
5219 |
|
|
|
5220 |
|
|
|
5221 |
|
|
{ |
5222 |
|
|
|
5223 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5224 |
|
|
|
5225 |
|
|
{ |
5226 |
|
|
|
5227 |
|
|
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; |
5228 |
|
|
|
5229 |
|
|
|
5230 |
wakaba |
1.3 |
} |
5231 |
wakaba |
1.1 |
|
5232 |
|
|
|
5233 |
|
|
;} |
5234 |
|
|
|
5235 |
|
|
; |
5236 |
|
|
|
5237 |
|
|
|
5238 |
|
|
|
5239 |
wakaba |
1.3 |
} |
5240 |
wakaba |
1.1 |
|
5241 |
|
|
; |
5242 |
|
|
} |
5243 |
|
|
|
5244 |
|
|
|
5245 |
|
|
|
5246 |
wakaba |
1.3 |
} |
5247 |
wakaba |
1.1 |
|
5248 |
|
|
; # FOR !tc:ForAppendChild |
5249 |
|
|
|
5250 |
|
|
## -- Removes from parent |
5251 |
|
|
if ($nc_parent) { |
5252 |
|
|
if ($child_nt == |
5253 |
wakaba |
1.7 |
11 |
5254 |
wakaba |
1.1 |
) { |
5255 |
|
|
|
5256 |
|
|
|
5257 |
|
|
{ |
5258 |
|
|
|
5259 |
|
|
|
5260 |
|
|
$newChild->{ |
5261 |
|
|
'b' |
5262 |
|
|
}->{${$newChild->{ |
5263 |
|
|
'id' |
5264 |
|
|
}}} |
5265 |
|
|
->{'child'} = []; |
5266 |
|
|
|
5267 |
|
|
|
5268 |
wakaba |
1.3 |
} |
5269 |
wakaba |
1.1 |
|
5270 |
|
|
; |
5271 |
|
|
} else { |
5272 |
|
|
my $v; |
5273 |
|
|
|
5274 |
|
|
|
5275 |
|
|
{ |
5276 |
|
|
|
5277 |
|
|
|
5278 |
|
|
$v = $nc_parent->{ |
5279 |
|
|
'b' |
5280 |
|
|
}->{${$nc_parent->{ |
5281 |
|
|
'id' |
5282 |
|
|
}}} |
5283 |
|
|
->{'child'}; |
5284 |
|
|
|
5285 |
|
|
|
5286 |
wakaba |
1.3 |
} |
5287 |
wakaba |
1.1 |
|
5288 |
|
|
; |
5289 |
|
|
RP: for my $i (0..$#$v) { |
5290 |
|
|
my $nodeid = $v->[$i]; |
5291 |
|
|
if ( |
5292 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
5293 |
|
|
) { |
5294 |
|
|
splice @$v, $i, 1, (); |
5295 |
|
|
last RP; |
5296 |
|
|
} |
5297 |
|
|
} # RP |
5298 |
|
|
} |
5299 |
|
|
} |
5300 |
|
|
|
5301 |
|
|
## -- Rewrite the |parentNode| properties |
5302 |
|
|
for my $nc (@new_child) { |
5303 |
|
|
|
5304 |
|
|
|
5305 |
|
|
{ |
5306 |
|
|
|
5307 |
|
|
|
5308 |
|
|
$nc->{ |
5309 |
|
|
'b' |
5310 |
|
|
}->{${$nc->{ |
5311 |
|
|
'id' |
5312 |
|
|
}}} |
5313 |
|
|
->{'parent'} = $self->{ |
5314 |
|
|
'id' |
5315 |
|
|
}; |
5316 |
|
|
|
5317 |
|
|
|
5318 |
wakaba |
1.3 |
} |
5319 |
wakaba |
1.1 |
|
5320 |
|
|
; |
5321 |
|
|
} |
5322 |
|
|
|
5323 |
|
|
my $children; |
5324 |
|
|
|
5325 |
|
|
|
5326 |
|
|
{ |
5327 |
|
|
|
5328 |
|
|
|
5329 |
|
|
$children = $self->{ |
5330 |
|
|
'b' |
5331 |
|
|
}->{${$self->{ |
5332 |
|
|
'id' |
5333 |
|
|
}}} |
5334 |
|
|
->{'child'}; |
5335 |
|
|
|
5336 |
|
|
|
5337 |
wakaba |
1.3 |
} |
5338 |
wakaba |
1.1 |
|
5339 |
|
|
; |
5340 |
|
|
|
5341 |
|
|
|
5342 |
|
|
|
5343 |
|
|
; |
5344 |
|
|
|
5345 |
|
|
|
5346 |
|
|
|
5347 |
|
|
; |
5348 |
|
|
|
5349 |
|
|
|
5350 |
|
|
|
5351 |
|
|
{ |
5352 |
|
|
|
5353 |
|
|
|
5354 |
|
|
## -- Replaces the node |
5355 |
|
|
splice @$children, $index, 1, map { |
5356 |
|
|
|
5357 |
|
|
$_->{'id'} |
5358 |
|
|
|
5359 |
|
|
} @new_child; |
5360 |
|
|
|
5361 |
|
|
|
5362 |
|
|
{ |
5363 |
|
|
|
5364 |
|
|
CORE::delete |
5365 |
|
|
$oldChild->{ |
5366 |
|
|
'b' |
5367 |
|
|
}->{${$oldChild->{ |
5368 |
|
|
'id' |
5369 |
|
|
}}} |
5370 |
|
|
->{'parent'}; |
5371 |
|
|
|
5372 |
|
|
|
5373 |
wakaba |
1.3 |
} |
5374 |
wakaba |
1.1 |
|
5375 |
|
|
; |
5376 |
|
|
$r = $oldChild; |
5377 |
|
|
|
5378 |
|
|
|
5379 |
|
|
|
5380 |
wakaba |
1.3 |
} |
5381 |
wakaba |
1.1 |
|
5382 |
|
|
; |
5383 |
|
|
|
5384 |
|
|
|
5385 |
|
|
|
5386 |
wakaba |
1.3 |
} |
5387 |
wakaba |
1.1 |
|
5388 |
|
|
|
5389 |
|
|
;} |
5390 |
|
|
|
5391 |
|
|
; |
5392 |
|
|
|
5393 |
|
|
|
5394 |
wakaba |
1.3 |
} |
5395 |
wakaba |
1.1 |
|
5396 |
|
|
; |
5397 |
|
|
|
5398 |
|
|
|
5399 |
wakaba |
1.3 |
} |
5400 |
wakaba |
1.1 |
$r} |
5401 |
|
|
sub node_name ($;$) { |
5402 |
|
|
if (@_ == 1) {my ($self) = @_; |
5403 |
wakaba |
1.11 |
my $r; |
5404 |
wakaba |
1.1 |
$r = '#document-fragment'; |
5405 |
|
|
$r; |
5406 |
|
|
} else {my ($self) = @_; |
5407 |
|
|
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::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
5408 |
|
|
} |
5409 |
|
|
} |
5410 |
|
|
sub manakai_append_text ($$) { |
5411 |
|
|
my ($self, $string) = @_; |
5412 |
|
|
my $r; |
5413 |
|
|
|
5414 |
|
|
{ |
5415 |
|
|
|
5416 |
|
|
|
5417 |
|
|
{ |
5418 |
|
|
|
5419 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5420 |
|
|
|
5421 |
|
|
{ |
5422 |
|
|
|
5423 |
|
|
|
5424 |
|
|
my |
5425 |
|
|
$lc = $self-> |
5426 |
|
|
last_child |
5427 |
|
|
; |
5428 |
|
|
if (defined $lc and |
5429 |
|
|
$lc-> |
5430 |
|
|
node_type |
5431 |
|
|
== |
5432 |
wakaba |
1.7 |
3 |
5433 |
wakaba |
1.1 |
) { |
5434 |
|
|
$lc-> |
5435 |
|
|
manakai_append_text |
5436 |
|
|
|
5437 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
5438 |
|
|
} else { |
5439 |
|
|
my $text = $self-> |
5440 |
|
|
owner_document |
5441 |
|
|
|
5442 |
|
|
-> |
5443 |
|
|
create_text_node |
5444 |
|
|
|
5445 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
5446 |
|
|
$self-> |
5447 |
|
|
append_child |
5448 |
|
|
($text); |
5449 |
|
|
} |
5450 |
|
|
$r = $self; |
5451 |
|
|
|
5452 |
|
|
|
5453 |
|
|
|
5454 |
wakaba |
1.3 |
} |
5455 |
wakaba |
1.1 |
|
5456 |
|
|
|
5457 |
|
|
;} |
5458 |
|
|
|
5459 |
|
|
; |
5460 |
|
|
|
5461 |
|
|
|
5462 |
wakaba |
1.3 |
} |
5463 |
wakaba |
1.1 |
$r} |
5464 |
|
|
sub get_feature ($$$) { |
5465 |
|
|
my ($self, $feature, $version) = @_; |
5466 |
|
|
|
5467 |
|
|
{ |
5468 |
|
|
|
5469 |
|
|
|
5470 |
|
|
$feature = lc $feature; |
5471 |
|
|
|
5472 |
|
|
|
5473 |
wakaba |
1.3 |
} |
5474 |
wakaba |
1.1 |
|
5475 |
|
|
{ |
5476 |
|
|
|
5477 |
|
|
|
5478 |
|
|
$version = '' unless defined $version; |
5479 |
|
|
|
5480 |
|
|
|
5481 |
wakaba |
1.3 |
} |
5482 |
wakaba |
1.1 |
my $r; |
5483 |
|
|
|
5484 |
|
|
{ |
5485 |
|
|
|
5486 |
|
|
|
5487 |
|
|
$feature =~ s/^\+//; |
5488 |
|
|
|
5489 |
|
|
|
5490 |
|
|
{ |
5491 |
|
|
|
5492 |
|
|
if |
5493 |
wakaba |
1.10 |
($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { |
5494 |
wakaba |
1.1 |
$r = $self; |
5495 |
|
|
} |
5496 |
|
|
|
5497 |
|
|
|
5498 |
wakaba |
1.3 |
} |
5499 |
wakaba |
1.1 |
|
5500 |
|
|
; |
5501 |
|
|
unless (defined $r) { |
5502 |
|
|
|
5503 |
|
|
|
5504 |
|
|
{ |
5505 |
|
|
|
5506 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5507 |
|
|
|
5508 |
|
|
{ |
5509 |
|
|
|
5510 |
|
|
|
5511 |
|
|
|
5512 |
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
5513 |
|
|
|
5514 |
|
|
|
5515 |
|
|
|
5516 |
wakaba |
1.3 |
} |
5517 |
wakaba |
1.1 |
|
5518 |
|
|
|
5519 |
|
|
;} |
5520 |
|
|
|
5521 |
|
|
; |
5522 |
|
|
} |
5523 |
|
|
|
5524 |
|
|
|
5525 |
wakaba |
1.3 |
} |
5526 |
wakaba |
1.1 |
$r} |
5527 |
|
|
sub base_uri ($;$) { |
5528 |
|
|
if (@_ == 1) {my ($self) = @_; |
5529 |
wakaba |
1.11 |
my $r; |
5530 |
wakaba |
1.1 |
|
5531 |
|
|
{ |
5532 |
|
|
|
5533 |
|
|
|
5534 |
|
|
{ |
5535 |
|
|
|
5536 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5537 |
|
|
|
5538 |
|
|
{ |
5539 |
|
|
|
5540 |
|
|
|
5541 |
|
|
|
5542 |
|
|
$r = $self-> |
5543 |
|
|
owner_document |
5544 |
|
|
-> |
5545 |
|
|
base_uri |
5546 |
|
|
; |
5547 |
|
|
|
5548 |
|
|
|
5549 |
|
|
|
5550 |
wakaba |
1.3 |
} |
5551 |
wakaba |
1.1 |
|
5552 |
|
|
|
5553 |
|
|
;} |
5554 |
|
|
|
5555 |
|
|
; |
5556 |
|
|
|
5557 |
|
|
|
5558 |
wakaba |
1.3 |
} |
5559 |
wakaba |
1.1 |
$r; |
5560 |
|
|
} else {my ($self) = @_; |
5561 |
|
|
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::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
5562 |
|
|
} |
5563 |
|
|
} |
5564 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>}->{has_feature} = {'core', |
5565 |
|
|
{'', |
5566 |
|
|
'1', |
5567 |
|
|
'1.0', |
5568 |
|
|
'1', |
5569 |
|
|
'2.0', |
5570 |
|
|
'1', |
5571 |
|
|
'3.0', |
5572 |
|
|
'1'}, |
5573 |
|
|
'xml', |
5574 |
|
|
{'', |
5575 |
|
|
'1', |
5576 |
|
|
'1.0', |
5577 |
|
|
'1', |
5578 |
|
|
'2.0', |
5579 |
|
|
'1', |
5580 |
|
|
'3.0', |
5581 |
|
|
'1'}, |
5582 |
|
|
'xmlversion', |
5583 |
|
|
{'', |
5584 |
|
|
'1', |
5585 |
|
|
'1.0', |
5586 |
|
|
'1', |
5587 |
|
|
'1.1', |
5588 |
|
|
'1'}}; |
5589 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = 14.1; |
5590 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>}->{compat_class}->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = 1; |
5591 |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = {'s1a', |
5592 |
|
|
['child'], |
5593 |
|
|
'w0', |
5594 |
|
|
['od']}; |
5595 |
|
|
for ($Message::DOM::IF::Document::, $Message::DOM::IF::DocumentFragment::, $Message::DOM::IF::Node::, $Message::DOM::IFLatest::Node::, $Message::DOM::IFLevel1::Document::, $Message::DOM::IFLevel1::DocumentFragment::, $Message::DOM::IFLevel1::Node::, $Message::DOM::IFLevel2::Document::, $Message::DOM::IFLevel2::DocumentFragment::, $Message::DOM::IFLevel2::Node::, $Message::DOM::IFLevel3::Document::, $Message::DOM::IFLevel3::DocumentFragment::, $Message::DOM::IFLevel3::Node::){} |
5596 |
|
|
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
5597 |
|
|
1; |