1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
## This file is automatically generated |
3 |
wakaba |
1.2 |
## at 2006-04-03T06:00:22+00:00, |
4 |
wakaba |
1.1 |
## from file "Document.dis", |
5 |
|
|
## 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::Element; |
11 |
|
|
require Message::DOM::TreeCore; |
12 |
|
|
require Message::Util::Error::DOMException; |
13 |
|
|
package Message::DOM::Document; |
14 |
wakaba |
1.2 |
our $VERSION = 20060403.0600; |
15 |
wakaba |
1.1 |
package Message::DOM::IFLatest::Document; |
16 |
wakaba |
1.2 |
our $VERSION = 20060403.0600; |
17 |
wakaba |
1.1 |
package Message::DOM::Document::ManakaiDOMDocument; |
18 |
wakaba |
1.2 |
our $VERSION = 20060403.0600; |
19 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
20 |
|
|
'Message::DOM::IF::Document', |
21 |
|
|
'Message::DOM::IF::Node', |
22 |
|
|
'Message::DOM::IFLatest::Document', |
23 |
|
|
'Message::DOM::IFLatest::Node', |
24 |
|
|
'Message::DOM::IFLevel1::Document', |
25 |
|
|
'Message::DOM::IFLevel1::Node', |
26 |
|
|
'Message::DOM::IFLevel2::Document', |
27 |
|
|
'Message::DOM::IFLevel2::Node', |
28 |
|
|
'Message::DOM::IFLevel3::Document', |
29 |
|
|
'Message::DOM::IFLevel3::Node'; |
30 |
|
|
use Char::Class::XML 'InXMLNCNameChar10', |
31 |
|
|
'InXMLNCNameChar11', |
32 |
|
|
'InXMLNCNameStartChar11', |
33 |
|
|
'InXMLNameChar10', |
34 |
|
|
'InXMLNameChar11', |
35 |
|
|
'InXMLNameStartChar11', |
36 |
|
|
'InXML_NCNameStartChar10', |
37 |
|
|
'InXML_NameStartChar10'; |
38 |
|
|
sub ___create_node_stem ($$$$) { |
39 |
|
|
my ($self, $bag, $obj, $opt) = @_; |
40 |
|
|
my $r = {}; |
41 |
|
|
|
42 |
|
|
{ |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
$obj->{ |
46 |
|
|
'child' |
47 |
|
|
} = []; |
48 |
|
|
$obj->{ |
49 |
|
|
'do' |
50 |
|
|
} = {}; |
51 |
|
|
$obj->{ |
52 |
|
|
'http://www.w3.org/2001/04/infoset#version' |
53 |
|
|
} = '1.0'; |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
{ |
57 |
|
|
|
58 |
|
|
|
59 |
|
|
$obj->{'impl'} = $opt->{'impl'}->{ |
60 |
|
|
'id' |
61 |
|
|
}; |
62 |
|
|
$bag->{${$opt->{'impl'}->{ |
63 |
|
|
'id' |
64 |
|
|
}}} |
65 |
|
|
->{'lpmi'}->{${$obj->{ |
66 |
|
|
'id' |
67 |
|
|
}}} |
68 |
|
|
= $obj->{ |
69 |
|
|
'id' |
70 |
|
|
}; |
71 |
|
|
|
72 |
|
|
|
73 |
|
|
;} |
74 |
|
|
|
75 |
|
|
; |
76 |
|
|
$r = $obj; |
77 |
|
|
|
78 |
|
|
|
79 |
|
|
;} |
80 |
|
|
$r} |
81 |
|
|
sub ___create_node_ref ($$$) { |
82 |
|
|
my ($self, $obj, $opt) = @_; |
83 |
|
|
my $r; |
84 |
|
|
|
85 |
|
|
{ |
86 |
|
|
|
87 |
|
|
my |
88 |
|
|
$class; |
89 |
|
|
CLS: { |
90 |
|
|
if (defined $opt->{ |
91 |
|
|
'nrcls' |
92 |
|
|
}) { |
93 |
|
|
$class = $opt->{ |
94 |
|
|
'nrcls' |
95 |
|
|
}; |
96 |
|
|
IFCHK: { |
97 |
|
|
for (@{$opt->{ |
98 |
|
|
'nrifs' |
99 |
|
|
} or []}) { |
100 |
|
|
last IFCHK unless $$class->isa ($_); |
101 |
|
|
} |
102 |
|
|
last CLS; |
103 |
|
|
} # IFCHK |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
{ |
109 |
|
|
|
110 |
|
|
|
111 |
|
|
$class = $obj->{ |
112 |
|
|
'b' |
113 |
|
|
}->{${$obj->{ |
114 |
|
|
'id' |
115 |
|
|
}}} |
116 |
|
|
->{'dnrcls'}; |
117 |
|
|
|
118 |
|
|
|
119 |
|
|
;} |
120 |
|
|
|
121 |
|
|
; |
122 |
|
|
if (defined $class) { |
123 |
|
|
IFCHK: { |
124 |
|
|
for (@{$opt->{ |
125 |
|
|
'nrifs' |
126 |
|
|
} or []}) { |
127 |
|
|
last IFCHK unless $$class->isa ($_); |
128 |
|
|
} |
129 |
|
|
last CLS; |
130 |
|
|
} # IFCHK |
131 |
|
|
} |
132 |
|
|
|
133 |
|
|
my $cns; |
134 |
|
|
|
135 |
|
|
|
136 |
|
|
{ |
137 |
|
|
|
138 |
|
|
|
139 |
|
|
$cns = $obj->{ |
140 |
|
|
'b' |
141 |
|
|
}->{${$obj->{ |
142 |
|
|
'id' |
143 |
|
|
}}} |
144 |
|
|
->{'child'}; |
145 |
|
|
|
146 |
|
|
|
147 |
|
|
;} |
148 |
|
|
|
149 |
|
|
; |
150 |
|
|
my $bag = |
151 |
|
|
$obj->{'b'} |
152 |
|
|
; |
153 |
|
|
my $deh; |
154 |
|
|
DC: for my $cnid (@$cns) { |
155 |
|
|
my $cnh = |
156 |
|
|
{ |
157 |
|
|
'id' => $cnid, |
158 |
|
|
'b' => $bag, |
159 |
|
|
} |
160 |
|
|
; |
161 |
|
|
my $cncls; |
162 |
|
|
|
163 |
|
|
|
164 |
|
|
{ |
165 |
|
|
|
166 |
|
|
|
167 |
|
|
$cncls = $cnh->{ |
168 |
|
|
'b' |
169 |
|
|
}->{${$cnh->{ |
170 |
|
|
'id' |
171 |
|
|
}}} |
172 |
|
|
->{'cls'}; |
173 |
|
|
|
174 |
|
|
|
175 |
|
|
;} |
176 |
|
|
|
177 |
|
|
; |
178 |
|
|
if ($$cncls eq |
179 |
|
|
'Message::DOM::Element::ManakaiDOMElement' |
180 |
|
|
) { |
181 |
|
|
$deh = $cnh; |
182 |
|
|
last DC; |
183 |
|
|
} |
184 |
|
|
} # DC |
185 |
|
|
my $dens; |
186 |
|
|
my $deln; |
187 |
|
|
if (defined $deh) { |
188 |
|
|
|
189 |
|
|
|
190 |
|
|
{ |
191 |
|
|
|
192 |
|
|
|
193 |
|
|
$dens = $deh->{ |
194 |
|
|
'b' |
195 |
|
|
}->{${$deh->{ |
196 |
|
|
'id' |
197 |
|
|
}}} |
198 |
|
|
->{'ns'}; |
199 |
|
|
|
200 |
|
|
|
201 |
|
|
;} |
202 |
|
|
|
203 |
|
|
; |
204 |
|
|
$dens = \'' unless defined $dens; |
205 |
|
|
|
206 |
|
|
|
207 |
|
|
{ |
208 |
|
|
|
209 |
|
|
|
210 |
|
|
$deln = $deh->{ |
211 |
|
|
'b' |
212 |
|
|
}->{${$deh->{ |
213 |
|
|
'id' |
214 |
|
|
}}} |
215 |
|
|
->{'ln'}; |
216 |
|
|
|
217 |
|
|
|
218 |
|
|
;} |
219 |
|
|
|
220 |
|
|
; |
221 |
|
|
} else { |
222 |
|
|
$dens = \'*'; |
223 |
|
|
$deln = \'*'; |
224 |
|
|
} |
225 |
|
|
|
226 |
|
|
A: { |
227 |
|
|
## Use cases: |
228 |
|
|
## - Document element is |html5:html| |
229 |
|
|
## - Document element is |NULL:rfc| |
230 |
|
|
|
231 |
|
|
for my $nm ( |
232 |
|
|
[$dens, $deln], |
233 |
|
|
[$dens, \'*'], |
234 |
|
|
) { |
235 |
|
|
for my $__class (sort { |
236 |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
237 |
|
|
} grep { |
238 |
|
|
$Message::DOM::DOMFeature::ClassInfo |
239 |
|
|
->{ |
240 |
|
|
'Message::DOM::Document::ManakaiDOMDocument' |
241 |
|
|
} |
242 |
|
|
->{compat_class_by_type} |
243 |
|
|
->{${$nm->[0]}}->{${$nm->[1]}}->{$_} |
244 |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo |
245 |
|
|
->{ |
246 |
|
|
'Message::DOM::Document::ManakaiDOMDocument' |
247 |
|
|
} |
248 |
|
|
->{compat_class_by_type} |
249 |
|
|
->{${$nm->[0]}}->{${$nm->[1]}} or {}}) { |
250 |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
251 |
|
|
->{has_feature}->{xml}->{'3.0'}) { |
252 |
|
|
$class = \$__class; |
253 |
|
|
IFCHK: { |
254 |
|
|
for (@{$opt->{ |
255 |
|
|
'nrifs' |
256 |
|
|
} or []}) { |
257 |
|
|
last IFCHK unless $$class->isa ($_); |
258 |
|
|
} |
259 |
|
|
last A; |
260 |
|
|
} # IFCHK |
261 |
|
|
} |
262 |
|
|
} |
263 |
|
|
} |
264 |
|
|
|
265 |
|
|
## Generic |
266 |
|
|
CLASS: for my $__class (sort { |
267 |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
268 |
|
|
} grep { |
269 |
|
|
$Message::DOM::DOMFeature::ClassInfo |
270 |
|
|
->{ |
271 |
|
|
'Message::DOM::Document::ManakaiDOMDocument' |
272 |
|
|
} |
273 |
|
|
->{compat_class}->{$_} |
274 |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo |
275 |
|
|
->{ |
276 |
|
|
'Message::DOM::Document::ManakaiDOMDocument' |
277 |
|
|
} |
278 |
|
|
->{compat_class} or {}}) { |
279 |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
280 |
|
|
->{has_feature}->{xml}->{'3.0'}) { |
281 |
|
|
$class = \$__class; |
282 |
|
|
IFCHK: { |
283 |
|
|
for (@{$opt->{ |
284 |
|
|
'nrifs' |
285 |
|
|
} or []}) { |
286 |
|
|
last IFCHK unless $$class->isa ($_); |
287 |
|
|
} |
288 |
|
|
last A; |
289 |
|
|
} # IFCHK |
290 |
|
|
} |
291 |
|
|
} |
292 |
|
|
|
293 |
|
|
## Default |
294 |
|
|
$class = \$self; |
295 |
|
|
} # A |
296 |
|
|
|
297 |
|
|
if (defined $deh) { |
298 |
|
|
|
299 |
|
|
|
300 |
|
|
{ |
301 |
|
|
|
302 |
|
|
|
303 |
|
|
$obj->{ |
304 |
|
|
'b' |
305 |
|
|
}->{${$obj->{ |
306 |
|
|
'id' |
307 |
|
|
}}} |
308 |
|
|
->{'dnrcls'} = $class; |
309 |
|
|
|
310 |
|
|
|
311 |
|
|
;} |
312 |
|
|
|
313 |
|
|
; |
314 |
|
|
} |
315 |
|
|
} # CLS |
316 |
|
|
$r = bless $obj, $$class; |
317 |
|
|
|
318 |
|
|
|
319 |
|
|
;} |
320 |
|
|
$r} |
321 |
|
|
sub node_type ($;$) { |
322 |
|
|
if (@_ == 1) {my ($self) = @_; |
323 |
|
|
my $r; |
324 |
|
|
$r = 9; |
325 |
|
|
$r; |
326 |
|
|
} else {my ($self) = @_; |
327 |
|
|
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'; |
328 |
|
|
} |
329 |
|
|
} |
330 |
|
|
sub append_child ($$) { |
331 |
|
|
my ($self, $newChild) = @_; |
332 |
|
|
my $r; |
333 |
|
|
|
334 |
|
|
{ |
335 |
|
|
|
336 |
|
|
my |
337 |
|
|
$strictc = $self-> |
338 |
|
|
dom_config |
339 |
|
|
|
340 |
|
|
-> |
341 |
|
|
get_parameter |
342 |
|
|
|
343 |
|
|
( |
344 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
345 |
|
|
); |
346 |
|
|
my $child_od = $newChild-> |
347 |
|
|
owner_document |
348 |
|
|
|| $self; |
349 |
|
|
my $child_nt = $newChild-> |
350 |
|
|
node_type |
351 |
|
|
; |
352 |
|
|
if ($strictc and $self-> |
353 |
|
|
strict_error_checking |
354 |
|
|
) { |
355 |
|
|
|
356 |
|
|
|
357 |
|
|
{ |
358 |
|
|
|
359 |
|
|
local $Error::Depth = $Error::Depth + 1; |
360 |
|
|
|
361 |
|
|
{ |
362 |
|
|
|
363 |
|
|
|
364 |
|
|
my |
365 |
|
|
$has_el; |
366 |
|
|
my $has_dt; |
367 |
|
|
if ($child_nt == |
368 |
|
|
1 |
369 |
|
|
) { |
370 |
|
|
$has_el = |
371 |
|
|
1 |
372 |
|
|
; |
373 |
|
|
} elsif ($child_nt == |
374 |
|
|
10 |
375 |
|
|
) { |
376 |
|
|
$has_dt = |
377 |
|
|
1 |
378 |
|
|
; |
379 |
|
|
} elsif ($child_nt == |
380 |
|
|
11 |
381 |
|
|
) { |
382 |
|
|
for my $cn (@{$newChild-> |
383 |
|
|
child_nodes |
384 |
|
|
}) { |
385 |
|
|
my $cnt = $cn-> |
386 |
|
|
node_type |
387 |
|
|
; |
388 |
|
|
if ($cnt == |
389 |
|
|
1 |
390 |
|
|
) { |
391 |
|
|
if ($has_el) { |
392 |
|
|
|
393 |
|
|
|
394 |
|
|
{ |
395 |
|
|
|
396 |
|
|
local $Error::Depth = $Error::Depth - 1; |
397 |
|
|
|
398 |
|
|
{ |
399 |
|
|
|
400 |
|
|
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; |
401 |
|
|
|
402 |
|
|
|
403 |
|
|
;} |
404 |
|
|
|
405 |
|
|
|
406 |
|
|
;} |
407 |
|
|
|
408 |
|
|
; |
409 |
|
|
} |
410 |
|
|
$has_el = |
411 |
|
|
1 |
412 |
|
|
; |
413 |
|
|
} |
414 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
415 |
|
|
} |
416 |
|
|
} |
417 |
|
|
|
418 |
|
|
if ($has_el) { |
419 |
|
|
my $anode = $self-> |
420 |
|
|
last_child |
421 |
|
|
; |
422 |
|
|
while (defined $anode) { |
423 |
|
|
if ($anode-> |
424 |
|
|
node_type |
425 |
|
|
== |
426 |
|
|
1 |
427 |
|
|
) { |
428 |
|
|
|
429 |
|
|
|
430 |
|
|
{ |
431 |
|
|
|
432 |
|
|
local $Error::Depth = $Error::Depth - 1; |
433 |
|
|
|
434 |
|
|
{ |
435 |
|
|
|
436 |
|
|
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; |
437 |
|
|
|
438 |
|
|
|
439 |
|
|
;} |
440 |
|
|
|
441 |
|
|
|
442 |
|
|
;} |
443 |
|
|
|
444 |
|
|
; |
445 |
|
|
} |
446 |
|
|
$anode = $anode-> |
447 |
|
|
previous_sibling |
448 |
|
|
; |
449 |
|
|
} |
450 |
|
|
} # has_el |
451 |
|
|
if ($has_dt) { |
452 |
|
|
my $anode = $self-> |
453 |
|
|
last_child |
454 |
|
|
; |
455 |
|
|
while (defined $anode) { |
456 |
|
|
my $ant = $anode-> |
457 |
|
|
node_type |
458 |
|
|
; |
459 |
|
|
if ($ant == |
460 |
|
|
1 |
461 |
|
|
) { |
462 |
|
|
|
463 |
|
|
|
464 |
|
|
{ |
465 |
|
|
|
466 |
|
|
local $Error::Depth = $Error::Depth - 1; |
467 |
|
|
|
468 |
|
|
{ |
469 |
|
|
|
470 |
|
|
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; |
471 |
|
|
|
472 |
|
|
|
473 |
|
|
;} |
474 |
|
|
|
475 |
|
|
|
476 |
|
|
;} |
477 |
|
|
|
478 |
|
|
; |
479 |
|
|
} elsif ($ant == |
480 |
|
|
10 |
481 |
|
|
) { |
482 |
|
|
|
483 |
|
|
|
484 |
|
|
{ |
485 |
|
|
|
486 |
|
|
local $Error::Depth = $Error::Depth - 1; |
487 |
|
|
|
488 |
|
|
{ |
489 |
|
|
|
490 |
|
|
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; |
491 |
|
|
|
492 |
|
|
|
493 |
|
|
;} |
494 |
|
|
|
495 |
|
|
|
496 |
|
|
;} |
497 |
|
|
|
498 |
|
|
; |
499 |
|
|
} |
500 |
|
|
$anode = $anode-> |
501 |
|
|
previous_sibling |
502 |
|
|
; |
503 |
|
|
} |
504 |
|
|
} # has_dt |
505 |
|
|
|
506 |
|
|
|
507 |
|
|
|
508 |
|
|
;} |
509 |
|
|
|
510 |
|
|
|
511 |
|
|
;} |
512 |
|
|
|
513 |
|
|
; |
514 |
|
|
} |
515 |
|
|
|
516 |
|
|
|
517 |
|
|
{ |
518 |
|
|
|
519 |
|
|
|
520 |
|
|
{ |
521 |
|
|
|
522 |
|
|
local $Error::Depth = $Error::Depth + 1; |
523 |
|
|
|
524 |
|
|
{ |
525 |
|
|
|
526 |
|
|
|
527 |
|
|
my |
528 |
|
|
$strict = $self-> |
529 |
|
|
strict_error_checking |
530 |
|
|
; |
531 |
|
|
|
532 |
|
|
## -- Node Type check |
533 |
|
|
my @new_child; |
534 |
|
|
if ({ |
535 |
|
|
3 => (not $strictc), |
536 |
|
|
5 => (not $strictc), |
537 |
|
|
1 => 1, |
538 |
|
|
4 => (not $strictc), |
539 |
|
|
7 => 1, |
540 |
|
|
8 => 1, |
541 |
|
|
10 => 1, |
542 |
|
|
}->{$child_nt}) { |
543 |
|
|
push @new_child, $newChild; |
544 |
|
|
} elsif ($child_nt == |
545 |
|
|
11 |
546 |
|
|
) { |
547 |
|
|
for my $cn (@{$newChild-> |
548 |
|
|
child_nodes |
549 |
|
|
}) { |
550 |
|
|
unless ({ |
551 |
|
|
3 => (not $strictc), |
552 |
|
|
5 => (not $strictc), |
553 |
|
|
1 => 1, |
554 |
|
|
4 => (not $strictc), |
555 |
|
|
7 => 1, |
556 |
|
|
8 => 1, |
557 |
|
|
10 => 1, |
558 |
|
|
}->{$cn-> |
559 |
|
|
node_type |
560 |
|
|
}) { |
561 |
|
|
|
562 |
|
|
|
563 |
|
|
{ |
564 |
|
|
|
565 |
|
|
local $Error::Depth = $Error::Depth - 1; |
566 |
|
|
|
567 |
|
|
{ |
568 |
|
|
|
569 |
|
|
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; |
570 |
|
|
|
571 |
|
|
|
572 |
|
|
;} |
573 |
|
|
|
574 |
|
|
|
575 |
|
|
;} |
576 |
|
|
|
577 |
|
|
; |
578 |
|
|
} |
579 |
|
|
push @new_child, $cn; |
580 |
|
|
} |
581 |
|
|
} else { |
582 |
|
|
|
583 |
|
|
|
584 |
|
|
{ |
585 |
|
|
|
586 |
|
|
local $Error::Depth = $Error::Depth - 1; |
587 |
|
|
|
588 |
|
|
{ |
589 |
|
|
|
590 |
|
|
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; |
591 |
|
|
|
592 |
|
|
|
593 |
|
|
;} |
594 |
|
|
|
595 |
|
|
|
596 |
|
|
;} |
597 |
|
|
|
598 |
|
|
; |
599 |
|
|
} |
600 |
|
|
|
601 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
602 |
|
|
parent_node |
603 |
|
|
: |
604 |
|
|
|
605 |
|
|
undef |
606 |
|
|
; |
607 |
|
|
if ($strict) { |
608 |
|
|
## -- Wrong-document check |
609 |
|
|
unless ($self eq $child_od) { |
610 |
|
|
|
611 |
|
|
|
612 |
|
|
{ |
613 |
|
|
|
614 |
|
|
local $Error::Depth = $Error::Depth - 1; |
615 |
|
|
|
616 |
|
|
{ |
617 |
|
|
|
618 |
|
|
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; |
619 |
|
|
|
620 |
|
|
|
621 |
|
|
;} |
622 |
|
|
|
623 |
|
|
|
624 |
|
|
;} |
625 |
|
|
|
626 |
|
|
; |
627 |
|
|
} |
628 |
|
|
|
629 |
|
|
## -- Read-onlyness check |
630 |
|
|
if ($self-> |
631 |
|
|
manakai_read_only |
632 |
|
|
) { |
633 |
|
|
|
634 |
|
|
|
635 |
|
|
{ |
636 |
|
|
|
637 |
|
|
local $Error::Depth = $Error::Depth - 1; |
638 |
|
|
|
639 |
|
|
{ |
640 |
|
|
|
641 |
|
|
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'; |
642 |
|
|
|
643 |
|
|
|
644 |
|
|
;} |
645 |
|
|
|
646 |
|
|
|
647 |
|
|
;} |
648 |
|
|
|
649 |
|
|
; |
650 |
|
|
} |
651 |
|
|
if (@new_child) { |
652 |
|
|
if ($nc_parent and |
653 |
|
|
$nc_parent-> |
654 |
|
|
manakai_read_only |
655 |
|
|
) { |
656 |
|
|
|
657 |
|
|
|
658 |
|
|
{ |
659 |
|
|
|
660 |
|
|
local $Error::Depth = $Error::Depth - 1; |
661 |
|
|
|
662 |
|
|
{ |
663 |
|
|
|
664 |
|
|
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'; |
665 |
|
|
|
666 |
|
|
|
667 |
|
|
;} |
668 |
|
|
|
669 |
|
|
|
670 |
|
|
;} |
671 |
|
|
|
672 |
|
|
; |
673 |
|
|
} |
674 |
|
|
} |
675 |
|
|
} |
676 |
|
|
|
677 |
|
|
## -- Insert at... |
678 |
|
|
my $index = -1; # last |
679 |
|
|
|
680 |
|
|
|
681 |
|
|
; # FOR !tc:ForAppendChild |
682 |
|
|
|
683 |
|
|
## -- Removes from parent |
684 |
|
|
if ($nc_parent) { |
685 |
|
|
if ($child_nt == |
686 |
|
|
11 |
687 |
|
|
) { |
688 |
|
|
|
689 |
|
|
|
690 |
|
|
{ |
691 |
|
|
|
692 |
|
|
|
693 |
|
|
$newChild->{ |
694 |
|
|
'b' |
695 |
|
|
}->{${$newChild->{ |
696 |
|
|
'id' |
697 |
|
|
}}} |
698 |
|
|
->{'child'} = []; |
699 |
|
|
|
700 |
|
|
|
701 |
|
|
;} |
702 |
|
|
|
703 |
|
|
; |
704 |
|
|
} else { |
705 |
|
|
my $v; |
706 |
|
|
|
707 |
|
|
|
708 |
|
|
{ |
709 |
|
|
|
710 |
|
|
|
711 |
|
|
$v = $nc_parent->{ |
712 |
|
|
'b' |
713 |
|
|
}->{${$nc_parent->{ |
714 |
|
|
'id' |
715 |
|
|
}}} |
716 |
|
|
->{'child'}; |
717 |
|
|
|
718 |
|
|
|
719 |
|
|
;} |
720 |
|
|
|
721 |
|
|
; |
722 |
|
|
RP: for my $i (0..$#$v) { |
723 |
|
|
my $nodeid = $v->[$i]; |
724 |
|
|
if ( |
725 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
726 |
|
|
) { |
727 |
|
|
splice @$v, $i, 1, (); |
728 |
|
|
last RP; |
729 |
|
|
} |
730 |
|
|
} # RP |
731 |
|
|
} |
732 |
|
|
} |
733 |
|
|
|
734 |
|
|
## -- Rewrite the |parentNode| properties |
735 |
|
|
for my $nc (@new_child) { |
736 |
|
|
|
737 |
|
|
|
738 |
|
|
{ |
739 |
|
|
|
740 |
|
|
|
741 |
|
|
$nc->{ |
742 |
|
|
'b' |
743 |
|
|
}->{${$nc->{ |
744 |
|
|
'id' |
745 |
|
|
}}} |
746 |
|
|
->{'parent'} = $self->{ |
747 |
|
|
'id' |
748 |
|
|
}; |
749 |
|
|
|
750 |
|
|
|
751 |
|
|
;} |
752 |
|
|
|
753 |
|
|
; |
754 |
|
|
} |
755 |
|
|
|
756 |
|
|
my $children; |
757 |
|
|
|
758 |
|
|
|
759 |
|
|
{ |
760 |
|
|
|
761 |
|
|
|
762 |
|
|
$children = $self->{ |
763 |
|
|
'b' |
764 |
|
|
}->{${$self->{ |
765 |
|
|
'id' |
766 |
|
|
}}} |
767 |
|
|
->{'child'}; |
768 |
|
|
|
769 |
|
|
|
770 |
|
|
;} |
771 |
|
|
|
772 |
|
|
; |
773 |
|
|
|
774 |
|
|
|
775 |
|
|
|
776 |
|
|
{ |
777 |
|
|
|
778 |
|
|
|
779 |
|
|
## -- Adds to children list |
780 |
|
|
push @$children, map { |
781 |
|
|
|
782 |
|
|
$_->{'id'} |
783 |
|
|
|
784 |
|
|
} @new_child; |
785 |
|
|
$r = $newChild; |
786 |
|
|
|
787 |
|
|
|
788 |
|
|
|
789 |
|
|
;} |
790 |
|
|
|
791 |
|
|
; |
792 |
|
|
|
793 |
|
|
|
794 |
|
|
|
795 |
|
|
; |
796 |
|
|
|
797 |
|
|
|
798 |
|
|
|
799 |
|
|
; |
800 |
|
|
|
801 |
|
|
|
802 |
|
|
|
803 |
|
|
;} |
804 |
|
|
|
805 |
|
|
|
806 |
|
|
;} |
807 |
|
|
|
808 |
|
|
; |
809 |
|
|
|
810 |
|
|
|
811 |
|
|
;} |
812 |
|
|
|
813 |
|
|
; |
814 |
|
|
if ($child_nt == |
815 |
|
|
10 and |
816 |
|
|
|
817 |
|
|
not defined $newChild-> |
818 |
|
|
owner_document |
819 |
|
|
) { |
820 |
|
|
my $bag = |
821 |
|
|
$self->{'b'} |
822 |
|
|
; |
823 |
|
|
|
824 |
|
|
|
825 |
|
|
{ |
826 |
|
|
|
827 |
|
|
CORE::delete |
828 |
|
|
$bag->{${$bag->{${$newChild->{ |
829 |
|
|
'id' |
830 |
|
|
}}} |
831 |
|
|
->{'impl'} or \''}} |
832 |
|
|
->{'lpmi'}; |
833 |
wakaba |
1.2 |
$bag->{ |
834 |
wakaba |
1.1 |
'm' |
835 |
wakaba |
1.2 |
} |
836 |
|
|
->{${$bag->{${$newChild->{ |
837 |
wakaba |
1.1 |
'id' |
838 |
wakaba |
1.2 |
}}}->{'impl'}}} |
839 |
|
|
= |
840 |
|
|
1 |
841 |
|
|
; |
842 |
wakaba |
1.1 |
CORE::delete $bag->{${$newChild->{ |
843 |
|
|
'id' |
844 |
|
|
}}} |
845 |
|
|
->{'impl'}; |
846 |
|
|
|
847 |
|
|
|
848 |
|
|
;} |
849 |
|
|
|
850 |
|
|
; |
851 |
|
|
|
852 |
|
|
|
853 |
|
|
{ |
854 |
|
|
|
855 |
|
|
|
856 |
|
|
$bag->{${$newChild->{ |
857 |
|
|
'id' |
858 |
|
|
}}}->{'od'} |
859 |
|
|
= $self->{ |
860 |
|
|
'id' |
861 |
|
|
}; |
862 |
|
|
$bag->{${$self->{ |
863 |
|
|
'id' |
864 |
|
|
}}} |
865 |
|
|
->{'do'}->{${$newChild->{ |
866 |
|
|
'id' |
867 |
|
|
}}} |
868 |
|
|
= $newChild->{ |
869 |
|
|
'id' |
870 |
|
|
}; |
871 |
|
|
|
872 |
|
|
|
873 |
|
|
;} |
874 |
|
|
|
875 |
|
|
; |
876 |
|
|
} |
877 |
|
|
|
878 |
|
|
|
879 |
|
|
;} |
880 |
|
|
$r} |
881 |
|
|
sub insert_before ($$;$) { |
882 |
|
|
my ($self, $newChild, $refChild) = @_; |
883 |
|
|
my $r; |
884 |
|
|
|
885 |
|
|
{ |
886 |
|
|
|
887 |
|
|
my |
888 |
|
|
$strictc = $self-> |
889 |
|
|
dom_config |
890 |
|
|
|
891 |
|
|
-> |
892 |
|
|
get_parameter |
893 |
|
|
|
894 |
|
|
( |
895 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
896 |
|
|
); |
897 |
|
|
my $child_od = $newChild-> |
898 |
|
|
owner_document |
899 |
|
|
|| $self; |
900 |
|
|
my $child_nt = $newChild-> |
901 |
|
|
node_type |
902 |
|
|
; |
903 |
|
|
if ($strictc and $self-> |
904 |
|
|
strict_error_checking |
905 |
|
|
) { |
906 |
|
|
|
907 |
|
|
|
908 |
|
|
{ |
909 |
|
|
|
910 |
|
|
local $Error::Depth = $Error::Depth + 1; |
911 |
|
|
|
912 |
|
|
{ |
913 |
|
|
|
914 |
|
|
|
915 |
|
|
my |
916 |
|
|
$has_el; |
917 |
|
|
my $has_dt; |
918 |
|
|
if ($child_nt == |
919 |
|
|
1 |
920 |
|
|
) { |
921 |
|
|
$has_el = |
922 |
|
|
1 |
923 |
|
|
; |
924 |
|
|
} elsif ($child_nt == |
925 |
|
|
10 |
926 |
|
|
) { |
927 |
|
|
$has_dt = |
928 |
|
|
1 |
929 |
|
|
; |
930 |
|
|
} elsif ($child_nt == |
931 |
|
|
11 |
932 |
|
|
) { |
933 |
|
|
for my $cn (@{$newChild-> |
934 |
|
|
child_nodes |
935 |
|
|
}) { |
936 |
|
|
my $cnt = $cn-> |
937 |
|
|
node_type |
938 |
|
|
; |
939 |
|
|
if ($cnt == |
940 |
|
|
1 |
941 |
|
|
) { |
942 |
|
|
if ($has_el) { |
943 |
|
|
|
944 |
|
|
|
945 |
|
|
{ |
946 |
|
|
|
947 |
|
|
local $Error::Depth = $Error::Depth - 1; |
948 |
|
|
|
949 |
|
|
{ |
950 |
|
|
|
951 |
|
|
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; |
952 |
|
|
|
953 |
|
|
|
954 |
|
|
;} |
955 |
|
|
|
956 |
|
|
|
957 |
|
|
;} |
958 |
|
|
|
959 |
|
|
; |
960 |
|
|
} |
961 |
|
|
$has_el = |
962 |
|
|
1 |
963 |
|
|
; |
964 |
|
|
} |
965 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
966 |
|
|
} |
967 |
|
|
} |
968 |
|
|
|
969 |
|
|
if ($has_el) { |
970 |
|
|
my $anode = $refChild ? $refChild-> |
971 |
|
|
previous_sibling |
972 |
|
|
: |
973 |
|
|
$self-> |
974 |
|
|
last_child |
975 |
|
|
; |
976 |
|
|
while (defined $anode) { |
977 |
|
|
if ($anode-> |
978 |
|
|
node_type |
979 |
|
|
== |
980 |
|
|
1 |
981 |
|
|
) { |
982 |
|
|
|
983 |
|
|
|
984 |
|
|
{ |
985 |
|
|
|
986 |
|
|
local $Error::Depth = $Error::Depth - 1; |
987 |
|
|
|
988 |
|
|
{ |
989 |
|
|
|
990 |
|
|
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; |
991 |
|
|
|
992 |
|
|
|
993 |
|
|
;} |
994 |
|
|
|
995 |
|
|
|
996 |
|
|
;} |
997 |
|
|
|
998 |
|
|
; |
999 |
|
|
} |
1000 |
|
|
$anode = $anode-> |
1001 |
|
|
previous_sibling |
1002 |
|
|
; |
1003 |
|
|
} |
1004 |
|
|
$anode = $refChild; |
1005 |
|
|
while (defined $anode) { |
1006 |
|
|
my $ant = $anode-> |
1007 |
|
|
node_type |
1008 |
|
|
; |
1009 |
|
|
if ($ant == |
1010 |
|
|
1 |
1011 |
|
|
) { |
1012 |
|
|
|
1013 |
|
|
|
1014 |
|
|
{ |
1015 |
|
|
|
1016 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1017 |
|
|
|
1018 |
|
|
{ |
1019 |
|
|
|
1020 |
|
|
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; |
1021 |
|
|
|
1022 |
|
|
|
1023 |
|
|
;} |
1024 |
|
|
|
1025 |
|
|
|
1026 |
|
|
;} |
1027 |
|
|
|
1028 |
|
|
; |
1029 |
|
|
} elsif ($ant == |
1030 |
|
|
10 |
1031 |
|
|
) { |
1032 |
|
|
|
1033 |
|
|
|
1034 |
|
|
{ |
1035 |
|
|
|
1036 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1037 |
|
|
|
1038 |
|
|
{ |
1039 |
|
|
|
1040 |
|
|
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; |
1041 |
|
|
|
1042 |
|
|
|
1043 |
|
|
;} |
1044 |
|
|
|
1045 |
|
|
|
1046 |
|
|
;} |
1047 |
|
|
|
1048 |
|
|
; |
1049 |
|
|
} |
1050 |
|
|
$anode = $anode-> |
1051 |
|
|
next_sibling |
1052 |
|
|
; |
1053 |
|
|
} |
1054 |
|
|
} # has_el |
1055 |
|
|
if ($has_dt) { |
1056 |
|
|
my $anode = $refChild ? $refChild-> |
1057 |
|
|
previous_sibling |
1058 |
|
|
: |
1059 |
|
|
$self-> |
1060 |
|
|
last_child |
1061 |
|
|
; |
1062 |
|
|
while (defined $anode) { |
1063 |
|
|
my $ant = $anode-> |
1064 |
|
|
node_type |
1065 |
|
|
; |
1066 |
|
|
if ($ant == |
1067 |
|
|
1 |
1068 |
|
|
) { |
1069 |
|
|
|
1070 |
|
|
|
1071 |
|
|
{ |
1072 |
|
|
|
1073 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1074 |
|
|
|
1075 |
|
|
{ |
1076 |
|
|
|
1077 |
|
|
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; |
1078 |
|
|
|
1079 |
|
|
|
1080 |
|
|
;} |
1081 |
|
|
|
1082 |
|
|
|
1083 |
|
|
;} |
1084 |
|
|
|
1085 |
|
|
; |
1086 |
|
|
} elsif ($ant == |
1087 |
|
|
10 |
1088 |
|
|
) { |
1089 |
|
|
|
1090 |
|
|
|
1091 |
|
|
{ |
1092 |
|
|
|
1093 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1094 |
|
|
|
1095 |
|
|
{ |
1096 |
|
|
|
1097 |
|
|
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; |
1098 |
|
|
|
1099 |
|
|
|
1100 |
|
|
;} |
1101 |
|
|
|
1102 |
|
|
|
1103 |
|
|
;} |
1104 |
|
|
|
1105 |
|
|
; |
1106 |
|
|
} |
1107 |
|
|
$anode = $anode-> |
1108 |
|
|
previous_sibling |
1109 |
|
|
; |
1110 |
|
|
} |
1111 |
|
|
$anode = $refChild; |
1112 |
|
|
while (defined $anode) { |
1113 |
|
|
if ($anode-> |
1114 |
|
|
node_type |
1115 |
|
|
|
1116 |
|
|
== |
1117 |
|
|
10 |
1118 |
|
|
) { |
1119 |
|
|
|
1120 |
|
|
|
1121 |
|
|
{ |
1122 |
|
|
|
1123 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1124 |
|
|
|
1125 |
|
|
{ |
1126 |
|
|
|
1127 |
|
|
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; |
1128 |
|
|
|
1129 |
|
|
|
1130 |
|
|
;} |
1131 |
|
|
|
1132 |
|
|
|
1133 |
|
|
;} |
1134 |
|
|
|
1135 |
|
|
; |
1136 |
|
|
} |
1137 |
|
|
$anode = $anode-> |
1138 |
|
|
next_sibling |
1139 |
|
|
; |
1140 |
|
|
} |
1141 |
|
|
} # has_dt |
1142 |
|
|
|
1143 |
|
|
|
1144 |
|
|
|
1145 |
|
|
;} |
1146 |
|
|
|
1147 |
|
|
|
1148 |
|
|
;} |
1149 |
|
|
|
1150 |
|
|
; |
1151 |
|
|
} |
1152 |
|
|
|
1153 |
|
|
|
1154 |
|
|
{ |
1155 |
|
|
|
1156 |
|
|
|
1157 |
|
|
{ |
1158 |
|
|
|
1159 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1160 |
|
|
|
1161 |
|
|
{ |
1162 |
|
|
|
1163 |
|
|
|
1164 |
|
|
my |
1165 |
|
|
$strict = $self-> |
1166 |
|
|
strict_error_checking |
1167 |
|
|
; |
1168 |
|
|
|
1169 |
|
|
## -- Node Type check |
1170 |
|
|
my @new_child; |
1171 |
|
|
if ({ |
1172 |
|
|
3 => (not $strictc), |
1173 |
|
|
5 => (not $strictc), |
1174 |
|
|
1 => 1, |
1175 |
|
|
4 => (not $strictc), |
1176 |
|
|
7 => 1, |
1177 |
|
|
8 => 1, |
1178 |
|
|
10 => 1, |
1179 |
|
|
}->{$child_nt}) { |
1180 |
|
|
push @new_child, $newChild; |
1181 |
|
|
} elsif ($child_nt == |
1182 |
|
|
11 |
1183 |
|
|
) { |
1184 |
|
|
for my $cn (@{$newChild-> |
1185 |
|
|
child_nodes |
1186 |
|
|
}) { |
1187 |
|
|
unless ({ |
1188 |
|
|
3 => (not $strictc), |
1189 |
|
|
5 => (not $strictc), |
1190 |
|
|
1 => 1, |
1191 |
|
|
4 => (not $strictc), |
1192 |
|
|
7 => 1, |
1193 |
|
|
8 => 1, |
1194 |
|
|
10 => 1, |
1195 |
|
|
}->{$cn-> |
1196 |
|
|
node_type |
1197 |
|
|
}) { |
1198 |
|
|
|
1199 |
|
|
|
1200 |
|
|
{ |
1201 |
|
|
|
1202 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1203 |
|
|
|
1204 |
|
|
{ |
1205 |
|
|
|
1206 |
|
|
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; |
1207 |
|
|
|
1208 |
|
|
|
1209 |
|
|
;} |
1210 |
|
|
|
1211 |
|
|
|
1212 |
|
|
;} |
1213 |
|
|
|
1214 |
|
|
; |
1215 |
|
|
} |
1216 |
|
|
push @new_child, $cn; |
1217 |
|
|
} |
1218 |
|
|
} else { |
1219 |
|
|
|
1220 |
|
|
|
1221 |
|
|
{ |
1222 |
|
|
|
1223 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1224 |
|
|
|
1225 |
|
|
{ |
1226 |
|
|
|
1227 |
|
|
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; |
1228 |
|
|
|
1229 |
|
|
|
1230 |
|
|
;} |
1231 |
|
|
|
1232 |
|
|
|
1233 |
|
|
;} |
1234 |
|
|
|
1235 |
|
|
; |
1236 |
|
|
} |
1237 |
|
|
|
1238 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
1239 |
|
|
parent_node |
1240 |
|
|
: |
1241 |
|
|
|
1242 |
|
|
undef |
1243 |
|
|
; |
1244 |
|
|
if ($strict) { |
1245 |
|
|
## -- Wrong-document check |
1246 |
|
|
unless ($self eq $child_od) { |
1247 |
|
|
|
1248 |
|
|
|
1249 |
|
|
{ |
1250 |
|
|
|
1251 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1252 |
|
|
|
1253 |
|
|
{ |
1254 |
|
|
|
1255 |
|
|
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; |
1256 |
|
|
|
1257 |
|
|
|
1258 |
|
|
;} |
1259 |
|
|
|
1260 |
|
|
|
1261 |
|
|
;} |
1262 |
|
|
|
1263 |
|
|
; |
1264 |
|
|
} |
1265 |
|
|
|
1266 |
|
|
## -- Read-onlyness check |
1267 |
|
|
if ($self-> |
1268 |
|
|
manakai_read_only |
1269 |
|
|
) { |
1270 |
|
|
|
1271 |
|
|
|
1272 |
|
|
{ |
1273 |
|
|
|
1274 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1275 |
|
|
|
1276 |
|
|
{ |
1277 |
|
|
|
1278 |
|
|
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'; |
1279 |
|
|
|
1280 |
|
|
|
1281 |
|
|
;} |
1282 |
|
|
|
1283 |
|
|
|
1284 |
|
|
;} |
1285 |
|
|
|
1286 |
|
|
; |
1287 |
|
|
} |
1288 |
|
|
if (@new_child) { |
1289 |
|
|
if ($nc_parent and |
1290 |
|
|
$nc_parent-> |
1291 |
|
|
manakai_read_only |
1292 |
|
|
) { |
1293 |
|
|
|
1294 |
|
|
|
1295 |
|
|
{ |
1296 |
|
|
|
1297 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1298 |
|
|
|
1299 |
|
|
{ |
1300 |
|
|
|
1301 |
|
|
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'; |
1302 |
|
|
|
1303 |
|
|
|
1304 |
|
|
;} |
1305 |
|
|
|
1306 |
|
|
|
1307 |
|
|
;} |
1308 |
|
|
|
1309 |
|
|
; |
1310 |
|
|
} |
1311 |
|
|
} |
1312 |
|
|
} |
1313 |
|
|
|
1314 |
|
|
## -- Insert at... |
1315 |
|
|
my $index = -1; # last |
1316 |
|
|
|
1317 |
|
|
|
1318 |
|
|
{ |
1319 |
|
|
|
1320 |
|
|
|
1321 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
1322 |
|
|
if (defined $refChild) { |
1323 |
|
|
if ($refChild eq $newChild) { |
1324 |
|
|
|
1325 |
|
|
|
1326 |
|
|
{ |
1327 |
|
|
|
1328 |
|
|
|
1329 |
|
|
{ |
1330 |
|
|
|
1331 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1332 |
|
|
|
1333 |
|
|
{ |
1334 |
|
|
|
1335 |
|
|
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'; |
1336 |
|
|
|
1337 |
|
|
|
1338 |
|
|
;} |
1339 |
|
|
|
1340 |
|
|
|
1341 |
|
|
;} |
1342 |
|
|
|
1343 |
|
|
; |
1344 |
|
|
|
1345 |
|
|
|
1346 |
|
|
|
1347 |
|
|
;} |
1348 |
|
|
|
1349 |
|
|
; |
1350 |
|
|
|
1351 |
|
|
|
1352 |
|
|
; |
1353 |
|
|
} |
1354 |
|
|
|
1355 |
|
|
my $cns = $self-> |
1356 |
|
|
child_nodes |
1357 |
|
|
; |
1358 |
|
|
my $cnsl = @$cns; |
1359 |
|
|
C: { |
1360 |
|
|
$index = 0; |
1361 |
|
|
for my $i (0..($cnsl-1)) { |
1362 |
|
|
my $cn = $cns->[$i]; |
1363 |
|
|
if ($cn eq $refChild) { |
1364 |
|
|
$index += $i; |
1365 |
|
|
last C; |
1366 |
|
|
} elsif ($cn eq $newChild) { |
1367 |
|
|
$index = -1; # offset |
1368 |
|
|
} |
1369 |
|
|
} |
1370 |
|
|
|
1371 |
|
|
|
1372 |
|
|
{ |
1373 |
|
|
|
1374 |
|
|
|
1375 |
|
|
{ |
1376 |
|
|
|
1377 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1378 |
|
|
|
1379 |
|
|
{ |
1380 |
|
|
|
1381 |
|
|
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; |
1382 |
|
|
|
1383 |
|
|
|
1384 |
|
|
;} |
1385 |
|
|
|
1386 |
|
|
|
1387 |
|
|
;} |
1388 |
|
|
|
1389 |
|
|
; |
1390 |
|
|
|
1391 |
|
|
|
1392 |
|
|
|
1393 |
|
|
;} |
1394 |
|
|
|
1395 |
|
|
; |
1396 |
|
|
|
1397 |
|
|
|
1398 |
|
|
; |
1399 |
|
|
} # C |
1400 |
|
|
} else { # |oldChild| is not defined |
1401 |
|
|
|
1402 |
|
|
|
1403 |
|
|
; |
1404 |
|
|
} |
1405 |
|
|
|
1406 |
|
|
|
1407 |
|
|
|
1408 |
|
|
;} |
1409 |
|
|
|
1410 |
|
|
; # FOR !tc:ForAppendChild |
1411 |
|
|
|
1412 |
|
|
## -- Removes from parent |
1413 |
|
|
if ($nc_parent) { |
1414 |
|
|
if ($child_nt == |
1415 |
|
|
11 |
1416 |
|
|
) { |
1417 |
|
|
|
1418 |
|
|
|
1419 |
|
|
{ |
1420 |
|
|
|
1421 |
|
|
|
1422 |
|
|
$newChild->{ |
1423 |
|
|
'b' |
1424 |
|
|
}->{${$newChild->{ |
1425 |
|
|
'id' |
1426 |
|
|
}}} |
1427 |
|
|
->{'child'} = []; |
1428 |
|
|
|
1429 |
|
|
|
1430 |
|
|
;} |
1431 |
|
|
|
1432 |
|
|
; |
1433 |
|
|
} else { |
1434 |
|
|
my $v; |
1435 |
|
|
|
1436 |
|
|
|
1437 |
|
|
{ |
1438 |
|
|
|
1439 |
|
|
|
1440 |
|
|
$v = $nc_parent->{ |
1441 |
|
|
'b' |
1442 |
|
|
}->{${$nc_parent->{ |
1443 |
|
|
'id' |
1444 |
|
|
}}} |
1445 |
|
|
->{'child'}; |
1446 |
|
|
|
1447 |
|
|
|
1448 |
|
|
;} |
1449 |
|
|
|
1450 |
|
|
; |
1451 |
|
|
RP: for my $i (0..$#$v) { |
1452 |
|
|
my $nodeid = $v->[$i]; |
1453 |
|
|
if ( |
1454 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
1455 |
|
|
) { |
1456 |
|
|
splice @$v, $i, 1, (); |
1457 |
|
|
last RP; |
1458 |
|
|
} |
1459 |
|
|
} # RP |
1460 |
|
|
} |
1461 |
|
|
} |
1462 |
|
|
|
1463 |
|
|
## -- Rewrite the |parentNode| properties |
1464 |
|
|
for my $nc (@new_child) { |
1465 |
|
|
|
1466 |
|
|
|
1467 |
|
|
{ |
1468 |
|
|
|
1469 |
|
|
|
1470 |
|
|
$nc->{ |
1471 |
|
|
'b' |
1472 |
|
|
}->{${$nc->{ |
1473 |
|
|
'id' |
1474 |
|
|
}}} |
1475 |
|
|
->{'parent'} = $self->{ |
1476 |
|
|
'id' |
1477 |
|
|
}; |
1478 |
|
|
|
1479 |
|
|
|
1480 |
|
|
;} |
1481 |
|
|
|
1482 |
|
|
; |
1483 |
|
|
} |
1484 |
|
|
|
1485 |
|
|
my $children; |
1486 |
|
|
|
1487 |
|
|
|
1488 |
|
|
{ |
1489 |
|
|
|
1490 |
|
|
|
1491 |
|
|
$children = $self->{ |
1492 |
|
|
'b' |
1493 |
|
|
}->{${$self->{ |
1494 |
|
|
'id' |
1495 |
|
|
}}} |
1496 |
|
|
->{'child'}; |
1497 |
|
|
|
1498 |
|
|
|
1499 |
|
|
;} |
1500 |
|
|
|
1501 |
|
|
; |
1502 |
|
|
|
1503 |
|
|
|
1504 |
|
|
|
1505 |
|
|
; |
1506 |
|
|
|
1507 |
|
|
|
1508 |
|
|
|
1509 |
|
|
{ |
1510 |
|
|
|
1511 |
|
|
|
1512 |
|
|
## -- Adds to children list |
1513 |
|
|
if ($index == -1) { |
1514 |
|
|
push @$children, map { |
1515 |
|
|
|
1516 |
|
|
$_->{'id'} |
1517 |
|
|
|
1518 |
|
|
} @new_child; |
1519 |
|
|
} else { |
1520 |
|
|
splice @$children, $index, 0, map { |
1521 |
|
|
|
1522 |
|
|
$_->{'id'} |
1523 |
|
|
|
1524 |
|
|
} @new_child; |
1525 |
|
|
} |
1526 |
|
|
$r = $newChild; |
1527 |
|
|
|
1528 |
|
|
|
1529 |
|
|
|
1530 |
|
|
;} |
1531 |
|
|
|
1532 |
|
|
; |
1533 |
|
|
|
1534 |
|
|
|
1535 |
|
|
|
1536 |
|
|
; |
1537 |
|
|
|
1538 |
|
|
|
1539 |
|
|
|
1540 |
|
|
;} |
1541 |
|
|
|
1542 |
|
|
|
1543 |
|
|
;} |
1544 |
|
|
|
1545 |
|
|
; |
1546 |
|
|
|
1547 |
|
|
|
1548 |
|
|
;} |
1549 |
|
|
|
1550 |
|
|
; |
1551 |
|
|
if ($child_nt == |
1552 |
|
|
10 and |
1553 |
|
|
|
1554 |
|
|
not defined $newChild-> |
1555 |
|
|
owner_document |
1556 |
|
|
) { |
1557 |
|
|
my $bag = |
1558 |
|
|
$self->{'b'} |
1559 |
|
|
; |
1560 |
|
|
|
1561 |
|
|
|
1562 |
|
|
{ |
1563 |
|
|
|
1564 |
|
|
CORE::delete |
1565 |
|
|
$bag->{${$bag->{${$newChild->{ |
1566 |
|
|
'id' |
1567 |
|
|
}}} |
1568 |
|
|
->{'impl'} or \''}} |
1569 |
|
|
->{'lpmi'}; |
1570 |
wakaba |
1.2 |
$bag->{ |
1571 |
wakaba |
1.1 |
'm' |
1572 |
wakaba |
1.2 |
} |
1573 |
|
|
->{${$bag->{${$newChild->{ |
1574 |
wakaba |
1.1 |
'id' |
1575 |
wakaba |
1.2 |
}}}->{'impl'}}} |
1576 |
|
|
= |
1577 |
|
|
1 |
1578 |
|
|
; |
1579 |
wakaba |
1.1 |
CORE::delete $bag->{${$newChild->{ |
1580 |
|
|
'id' |
1581 |
|
|
}}} |
1582 |
|
|
->{'impl'}; |
1583 |
|
|
|
1584 |
|
|
|
1585 |
|
|
;} |
1586 |
|
|
|
1587 |
|
|
; |
1588 |
|
|
|
1589 |
|
|
|
1590 |
|
|
{ |
1591 |
|
|
|
1592 |
|
|
|
1593 |
|
|
$bag->{${$newChild->{ |
1594 |
|
|
'id' |
1595 |
|
|
}}}->{'od'} |
1596 |
|
|
= $self->{ |
1597 |
|
|
'id' |
1598 |
|
|
}; |
1599 |
|
|
$bag->{${$self->{ |
1600 |
|
|
'id' |
1601 |
|
|
}}} |
1602 |
|
|
->{'do'}->{${$newChild->{ |
1603 |
|
|
'id' |
1604 |
|
|
}}} |
1605 |
|
|
= $newChild->{ |
1606 |
|
|
'id' |
1607 |
|
|
}; |
1608 |
|
|
|
1609 |
|
|
|
1610 |
|
|
;} |
1611 |
|
|
|
1612 |
|
|
; |
1613 |
|
|
} |
1614 |
|
|
|
1615 |
|
|
|
1616 |
|
|
;} |
1617 |
|
|
$r} |
1618 |
|
|
sub replace_child ($$$) { |
1619 |
|
|
my ($self, $newChild, $oldChild) = @_; |
1620 |
|
|
my $r; |
1621 |
|
|
|
1622 |
|
|
{ |
1623 |
|
|
|
1624 |
|
|
my |
1625 |
|
|
$strictc = $self-> |
1626 |
|
|
dom_config |
1627 |
|
|
|
1628 |
|
|
-> |
1629 |
|
|
get_parameter |
1630 |
|
|
|
1631 |
|
|
( |
1632 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
1633 |
|
|
); |
1634 |
|
|
my $child_od = $newChild-> |
1635 |
|
|
owner_document |
1636 |
|
|
|| $self; |
1637 |
|
|
my $child_nt = $newChild-> |
1638 |
|
|
node_type |
1639 |
|
|
; |
1640 |
|
|
if ($strictc and $self-> |
1641 |
|
|
strict_error_checking |
1642 |
|
|
) { |
1643 |
|
|
|
1644 |
|
|
|
1645 |
|
|
{ |
1646 |
|
|
|
1647 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1648 |
|
|
|
1649 |
|
|
{ |
1650 |
|
|
|
1651 |
|
|
|
1652 |
|
|
my |
1653 |
|
|
$has_el; |
1654 |
|
|
my $has_dt; |
1655 |
|
|
if ($child_nt == |
1656 |
|
|
1 |
1657 |
|
|
) { |
1658 |
|
|
$has_el = |
1659 |
|
|
1 |
1660 |
|
|
; |
1661 |
|
|
} elsif ($child_nt == |
1662 |
|
|
10 |
1663 |
|
|
) { |
1664 |
|
|
$has_dt = |
1665 |
|
|
1 |
1666 |
|
|
; |
1667 |
|
|
} elsif ($child_nt == |
1668 |
|
|
11 |
1669 |
|
|
) { |
1670 |
|
|
for my $cn (@{$newChild-> |
1671 |
|
|
child_nodes |
1672 |
|
|
}) { |
1673 |
|
|
my $cnt = $cn-> |
1674 |
|
|
node_type |
1675 |
|
|
; |
1676 |
|
|
if ($cnt == |
1677 |
|
|
1 |
1678 |
|
|
) { |
1679 |
|
|
if ($has_el) { |
1680 |
|
|
|
1681 |
|
|
|
1682 |
|
|
{ |
1683 |
|
|
|
1684 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1685 |
|
|
|
1686 |
|
|
{ |
1687 |
|
|
|
1688 |
|
|
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; |
1689 |
|
|
|
1690 |
|
|
|
1691 |
|
|
;} |
1692 |
|
|
|
1693 |
|
|
|
1694 |
|
|
;} |
1695 |
|
|
|
1696 |
|
|
; |
1697 |
|
|
} |
1698 |
|
|
$has_el = |
1699 |
|
|
1 |
1700 |
|
|
; |
1701 |
|
|
} |
1702 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
1703 |
|
|
} |
1704 |
|
|
} |
1705 |
|
|
|
1706 |
|
|
if ($has_el) { |
1707 |
|
|
my $anode = $oldChild-> |
1708 |
|
|
previous_sibling |
1709 |
|
|
; |
1710 |
|
|
while (defined $anode) { |
1711 |
|
|
if ($anode-> |
1712 |
|
|
node_type |
1713 |
|
|
== |
1714 |
|
|
1 |
1715 |
|
|
) { |
1716 |
|
|
|
1717 |
|
|
|
1718 |
|
|
{ |
1719 |
|
|
|
1720 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1721 |
|
|
|
1722 |
|
|
{ |
1723 |
|
|
|
1724 |
|
|
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; |
1725 |
|
|
|
1726 |
|
|
|
1727 |
|
|
;} |
1728 |
|
|
|
1729 |
|
|
|
1730 |
|
|
;} |
1731 |
|
|
|
1732 |
|
|
; |
1733 |
|
|
} |
1734 |
|
|
$anode = $anode-> |
1735 |
|
|
previous_sibling |
1736 |
|
|
; |
1737 |
|
|
} |
1738 |
|
|
$anode = $oldChild-> |
1739 |
|
|
next_sibling |
1740 |
|
|
; |
1741 |
|
|
while (defined $anode) { |
1742 |
|
|
my $ant = $anode-> |
1743 |
|
|
node_type |
1744 |
|
|
; |
1745 |
|
|
if ($ant == |
1746 |
|
|
1 |
1747 |
|
|
) { |
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_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; |
1757 |
|
|
|
1758 |
|
|
|
1759 |
|
|
;} |
1760 |
|
|
|
1761 |
|
|
|
1762 |
|
|
;} |
1763 |
|
|
|
1764 |
|
|
; |
1765 |
|
|
} elsif ($ant == |
1766 |
|
|
10 |
1767 |
|
|
) { |
1768 |
|
|
|
1769 |
|
|
|
1770 |
|
|
{ |
1771 |
|
|
|
1772 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1773 |
|
|
|
1774 |
|
|
{ |
1775 |
|
|
|
1776 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => '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; |
1777 |
|
|
|
1778 |
|
|
|
1779 |
|
|
;} |
1780 |
|
|
|
1781 |
|
|
|
1782 |
|
|
;} |
1783 |
|
|
|
1784 |
|
|
; |
1785 |
|
|
} |
1786 |
|
|
$anode = $anode-> |
1787 |
|
|
next_sibling |
1788 |
|
|
; |
1789 |
|
|
} |
1790 |
|
|
} # has_el |
1791 |
|
|
if ($has_dt) { |
1792 |
|
|
my $anode = $oldChild-> |
1793 |
|
|
previous_sibling |
1794 |
|
|
; |
1795 |
|
|
while (defined $anode) { |
1796 |
|
|
my $ant = $anode-> |
1797 |
|
|
node_type |
1798 |
|
|
; |
1799 |
|
|
if ($ant == |
1800 |
|
|
1 |
1801 |
|
|
) { |
1802 |
|
|
|
1803 |
|
|
|
1804 |
|
|
{ |
1805 |
|
|
|
1806 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1807 |
|
|
|
1808 |
|
|
{ |
1809 |
|
|
|
1810 |
|
|
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; |
1811 |
|
|
|
1812 |
|
|
|
1813 |
|
|
;} |
1814 |
|
|
|
1815 |
|
|
|
1816 |
|
|
;} |
1817 |
|
|
|
1818 |
|
|
; |
1819 |
|
|
} elsif ($ant == |
1820 |
|
|
10 |
1821 |
|
|
) { |
1822 |
|
|
|
1823 |
|
|
|
1824 |
|
|
{ |
1825 |
|
|
|
1826 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1827 |
|
|
|
1828 |
|
|
{ |
1829 |
|
|
|
1830 |
|
|
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; |
1831 |
|
|
|
1832 |
|
|
|
1833 |
|
|
;} |
1834 |
|
|
|
1835 |
|
|
|
1836 |
|
|
;} |
1837 |
|
|
|
1838 |
|
|
; |
1839 |
|
|
} |
1840 |
|
|
$anode = $anode-> |
1841 |
|
|
previous_sibling |
1842 |
|
|
; |
1843 |
|
|
} |
1844 |
|
|
$anode = $oldChild-> |
1845 |
|
|
next_sibling |
1846 |
|
|
; |
1847 |
|
|
while (defined $anode) { |
1848 |
|
|
if ($anode-> |
1849 |
|
|
node_type |
1850 |
|
|
|
1851 |
|
|
== |
1852 |
|
|
10 |
1853 |
|
|
) { |
1854 |
|
|
|
1855 |
|
|
|
1856 |
|
|
{ |
1857 |
|
|
|
1858 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1859 |
|
|
|
1860 |
|
|
{ |
1861 |
|
|
|
1862 |
|
|
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; |
1863 |
|
|
|
1864 |
|
|
|
1865 |
|
|
;} |
1866 |
|
|
|
1867 |
|
|
|
1868 |
|
|
;} |
1869 |
|
|
|
1870 |
|
|
; |
1871 |
|
|
} |
1872 |
|
|
$anode = $anode-> |
1873 |
|
|
next_sibling |
1874 |
|
|
; |
1875 |
|
|
} |
1876 |
|
|
} # has_dt |
1877 |
|
|
|
1878 |
|
|
|
1879 |
|
|
|
1880 |
|
|
;} |
1881 |
|
|
|
1882 |
|
|
|
1883 |
|
|
;} |
1884 |
|
|
|
1885 |
|
|
; |
1886 |
|
|
} |
1887 |
|
|
|
1888 |
|
|
|
1889 |
|
|
{ |
1890 |
|
|
|
1891 |
|
|
|
1892 |
|
|
{ |
1893 |
|
|
|
1894 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1895 |
|
|
|
1896 |
|
|
{ |
1897 |
|
|
|
1898 |
|
|
|
1899 |
|
|
my |
1900 |
|
|
$strict = $self-> |
1901 |
|
|
strict_error_checking |
1902 |
|
|
; |
1903 |
|
|
|
1904 |
|
|
## -- Node Type check |
1905 |
|
|
my @new_child; |
1906 |
|
|
if ({ |
1907 |
|
|
3 => (not $strictc), |
1908 |
|
|
5 => (not $strictc), |
1909 |
|
|
1 => 1, |
1910 |
|
|
4 => (not $strictc), |
1911 |
|
|
7 => 1, |
1912 |
|
|
8 => 1, |
1913 |
|
|
10 => 1, |
1914 |
|
|
}->{$child_nt}) { |
1915 |
|
|
push @new_child, $newChild; |
1916 |
|
|
} elsif ($child_nt == |
1917 |
|
|
11 |
1918 |
|
|
) { |
1919 |
|
|
for my $cn (@{$newChild-> |
1920 |
|
|
child_nodes |
1921 |
|
|
}) { |
1922 |
|
|
unless ({ |
1923 |
|
|
3 => (not $strictc), |
1924 |
|
|
5 => (not $strictc), |
1925 |
|
|
1 => 1, |
1926 |
|
|
4 => (not $strictc), |
1927 |
|
|
7 => 1, |
1928 |
|
|
8 => 1, |
1929 |
|
|
10 => 1, |
1930 |
|
|
}->{$cn-> |
1931 |
|
|
node_type |
1932 |
|
|
}) { |
1933 |
|
|
|
1934 |
|
|
|
1935 |
|
|
{ |
1936 |
|
|
|
1937 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1938 |
|
|
|
1939 |
|
|
{ |
1940 |
|
|
|
1941 |
|
|
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; |
1942 |
|
|
|
1943 |
|
|
|
1944 |
|
|
;} |
1945 |
|
|
|
1946 |
|
|
|
1947 |
|
|
;} |
1948 |
|
|
|
1949 |
|
|
; |
1950 |
|
|
} |
1951 |
|
|
push @new_child, $cn; |
1952 |
|
|
} |
1953 |
|
|
} else { |
1954 |
|
|
|
1955 |
|
|
|
1956 |
|
|
{ |
1957 |
|
|
|
1958 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1959 |
|
|
|
1960 |
|
|
{ |
1961 |
|
|
|
1962 |
|
|
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; |
1963 |
|
|
|
1964 |
|
|
|
1965 |
|
|
;} |
1966 |
|
|
|
1967 |
|
|
|
1968 |
|
|
;} |
1969 |
|
|
|
1970 |
|
|
; |
1971 |
|
|
} |
1972 |
|
|
|
1973 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
1974 |
|
|
parent_node |
1975 |
|
|
: |
1976 |
|
|
|
1977 |
|
|
undef |
1978 |
|
|
; |
1979 |
|
|
if ($strict) { |
1980 |
|
|
## -- Wrong-document check |
1981 |
|
|
unless ($self eq $child_od) { |
1982 |
|
|
|
1983 |
|
|
|
1984 |
|
|
{ |
1985 |
|
|
|
1986 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1987 |
|
|
|
1988 |
|
|
{ |
1989 |
|
|
|
1990 |
|
|
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; |
1991 |
|
|
|
1992 |
|
|
|
1993 |
|
|
;} |
1994 |
|
|
|
1995 |
|
|
|
1996 |
|
|
;} |
1997 |
|
|
|
1998 |
|
|
; |
1999 |
|
|
} |
2000 |
|
|
|
2001 |
|
|
## -- Read-onlyness check |
2002 |
|
|
if ($self-> |
2003 |
|
|
manakai_read_only |
2004 |
|
|
) { |
2005 |
|
|
|
2006 |
|
|
|
2007 |
|
|
{ |
2008 |
|
|
|
2009 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2010 |
|
|
|
2011 |
|
|
{ |
2012 |
|
|
|
2013 |
|
|
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'; |
2014 |
|
|
|
2015 |
|
|
|
2016 |
|
|
;} |
2017 |
|
|
|
2018 |
|
|
|
2019 |
|
|
;} |
2020 |
|
|
|
2021 |
|
|
; |
2022 |
|
|
} |
2023 |
|
|
if (@new_child) { |
2024 |
|
|
if ($nc_parent and |
2025 |
|
|
$nc_parent-> |
2026 |
|
|
manakai_read_only |
2027 |
|
|
) { |
2028 |
|
|
|
2029 |
|
|
|
2030 |
|
|
{ |
2031 |
|
|
|
2032 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2033 |
|
|
|
2034 |
|
|
{ |
2035 |
|
|
|
2036 |
|
|
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'; |
2037 |
|
|
|
2038 |
|
|
|
2039 |
|
|
;} |
2040 |
|
|
|
2041 |
|
|
|
2042 |
|
|
;} |
2043 |
|
|
|
2044 |
|
|
; |
2045 |
|
|
} |
2046 |
|
|
} |
2047 |
|
|
} |
2048 |
|
|
|
2049 |
|
|
## -- Insert at... |
2050 |
|
|
my $index = -1; # last |
2051 |
|
|
|
2052 |
|
|
|
2053 |
|
|
{ |
2054 |
|
|
|
2055 |
|
|
|
2056 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
2057 |
|
|
if (defined $oldChild) { |
2058 |
|
|
if ($oldChild eq $newChild) { |
2059 |
|
|
|
2060 |
|
|
|
2061 |
|
|
; |
2062 |
|
|
|
2063 |
|
|
|
2064 |
|
|
{ |
2065 |
|
|
|
2066 |
|
|
|
2067 |
|
|
{ |
2068 |
|
|
|
2069 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2070 |
|
|
|
2071 |
|
|
{ |
2072 |
|
|
|
2073 |
|
|
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'; |
2074 |
|
|
|
2075 |
|
|
|
2076 |
|
|
;} |
2077 |
|
|
|
2078 |
|
|
|
2079 |
|
|
;} |
2080 |
|
|
|
2081 |
|
|
; |
2082 |
|
|
|
2083 |
|
|
|
2084 |
|
|
|
2085 |
|
|
;} |
2086 |
|
|
|
2087 |
|
|
; |
2088 |
|
|
} |
2089 |
|
|
|
2090 |
|
|
my $cns = $self-> |
2091 |
|
|
child_nodes |
2092 |
|
|
; |
2093 |
|
|
my $cnsl = @$cns; |
2094 |
|
|
C: { |
2095 |
|
|
$index = 0; |
2096 |
|
|
for my $i (0..($cnsl-1)) { |
2097 |
|
|
my $cn = $cns->[$i]; |
2098 |
|
|
if ($cn eq $oldChild) { |
2099 |
|
|
$index += $i; |
2100 |
|
|
last C; |
2101 |
|
|
} elsif ($cn eq $newChild) { |
2102 |
|
|
$index = -1; # offset |
2103 |
|
|
} |
2104 |
|
|
} |
2105 |
|
|
|
2106 |
|
|
|
2107 |
|
|
; |
2108 |
|
|
|
2109 |
|
|
|
2110 |
|
|
{ |
2111 |
|
|
|
2112 |
|
|
|
2113 |
|
|
{ |
2114 |
|
|
|
2115 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2116 |
|
|
|
2117 |
|
|
{ |
2118 |
|
|
|
2119 |
|
|
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; |
2120 |
|
|
|
2121 |
|
|
|
2122 |
|
|
;} |
2123 |
|
|
|
2124 |
|
|
|
2125 |
|
|
;} |
2126 |
|
|
|
2127 |
|
|
; |
2128 |
|
|
|
2129 |
|
|
|
2130 |
|
|
|
2131 |
|
|
;} |
2132 |
|
|
|
2133 |
|
|
; |
2134 |
|
|
} # C |
2135 |
|
|
} else { # |oldChild| is not defined |
2136 |
|
|
|
2137 |
|
|
|
2138 |
|
|
{ |
2139 |
|
|
|
2140 |
|
|
|
2141 |
|
|
{ |
2142 |
|
|
|
2143 |
|
|
local $Error::Depth = $Error::Depth - 1; |
2144 |
|
|
|
2145 |
|
|
{ |
2146 |
|
|
|
2147 |
|
|
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; |
2148 |
|
|
|
2149 |
|
|
|
2150 |
|
|
;} |
2151 |
|
|
|
2152 |
|
|
|
2153 |
|
|
;} |
2154 |
|
|
|
2155 |
|
|
; |
2156 |
|
|
|
2157 |
|
|
|
2158 |
|
|
|
2159 |
|
|
;} |
2160 |
|
|
|
2161 |
|
|
; |
2162 |
|
|
} |
2163 |
|
|
|
2164 |
|
|
|
2165 |
|
|
|
2166 |
|
|
;} |
2167 |
|
|
|
2168 |
|
|
; # FOR !tc:ForAppendChild |
2169 |
|
|
|
2170 |
|
|
## -- Removes from parent |
2171 |
|
|
if ($nc_parent) { |
2172 |
|
|
if ($child_nt == |
2173 |
|
|
11 |
2174 |
|
|
) { |
2175 |
|
|
|
2176 |
|
|
|
2177 |
|
|
{ |
2178 |
|
|
|
2179 |
|
|
|
2180 |
|
|
$newChild->{ |
2181 |
|
|
'b' |
2182 |
|
|
}->{${$newChild->{ |
2183 |
|
|
'id' |
2184 |
|
|
}}} |
2185 |
|
|
->{'child'} = []; |
2186 |
|
|
|
2187 |
|
|
|
2188 |
|
|
;} |
2189 |
|
|
|
2190 |
|
|
; |
2191 |
|
|
} else { |
2192 |
|
|
my $v; |
2193 |
|
|
|
2194 |
|
|
|
2195 |
|
|
{ |
2196 |
|
|
|
2197 |
|
|
|
2198 |
|
|
$v = $nc_parent->{ |
2199 |
|
|
'b' |
2200 |
|
|
}->{${$nc_parent->{ |
2201 |
|
|
'id' |
2202 |
|
|
}}} |
2203 |
|
|
->{'child'}; |
2204 |
|
|
|
2205 |
|
|
|
2206 |
|
|
;} |
2207 |
|
|
|
2208 |
|
|
; |
2209 |
|
|
RP: for my $i (0..$#$v) { |
2210 |
|
|
my $nodeid = $v->[$i]; |
2211 |
|
|
if ( |
2212 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
2213 |
|
|
) { |
2214 |
|
|
splice @$v, $i, 1, (); |
2215 |
|
|
last RP; |
2216 |
|
|
} |
2217 |
|
|
} # RP |
2218 |
|
|
} |
2219 |
|
|
} |
2220 |
|
|
|
2221 |
|
|
## -- Rewrite the |parentNode| properties |
2222 |
|
|
for my $nc (@new_child) { |
2223 |
|
|
|
2224 |
|
|
|
2225 |
|
|
{ |
2226 |
|
|
|
2227 |
|
|
|
2228 |
|
|
$nc->{ |
2229 |
|
|
'b' |
2230 |
|
|
}->{${$nc->{ |
2231 |
|
|
'id' |
2232 |
|
|
}}} |
2233 |
|
|
->{'parent'} = $self->{ |
2234 |
|
|
'id' |
2235 |
|
|
}; |
2236 |
|
|
|
2237 |
|
|
|
2238 |
|
|
;} |
2239 |
|
|
|
2240 |
|
|
; |
2241 |
|
|
} |
2242 |
|
|
|
2243 |
|
|
my $children; |
2244 |
|
|
|
2245 |
|
|
|
2246 |
|
|
{ |
2247 |
|
|
|
2248 |
|
|
|
2249 |
|
|
$children = $self->{ |
2250 |
|
|
'b' |
2251 |
|
|
}->{${$self->{ |
2252 |
|
|
'id' |
2253 |
|
|
}}} |
2254 |
|
|
->{'child'}; |
2255 |
|
|
|
2256 |
|
|
|
2257 |
|
|
;} |
2258 |
|
|
|
2259 |
|
|
; |
2260 |
|
|
|
2261 |
|
|
|
2262 |
|
|
|
2263 |
|
|
; |
2264 |
|
|
|
2265 |
|
|
|
2266 |
|
|
|
2267 |
|
|
; |
2268 |
|
|
|
2269 |
|
|
|
2270 |
|
|
|
2271 |
|
|
{ |
2272 |
|
|
|
2273 |
|
|
|
2274 |
|
|
## -- Replaces the node |
2275 |
|
|
splice @$children, $index, 1, map { |
2276 |
|
|
|
2277 |
|
|
$_->{'id'} |
2278 |
|
|
|
2279 |
|
|
} @new_child; |
2280 |
|
|
|
2281 |
|
|
|
2282 |
|
|
{ |
2283 |
|
|
|
2284 |
|
|
CORE::delete |
2285 |
|
|
$oldChild->{ |
2286 |
|
|
'b' |
2287 |
|
|
}->{${$oldChild->{ |
2288 |
|
|
'id' |
2289 |
|
|
}}} |
2290 |
|
|
->{'parent'}; |
2291 |
|
|
|
2292 |
|
|
|
2293 |
|
|
;} |
2294 |
|
|
|
2295 |
|
|
; |
2296 |
|
|
$r = $oldChild; |
2297 |
|
|
|
2298 |
|
|
|
2299 |
|
|
|
2300 |
|
|
;} |
2301 |
|
|
|
2302 |
|
|
; |
2303 |
|
|
|
2304 |
|
|
|
2305 |
|
|
|
2306 |
|
|
;} |
2307 |
|
|
|
2308 |
|
|
|
2309 |
|
|
;} |
2310 |
|
|
|
2311 |
|
|
; |
2312 |
|
|
|
2313 |
|
|
|
2314 |
|
|
;} |
2315 |
|
|
|
2316 |
|
|
; |
2317 |
|
|
if ($child_nt == |
2318 |
|
|
10 and |
2319 |
|
|
|
2320 |
|
|
not defined $newChild-> |
2321 |
|
|
owner_document |
2322 |
|
|
) { |
2323 |
|
|
my $bag = |
2324 |
|
|
$self->{'b'} |
2325 |
|
|
; |
2326 |
|
|
|
2327 |
|
|
|
2328 |
|
|
{ |
2329 |
|
|
|
2330 |
|
|
CORE::delete |
2331 |
|
|
$bag->{${$bag->{${$newChild->{ |
2332 |
|
|
'id' |
2333 |
|
|
}}} |
2334 |
|
|
->{'impl'} or \''}} |
2335 |
|
|
->{'lpmi'}; |
2336 |
wakaba |
1.2 |
$bag->{ |
2337 |
wakaba |
1.1 |
'm' |
2338 |
wakaba |
1.2 |
} |
2339 |
|
|
->{${$bag->{${$newChild->{ |
2340 |
wakaba |
1.1 |
'id' |
2341 |
wakaba |
1.2 |
}}}->{'impl'}}} |
2342 |
|
|
= |
2343 |
|
|
1 |
2344 |
|
|
; |
2345 |
wakaba |
1.1 |
CORE::delete $bag->{${$newChild->{ |
2346 |
|
|
'id' |
2347 |
|
|
}}} |
2348 |
|
|
->{'impl'}; |
2349 |
|
|
|
2350 |
|
|
|
2351 |
|
|
;} |
2352 |
|
|
|
2353 |
|
|
; |
2354 |
|
|
|
2355 |
|
|
|
2356 |
|
|
{ |
2357 |
|
|
|
2358 |
|
|
|
2359 |
|
|
$bag->{${$newChild->{ |
2360 |
|
|
'id' |
2361 |
|
|
}}}->{'od'} |
2362 |
|
|
= $self->{ |
2363 |
|
|
'id' |
2364 |
|
|
}; |
2365 |
|
|
$bag->{${$self->{ |
2366 |
|
|
'id' |
2367 |
|
|
}}} |
2368 |
|
|
->{'do'}->{${$newChild->{ |
2369 |
|
|
'id' |
2370 |
|
|
}}} |
2371 |
|
|
= $newChild->{ |
2372 |
|
|
'id' |
2373 |
|
|
}; |
2374 |
|
|
|
2375 |
|
|
|
2376 |
|
|
;} |
2377 |
|
|
|
2378 |
|
|
; |
2379 |
|
|
} |
2380 |
|
|
|
2381 |
|
|
|
2382 |
|
|
;} |
2383 |
|
|
$r} |
2384 |
|
|
sub manakai_append_text ($$) { |
2385 |
|
|
my ($self, $string) = @_; |
2386 |
|
|
my $r; |
2387 |
|
|
|
2388 |
|
|
{ |
2389 |
|
|
|
2390 |
|
|
|
2391 |
|
|
{ |
2392 |
|
|
|
2393 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2394 |
|
|
|
2395 |
|
|
{ |
2396 |
|
|
|
2397 |
|
|
|
2398 |
|
|
unless |
2399 |
|
|
($self-> |
2400 |
|
|
dom_config |
2401 |
|
|
|
2402 |
|
|
-> |
2403 |
|
|
get_parameter |
2404 |
|
|
|
2405 |
|
|
( |
2406 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
2407 |
|
|
)) { |
2408 |
|
|
my $lc = $self-> |
2409 |
|
|
last_child |
2410 |
|
|
; |
2411 |
|
|
if (defined $lc and |
2412 |
|
|
$lc-> |
2413 |
|
|
node_type |
2414 |
|
|
== |
2415 |
|
|
3 |
2416 |
|
|
) { |
2417 |
|
|
$lc-> |
2418 |
|
|
manakai_append_text |
2419 |
|
|
|
2420 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
2421 |
|
|
} else { |
2422 |
|
|
my $text = $self-> |
2423 |
|
|
create_text_node |
2424 |
|
|
|
2425 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
2426 |
|
|
$self-> |
2427 |
|
|
append_child |
2428 |
|
|
($text); |
2429 |
|
|
} |
2430 |
|
|
} |
2431 |
|
|
$r = $self; |
2432 |
|
|
|
2433 |
|
|
|
2434 |
|
|
|
2435 |
|
|
;} |
2436 |
|
|
|
2437 |
|
|
|
2438 |
|
|
;} |
2439 |
|
|
|
2440 |
|
|
; |
2441 |
|
|
|
2442 |
|
|
|
2443 |
|
|
;} |
2444 |
|
|
$r} |
2445 |
|
|
sub remove_child ($$) { |
2446 |
|
|
my ($self, $oldChild) = @_; |
2447 |
|
|
my $r; |
2448 |
|
|
|
2449 |
|
|
{ |
2450 |
|
|
|
2451 |
|
|
if |
2452 |
|
|
($self-> |
2453 |
|
|
strict_error_checking and |
2454 |
|
|
|
2455 |
|
|
$self-> |
2456 |
|
|
manakai_read_only |
2457 |
|
|
) { |
2458 |
|
|
|
2459 |
|
|
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'; |
2460 |
|
|
|
2461 |
|
|
; |
2462 |
|
|
} |
2463 |
|
|
|
2464 |
|
|
|
2465 |
|
|
{ |
2466 |
|
|
|
2467 |
|
|
F: |
2468 |
|
|
{ |
2469 |
|
|
my $i = -1; |
2470 |
|
|
for my $cld (@{$self-> |
2471 |
|
|
child_nodes |
2472 |
|
|
}) { |
2473 |
|
|
$i++; |
2474 |
|
|
if ($cld eq $oldChild) { |
2475 |
|
|
my $v; |
2476 |
|
|
|
2477 |
|
|
|
2478 |
|
|
{ |
2479 |
|
|
|
2480 |
|
|
|
2481 |
|
|
$v = $self->{ |
2482 |
|
|
'b' |
2483 |
|
|
}->{${$self->{ |
2484 |
|
|
'id' |
2485 |
|
|
}}} |
2486 |
|
|
->{'child'}; |
2487 |
|
|
|
2488 |
|
|
|
2489 |
|
|
;} |
2490 |
|
|
|
2491 |
|
|
; |
2492 |
|
|
splice @$v, $i, 1, (); |
2493 |
|
|
|
2494 |
|
|
|
2495 |
|
|
{ |
2496 |
|
|
|
2497 |
|
|
CORE::delete |
2498 |
|
|
$oldChild->{ |
2499 |
|
|
'b' |
2500 |
|
|
}->{${$oldChild->{ |
2501 |
|
|
'id' |
2502 |
|
|
}}} |
2503 |
|
|
->{'parent'}; |
2504 |
|
|
|
2505 |
|
|
|
2506 |
|
|
;} |
2507 |
|
|
|
2508 |
|
|
; |
2509 |
|
|
$r = $oldChild; |
2510 |
|
|
last F; |
2511 |
|
|
} |
2512 |
|
|
} |
2513 |
|
|
|
2514 |
|
|
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; |
2515 |
|
|
|
2516 |
|
|
; |
2517 |
|
|
} # F |
2518 |
|
|
|
2519 |
|
|
|
2520 |
|
|
;} |
2521 |
|
|
|
2522 |
|
|
; |
2523 |
|
|
|
2524 |
|
|
|
2525 |
|
|
;} |
2526 |
|
|
$r} |
2527 |
|
|
sub node_name ($;$) { |
2528 |
|
|
if (@_ == 1) {my ($self) = @_; |
2529 |
|
|
my $r = ''; |
2530 |
|
|
$r = '#document'; |
2531 |
|
|
$r; |
2532 |
|
|
} else {my ($self) = @_; |
2533 |
|
|
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'; |
2534 |
|
|
} |
2535 |
|
|
} |
2536 |
|
|
sub text_content ($;$) { |
2537 |
|
|
if (@_ == 1) {my ($self) = @_; |
2538 |
|
|
my $r = ''; |
2539 |
|
|
|
2540 |
|
|
{ |
2541 |
|
|
|
2542 |
|
|
|
2543 |
|
|
{ |
2544 |
|
|
|
2545 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2546 |
|
|
|
2547 |
|
|
{ |
2548 |
|
|
|
2549 |
|
|
|
2550 |
|
|
if |
2551 |
|
|
($self-> |
2552 |
|
|
dom_config |
2553 |
|
|
|
2554 |
|
|
-> |
2555 |
|
|
get_parameter |
2556 |
|
|
|
2557 |
|
|
( |
2558 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
2559 |
|
|
)) { |
2560 |
|
|
$r = |
2561 |
|
|
undef |
2562 |
|
|
; |
2563 |
|
|
} else { |
2564 |
|
|
$r = ''; |
2565 |
|
|
my @target = @{$self-> |
2566 |
|
|
child_nodes |
2567 |
|
|
}; |
2568 |
|
|
C: for my $node (@target) { |
2569 |
|
|
my $nt = $node-> |
2570 |
|
|
node_type |
2571 |
|
|
; |
2572 |
|
|
if ($nt == |
2573 |
|
|
3 or |
2574 |
|
|
|
2575 |
|
|
$nt == |
2576 |
|
|
4 |
2577 |
|
|
) { |
2578 |
|
|
$r .= $node-> |
2579 |
|
|
data |
2580 |
|
|
unless |
2581 |
|
|
$node-> |
2582 |
|
|
is_element_content_whitespace |
2583 |
|
|
; |
2584 |
|
|
} elsif ($nt == |
2585 |
|
|
1 or |
2586 |
|
|
|
2587 |
|
|
$nt == |
2588 |
|
|
5 |
2589 |
|
|
) { |
2590 |
|
|
unshift @target, @{$node-> |
2591 |
|
|
child_nodes |
2592 |
|
|
}; |
2593 |
|
|
} |
2594 |
|
|
} |
2595 |
|
|
} |
2596 |
|
|
|
2597 |
|
|
|
2598 |
|
|
|
2599 |
|
|
;} |
2600 |
|
|
|
2601 |
|
|
|
2602 |
|
|
;} |
2603 |
|
|
|
2604 |
|
|
; |
2605 |
|
|
|
2606 |
|
|
|
2607 |
|
|
;} |
2608 |
|
|
$r; |
2609 |
|
|
} else {my ($self, $given) = @_; |
2610 |
|
|
|
2611 |
|
|
{ |
2612 |
|
|
|
2613 |
|
|
if |
2614 |
|
|
($self-> |
2615 |
|
|
dom_config |
2616 |
|
|
|
2617 |
|
|
-> |
2618 |
|
|
get_parameter |
2619 |
|
|
|
2620 |
|
|
( |
2621 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
2622 |
|
|
)) { |
2623 |
|
|
|
2624 |
|
|
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'; |
2625 |
|
|
|
2626 |
|
|
; |
2627 |
|
|
} else { |
2628 |
|
|
|
2629 |
|
|
|
2630 |
|
|
{ |
2631 |
|
|
|
2632 |
|
|
|
2633 |
|
|
{ |
2634 |
|
|
|
2635 |
|
|
if |
2636 |
|
|
($self-> |
2637 |
|
|
manakai_read_only |
2638 |
|
|
) { |
2639 |
|
|
|
2640 |
|
|
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'; |
2641 |
|
|
|
2642 |
|
|
; |
2643 |
|
|
} |
2644 |
|
|
|
2645 |
|
|
|
2646 |
|
|
;} |
2647 |
|
|
|
2648 |
|
|
; |
2649 |
|
|
|
2650 |
|
|
my @__old_children = @{$self-> |
2651 |
|
|
child_nodes |
2652 |
|
|
}; |
2653 |
|
|
for my $__old_child (@__old_children) { |
2654 |
|
|
|
2655 |
|
|
|
2656 |
|
|
{ |
2657 |
|
|
|
2658 |
|
|
CORE::delete |
2659 |
|
|
$__old_child->{ |
2660 |
|
|
'b' |
2661 |
|
|
}->{${$__old_child->{ |
2662 |
|
|
'id' |
2663 |
|
|
}}} |
2664 |
|
|
->{'parent'}; |
2665 |
|
|
|
2666 |
|
|
|
2667 |
|
|
;} |
2668 |
|
|
|
2669 |
|
|
; |
2670 |
|
|
} |
2671 |
|
|
|
2672 |
|
|
my @__new_children; |
2673 |
|
|
if (defined $given and length $given) { |
2674 |
|
|
my $__text = $self-> |
2675 |
|
|
create_text_node |
2676 |
|
|
($given); |
2677 |
|
|
push @__new_children, |
2678 |
|
|
$__text->{'id'} |
2679 |
|
|
; |
2680 |
|
|
|
2681 |
|
|
|
2682 |
|
|
{ |
2683 |
|
|
|
2684 |
|
|
|
2685 |
|
|
$__text->{ |
2686 |
|
|
'b' |
2687 |
|
|
}->{${$__text->{ |
2688 |
|
|
'id' |
2689 |
|
|
}}} |
2690 |
|
|
->{'parent'} = $self->{ |
2691 |
|
|
'id' |
2692 |
|
|
}; |
2693 |
|
|
|
2694 |
|
|
|
2695 |
|
|
;} |
2696 |
|
|
|
2697 |
|
|
; |
2698 |
|
|
} |
2699 |
|
|
|
2700 |
|
|
|
2701 |
|
|
|
2702 |
|
|
{ |
2703 |
|
|
|
2704 |
|
|
|
2705 |
|
|
$self->{ |
2706 |
|
|
'b' |
2707 |
|
|
}->{${$self->{ |
2708 |
|
|
'id' |
2709 |
|
|
}}} |
2710 |
|
|
->{'child'} = \@__new_children; |
2711 |
|
|
|
2712 |
|
|
|
2713 |
|
|
;} |
2714 |
|
|
|
2715 |
|
|
; |
2716 |
|
|
|
2717 |
|
|
|
2718 |
|
|
;} |
2719 |
|
|
|
2720 |
|
|
; |
2721 |
|
|
} |
2722 |
|
|
|
2723 |
|
|
|
2724 |
|
|
;} |
2725 |
|
|
} |
2726 |
|
|
} |
2727 |
|
|
sub get_feature ($$$) { |
2728 |
|
|
my ($self, $feature, $version) = @_; |
2729 |
|
|
|
2730 |
|
|
{ |
2731 |
|
|
|
2732 |
|
|
|
2733 |
|
|
$feature = lc $feature; |
2734 |
|
|
|
2735 |
|
|
|
2736 |
|
|
;} |
2737 |
|
|
|
2738 |
|
|
{ |
2739 |
|
|
|
2740 |
|
|
|
2741 |
|
|
$version = '' unless defined $version; |
2742 |
|
|
|
2743 |
|
|
|
2744 |
|
|
;} |
2745 |
|
|
my $r; |
2746 |
|
|
|
2747 |
|
|
{ |
2748 |
|
|
|
2749 |
|
|
|
2750 |
|
|
$feature =~ s/^\+//; |
2751 |
|
|
|
2752 |
|
|
## TODO: Remove this code and implement autoload |
2753 |
|
|
if ($feature eq |
2754 |
|
|
'http://suika.fam.cx/www/2006/feature/xdoctype' |
2755 |
|
|
) { |
2756 |
|
|
require Message::DOM::XDoctype; |
2757 |
|
|
} |
2758 |
|
|
|
2759 |
|
|
|
2760 |
|
|
|
2761 |
|
|
{ |
2762 |
|
|
|
2763 |
|
|
if |
2764 |
|
|
($Message::DOM::DOMFeature::ClassInfo->{ref $self} |
2765 |
|
|
->{has_feature}->{$feature}->{$version}) { |
2766 |
|
|
$r = $self; |
2767 |
|
|
} else { |
2768 |
|
|
CLASS: for my $__class (sort { |
2769 |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
2770 |
|
|
} grep { |
2771 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Document::ManakaiDOMDocument'} |
2772 |
|
|
->{compat_class}->{$_} |
2773 |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Document::ManakaiDOMDocument'} |
2774 |
|
|
->{compat_class} or {}}) { |
2775 |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
2776 |
|
|
->{has_feature}->{$feature}->{$version}) { |
2777 |
|
|
|
2778 |
|
|
|
2779 |
|
|
{ |
2780 |
|
|
|
2781 |
|
|
|
2782 |
|
|
$r = ${($self->{'b'})->{${($self->{'id'})}}->{ |
2783 |
|
|
'cls' |
2784 |
|
|
}}->___create_node_ref ({ |
2785 |
|
|
|
2786 |
|
|
'id' |
2787 |
|
|
=> ($self->{'id'}), |
2788 |
|
|
|
2789 |
|
|
'b' |
2790 |
|
|
=> ($self->{'b'}), |
2791 |
|
|
}, { |
2792 |
|
|
'nrcls' => \$__class, |
2793 |
|
|
}); |
2794 |
|
|
($self->{'b'})->{${($self->{'id'})}}->{ |
2795 |
|
|
'rc' |
2796 |
|
|
}++; |
2797 |
|
|
|
2798 |
|
|
|
2799 |
|
|
;} |
2800 |
|
|
|
2801 |
|
|
; |
2802 |
|
|
last CLASS; |
2803 |
|
|
} |
2804 |
|
|
} # CLASS |
2805 |
|
|
} |
2806 |
|
|
|
2807 |
|
|
|
2808 |
|
|
;} |
2809 |
|
|
|
2810 |
|
|
; |
2811 |
|
|
unless (defined $r) { |
2812 |
|
|
|
2813 |
|
|
|
2814 |
|
|
{ |
2815 |
|
|
|
2816 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2817 |
|
|
|
2818 |
|
|
{ |
2819 |
|
|
|
2820 |
|
|
|
2821 |
|
|
|
2822 |
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
2823 |
|
|
|
2824 |
|
|
|
2825 |
|
|
|
2826 |
|
|
;} |
2827 |
|
|
|
2828 |
|
|
|
2829 |
|
|
;} |
2830 |
|
|
|
2831 |
|
|
; |
2832 |
|
|
} |
2833 |
|
|
|
2834 |
|
|
|
2835 |
|
|
;} |
2836 |
|
|
$r} |
2837 |
|
|
sub base_uri ($;$) { |
2838 |
|
|
if (@_ == 1) {my ($self) = @_; |
2839 |
|
|
my $r = ''; |
2840 |
|
|
|
2841 |
|
|
{ |
2842 |
|
|
|
2843 |
|
|
|
2844 |
|
|
{ |
2845 |
|
|
|
2846 |
|
|
|
2847 |
|
|
$r = $self->{ |
2848 |
|
|
'b' |
2849 |
|
|
}->{${$self->{ |
2850 |
|
|
'id' |
2851 |
|
|
}}} |
2852 |
|
|
->{'buri'}; |
2853 |
|
|
|
2854 |
|
|
|
2855 |
|
|
;} |
2856 |
|
|
|
2857 |
|
|
; |
2858 |
|
|
unless (defined $r) { |
2859 |
|
|
|
2860 |
|
|
|
2861 |
|
|
{ |
2862 |
|
|
|
2863 |
|
|
|
2864 |
|
|
$r = $self->{ |
2865 |
|
|
'b' |
2866 |
|
|
}->{${$self->{ |
2867 |
|
|
'id' |
2868 |
|
|
}}} |
2869 |
|
|
->{'duri'}; |
2870 |
|
|
|
2871 |
|
|
|
2872 |
|
|
;} |
2873 |
|
|
|
2874 |
|
|
; |
2875 |
|
|
} |
2876 |
|
|
|
2877 |
|
|
|
2878 |
|
|
;} |
2879 |
|
|
$r; |
2880 |
|
|
} else {my ($self) = @_; |
2881 |
|
|
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'; |
2882 |
|
|
} |
2883 |
|
|
} |
2884 |
|
|
sub create_element ($$) { |
2885 |
|
|
my ($self, $tagName) = @_; |
2886 |
|
|
my $r; |
2887 |
|
|
|
2888 |
|
|
{ |
2889 |
|
|
|
2890 |
|
|
my |
2891 |
|
|
$strict = $self-> |
2892 |
|
|
strict_error_checking |
2893 |
|
|
; |
2894 |
|
|
if ($strict) { |
2895 |
|
|
my $version = $self-> |
2896 |
|
|
xml_version |
2897 |
|
|
; |
2898 |
|
|
|
2899 |
|
|
|
2900 |
|
|
{ |
2901 |
|
|
|
2902 |
|
|
if |
2903 |
|
|
(defined $tagName) { |
2904 |
|
|
|
2905 |
|
|
|
2906 |
|
|
{ |
2907 |
|
|
|
2908 |
|
|
if |
2909 |
|
|
(((not defined $version or $version eq '1.0') and |
2910 |
|
|
not |
2911 |
|
|
($tagName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
2912 |
|
|
) or |
2913 |
|
|
(defined $version and $version eq '1.1' and |
2914 |
|
|
not |
2915 |
|
|
($tagName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
2916 |
|
|
)) { |
2917 |
|
|
|
2918 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $tagName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
2919 |
|
|
|
2920 |
|
|
; |
2921 |
|
|
} |
2922 |
|
|
|
2923 |
|
|
|
2924 |
|
|
|
2925 |
|
|
;} |
2926 |
|
|
|
2927 |
|
|
; |
2928 |
|
|
|
2929 |
|
|
|
2930 |
|
|
; |
2931 |
|
|
} |
2932 |
|
|
|
2933 |
|
|
|
2934 |
|
|
;} |
2935 |
|
|
|
2936 |
|
|
; |
2937 |
|
|
} |
2938 |
|
|
|
2939 |
|
|
|
2940 |
|
|
{ |
2941 |
|
|
|
2942 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2943 |
|
|
|
2944 |
|
|
{ |
2945 |
|
|
|
2946 |
|
|
|
2947 |
|
|
|
2948 |
|
|
$self-> |
2949 |
|
|
strict_error_checking |
2950 |
|
|
( |
2951 |
|
|
0 |
2952 |
|
|
); |
2953 |
|
|
$r = $self-> |
2954 |
|
|
create_element_ns |
2955 |
|
|
( |
2956 |
|
|
undef |
2957 |
|
|
, [ |
2958 |
|
|
undef |
2959 |
|
|
, $tagName]); |
2960 |
|
|
$self-> |
2961 |
|
|
strict_error_checking |
2962 |
|
|
($strict); |
2963 |
|
|
|
2964 |
|
|
|
2965 |
|
|
|
2966 |
|
|
;} |
2967 |
|
|
|
2968 |
|
|
|
2969 |
|
|
;} |
2970 |
|
|
|
2971 |
|
|
; |
2972 |
|
|
|
2973 |
|
|
|
2974 |
|
|
;} |
2975 |
|
|
$r} |
2976 |
|
|
sub create_element_ns ($$$) { |
2977 |
|
|
my ($self, $namespaceURI, $qualifiedName) = @_; |
2978 |
|
|
|
2979 |
|
|
{ |
2980 |
|
|
|
2981 |
|
|
if |
2982 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
2983 |
|
|
|
2984 |
|
|
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:1143811080:18264:zbjED29418+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
2985 |
|
|
|
2986 |
|
|
; |
2987 |
|
|
|
2988 |
|
|
|
2989 |
|
|
|
2990 |
|
|
{ |
2991 |
|
|
|
2992 |
|
|
|
2993 |
|
|
$namespaceURI = undef; |
2994 |
|
|
|
2995 |
|
|
|
2996 |
|
|
|
2997 |
|
|
;} |
2998 |
|
|
|
2999 |
|
|
; |
3000 |
|
|
} |
3001 |
|
|
|
3002 |
|
|
|
3003 |
|
|
;} |
3004 |
|
|
my $r; |
3005 |
|
|
|
3006 |
|
|
{ |
3007 |
|
|
|
3008 |
|
|
require |
3009 |
|
|
Message::DOM::Element; |
3010 |
|
|
|
3011 |
|
|
my ($prefix, $lname) = ref $qualifiedName eq 'ARRAY' |
3012 |
|
|
? @$qualifiedName |
3013 |
|
|
: split /:/, $qualifiedName, 2; |
3014 |
|
|
($prefix, $lname) = ( |
3015 |
|
|
undef |
3016 |
|
|
, $prefix) unless defined $lname; |
3017 |
|
|
$qualifiedName = defined $prefix ? $prefix.':'.$lname : $lname; |
3018 |
|
|
|
3019 |
|
|
if ($self-> |
3020 |
|
|
strict_error_checking |
3021 |
|
|
) { |
3022 |
|
|
my $version = $self-> |
3023 |
|
|
xml_version |
3024 |
|
|
; |
3025 |
|
|
|
3026 |
|
|
|
3027 |
|
|
{ |
3028 |
|
|
|
3029 |
|
|
if |
3030 |
|
|
(defined $version and $version eq '1.1') { |
3031 |
|
|
unless ( |
3032 |
|
|
($qualifiedName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
3033 |
|
|
) { |
3034 |
|
|
|
3035 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
3036 |
|
|
|
3037 |
|
|
; |
3038 |
|
|
} |
3039 |
|
|
unless ( |
3040 |
|
|
($qualifiedName =~ /\A\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*(?::\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*)?\z/) |
3041 |
|
|
) { |
3042 |
|
|
|
3043 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
3044 |
|
|
|
3045 |
|
|
; |
3046 |
|
|
} |
3047 |
|
|
} else { |
3048 |
|
|
unless ( |
3049 |
|
|
($qualifiedName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
3050 |
|
|
) { |
3051 |
|
|
|
3052 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
3053 |
|
|
|
3054 |
|
|
; |
3055 |
|
|
} |
3056 |
|
|
unless ( |
3057 |
|
|
($qualifiedName =~ /\A\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*(?::\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*)?\z/) |
3058 |
|
|
) { |
3059 |
|
|
|
3060 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
3061 |
|
|
|
3062 |
|
|
; |
3063 |
|
|
} |
3064 |
|
|
} |
3065 |
|
|
|
3066 |
|
|
|
3067 |
|
|
;} |
3068 |
|
|
|
3069 |
|
|
; |
3070 |
|
|
|
3071 |
|
|
|
3072 |
|
|
{ |
3073 |
|
|
|
3074 |
|
|
if |
3075 |
|
|
(defined $prefix) { |
3076 |
|
|
if (not defined $namespaceURI) { |
3077 |
|
|
|
3078 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_PREFIX_WITH_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3079 |
|
|
|
3080 |
|
|
; |
3081 |
|
|
} elsif ($prefix eq 'xml' and $namespaceURI ne |
3082 |
|
|
'http://www.w3.org/XML/1998/namespace' |
3083 |
|
|
) { |
3084 |
|
|
|
3085 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XML_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3086 |
|
|
|
3087 |
|
|
; |
3088 |
|
|
} elsif ($prefix eq 'xmlns' and $namespaceURI ne |
3089 |
|
|
'http://www.w3.org/2000/xmlns/' |
3090 |
|
|
) { |
3091 |
|
|
|
3092 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XMLNS_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3093 |
|
|
|
3094 |
|
|
; |
3095 |
|
|
} elsif ($namespaceURI eq |
3096 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
3097 |
|
|
$prefix ne 'xml') { |
3098 |
|
|
|
3099 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XML_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3100 |
|
|
|
3101 |
|
|
; |
3102 |
|
|
} elsif ($namespaceURI eq |
3103 |
|
|
'http://www.w3.org/2000/xmlns/' and |
3104 |
|
|
$prefix ne 'xmlns') { |
3105 |
|
|
|
3106 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3107 |
|
|
|
3108 |
|
|
; |
3109 |
|
|
} |
3110 |
|
|
} else { ## No prefix |
3111 |
|
|
if (not defined $namespaceURI) { |
3112 |
|
|
# |
3113 |
|
|
} elsif ($namespaceURI eq |
3114 |
|
|
'http://www.w3.org/2000/xmlns/' and |
3115 |
|
|
$lname ne 'xmlns') { |
3116 |
|
|
|
3117 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => undef, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3118 |
|
|
|
3119 |
|
|
; |
3120 |
|
|
} |
3121 |
|
|
} |
3122 |
|
|
|
3123 |
|
|
|
3124 |
|
|
;} |
3125 |
|
|
|
3126 |
|
|
; |
3127 |
|
|
if (defined $namespaceURI and $namespaceURI eq |
3128 |
|
|
'http://www.w3.org/2000/xmlns/' and |
3129 |
|
|
|
3130 |
|
|
($qualifiedName eq 'xmlns' or |
3131 |
|
|
(defined $prefix and $prefix eq 'xmlns'))) { |
3132 |
|
|
|
3133 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'create_element_ns', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'qualifiedName', 'http://www.w3.org/2001/04/infoset#localName' => $lname, 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI'; |
3134 |
|
|
|
3135 |
|
|
; |
3136 |
|
|
} |
3137 |
|
|
} |
3138 |
|
|
|
3139 |
|
|
my $bag = |
3140 |
|
|
$self->{'b'} |
3141 |
|
|
; |
3142 |
|
|
my $stem; |
3143 |
|
|
|
3144 |
|
|
|
3145 |
|
|
{ |
3146 |
|
|
|
3147 |
|
|
|
3148 |
|
|
$stem = 'Message::DOM::Element::ManakaiDOMElement'->___create_node_stem ($bag, { |
3149 |
|
|
|
3150 |
|
|
'rc' |
3151 |
|
|
=> 0, |
3152 |
|
|
|
3153 |
|
|
'id' |
3154 |
|
|
=> \ |
3155 |
|
|
( |
3156 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
3157 |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
3158 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3159 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3160 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3161 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3162 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3163 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3164 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3165 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3166 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3167 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3168 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3169 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3170 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3171 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3172 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
3173 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
3174 |
|
|
) |
3175 |
|
|
, |
3176 |
|
|
}, { |
3177 |
|
|
'od' => $self, |
3178 |
|
|
'ns' => \$namespaceURI, |
3179 |
|
|
'pfx' => \$prefix, |
3180 |
|
|
'ln' => \$lname, |
3181 |
|
|
}); |
3182 |
|
|
|
3183 |
|
|
|
3184 |
|
|
{ |
3185 |
|
|
|
3186 |
|
|
if |
3187 |
|
|
(defined 'Message::DOM::Element::ManakaiDOMElement') { |
3188 |
|
|
if (ref 'Message::DOM::Element::ManakaiDOMElement' eq 'SCALAR') { |
3189 |
|
|
$stem->{'cls'} = 'Message::DOM::Element::ManakaiDOMElement'; |
3190 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}) { |
3191 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}; |
3192 |
|
|
} else { |
3193 |
|
|
require Scalar::Util; |
3194 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'} = \('Message::DOM::Element::ManakaiDOMElement'); |
3195 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}); |
3196 |
|
|
} |
3197 |
|
|
} else { |
3198 |
|
|
CORE::delete $stem->{'cls'}; |
3199 |
|
|
} |
3200 |
|
|
|
3201 |
|
|
|
3202 |
|
|
;} |
3203 |
|
|
|
3204 |
|
|
; |
3205 |
|
|
$bag->{${$stem->{ |
3206 |
|
|
'id' |
3207 |
|
|
}}} = $stem; |
3208 |
|
|
|
3209 |
|
|
|
3210 |
|
|
;} |
3211 |
|
|
|
3212 |
|
|
; |
3213 |
|
|
|
3214 |
|
|
|
3215 |
|
|
{ |
3216 |
|
|
|
3217 |
|
|
|
3218 |
|
|
$r = ${$stem->{ |
3219 |
|
|
'cls' |
3220 |
|
|
}}->___create_node_ref ({ |
3221 |
|
|
|
3222 |
|
|
'id' |
3223 |
|
|
=> $stem->{ |
3224 |
|
|
'id' |
3225 |
|
|
}, |
3226 |
|
|
|
3227 |
|
|
'b' |
3228 |
|
|
=> $bag, |
3229 |
|
|
}, { |
3230 |
|
|
}); |
3231 |
|
|
$stem->{ |
3232 |
|
|
'rc' |
3233 |
|
|
}++; |
3234 |
|
|
|
3235 |
|
|
|
3236 |
|
|
;} |
3237 |
|
|
|
3238 |
|
|
; |
3239 |
|
|
|
3240 |
|
|
## Default attributes |
3241 |
|
|
|
3242 |
|
|
|
3243 |
|
|
{ |
3244 |
|
|
|
3245 |
|
|
|
3246 |
|
|
{ |
3247 |
|
|
|
3248 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3249 |
|
|
|
3250 |
|
|
{ |
3251 |
|
|
|
3252 |
|
|
|
3253 |
wakaba |
1.2 |
XDA: |
3254 |
|
|
{ |
3255 |
|
|
my $__cfg = $self-> |
3256 |
wakaba |
1.1 |
dom_config |
3257 |
|
|
; |
3258 |
wakaba |
1.2 |
last XDA unless $__cfg-> |
3259 |
wakaba |
1.1 |
get_parameter |
3260 |
|
|
|
3261 |
wakaba |
1.2 |
( |
3262 |
|
|
'http://suika.fam.cx/www/2006/dom-config/dtd-default-attribute' |
3263 |
wakaba |
1.1 |
); |
3264 |
wakaba |
1.2 |
my $__doctype = $self-> |
3265 |
|
|
doctype |
3266 |
|
|
; |
3267 |
|
|
last XDA unless defined $__doctype; |
3268 |
|
|
$__doctype = $__doctype-> |
3269 |
wakaba |
1.1 |
get_feature |
3270 |
|
|
|
3271 |
|
|
( |
3272 |
|
|
'http://suika.fam.cx/www/2006/feature/XDoctype' |
3273 |
wakaba |
1.2 |
=> '3.0'); |
3274 |
|
|
last XDA unless defined $__doctype; |
3275 |
wakaba |
1.1 |
my $__et = $__doctype-> |
3276 |
|
|
get_element_type_definition_node |
3277 |
|
|
|
3278 |
|
|
($qualifiedName); |
3279 |
|
|
if ($__et) { |
3280 |
|
|
my $__orig_strict = $self-> |
3281 |
|
|
strict_error_checking |
3282 |
|
|
; |
3283 |
|
|
$self-> |
3284 |
|
|
strict_error_checking |
3285 |
|
|
( |
3286 |
|
|
0 |
3287 |
|
|
); |
3288 |
|
|
my %__gattr; |
3289 |
|
|
my %__has_attr; |
3290 |
|
|
my %__pfx_to_uri; |
3291 |
|
|
my $__copy_asis = $__cfg-> |
3292 |
|
|
get_parameter |
3293 |
|
|
|
3294 |
|
|
( |
3295 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
3296 |
|
|
); |
3297 |
|
|
$__cfg-> |
3298 |
|
|
set_parameter |
3299 |
|
|
|
3300 |
|
|
( |
3301 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
3302 |
|
|
=> |
3303 |
|
|
1 |
3304 |
|
|
); |
3305 |
|
|
for my $__at (@{$__et-> |
3306 |
|
|
attribute_definitions |
3307 |
|
|
}) { |
3308 |
|
|
my $__at_default = $__at-> |
3309 |
|
|
default_type |
3310 |
|
|
; |
3311 |
|
|
if ($__at_default == |
3312 |
|
|
4 or |
3313 |
|
|
|
3314 |
|
|
$__at_default == |
3315 |
|
|
1 |
3316 |
|
|
) { |
3317 |
|
|
my ($__nn1, $__nn2) = split /:/, $__at-> |
3318 |
|
|
node_name |
3319 |
|
|
; |
3320 |
|
|
if (defined $__nn2) { # prefixed |
3321 |
|
|
if ($__nn1 eq 'xmlns') { |
3322 |
|
|
## TODO: NCName check, prefix check and NSURI check |
3323 |
|
|
my $__attr = $self-> |
3324 |
|
|
create_attribute_ns |
3325 |
|
|
|
3326 |
|
|
( |
3327 |
|
|
'http://www.w3.org/2000/xmlns/' |
3328 |
|
|
, [$__nn1, $__nn2]); |
3329 |
|
|
for my $__at_child (@{$__at-> |
3330 |
|
|
child_nodes |
3331 |
|
|
}) { |
3332 |
|
|
$__attr-> |
3333 |
|
|
append_child |
3334 |
|
|
|
3335 |
|
|
($__at_child-> |
3336 |
|
|
clone_node |
3337 |
|
|
( |
3338 |
|
|
1 |
3339 |
|
|
)); |
3340 |
|
|
} |
3341 |
|
|
$__attr-> |
3342 |
|
|
manakai_attribute_type |
3343 |
|
|
|
3344 |
|
|
($__at-> |
3345 |
|
|
declared_type |
3346 |
|
|
); |
3347 |
|
|
my $__nsuri = $__attr-> |
3348 |
|
|
value |
3349 |
|
|
; |
3350 |
|
|
## TODO: Namespace well-formedness check (NSURI), v1.1 chk |
3351 |
|
|
$__pfx_to_uri{$__nn2} = $__nsuri; |
3352 |
|
|
$r-> |
3353 |
|
|
set_attribute_node_ns |
3354 |
|
|
($__attr); |
3355 |
|
|
## This method changes |specified| flag |
3356 |
|
|
$__attr-> |
3357 |
|
|
specified |
3358 |
|
|
( |
3359 |
|
|
0 |
3360 |
|
|
); |
3361 |
|
|
$__has_attr{ |
3362 |
|
|
'http://www.w3.org/2000/xmlns/' |
3363 |
|
|
}->{$__nn2} = |
3364 |
|
|
1 |
3365 |
|
|
; |
3366 |
|
|
} else { |
3367 |
|
|
## TODO: NCName check |
3368 |
|
|
$__gattr{$__nn1}->{$__nn2} = $__at; |
3369 |
|
|
} |
3370 |
|
|
} else { # no prefixed |
3371 |
|
|
my $__attr; |
3372 |
|
|
if ($__nn1 eq 'xmlns') { |
3373 |
|
|
$__attr = $self-> |
3374 |
|
|
create_attribute_ns |
3375 |
|
|
|
3376 |
|
|
( |
3377 |
|
|
'http://www.w3.org/2000/xmlns/' |
3378 |
|
|
, 'xmlns'); |
3379 |
|
|
$__has_attr{ |
3380 |
|
|
'http://www.w3.org/2000/xmlns/' |
3381 |
|
|
}->{xmlns} = |
3382 |
|
|
1 |
3383 |
|
|
; |
3384 |
|
|
} else { |
3385 |
|
|
$__attr = $self-> |
3386 |
|
|
create_attribute_ns |
3387 |
|
|
|
3388 |
|
|
( |
3389 |
|
|
undef |
3390 |
|
|
, $__nn1); |
3391 |
|
|
## TODO: NCName check |
3392 |
|
|
} |
3393 |
|
|
for my $__at_child (@{$__at-> |
3394 |
|
|
child_nodes |
3395 |
|
|
}) { |
3396 |
|
|
$__attr-> |
3397 |
|
|
append_child |
3398 |
|
|
|
3399 |
|
|
($__at_child-> |
3400 |
|
|
clone_node |
3401 |
|
|
( |
3402 |
|
|
1 |
3403 |
|
|
)); |
3404 |
|
|
} |
3405 |
|
|
$__attr-> |
3406 |
|
|
manakai_attribute_type |
3407 |
|
|
|
3408 |
|
|
($__at-> |
3409 |
|
|
declared_type |
3410 |
|
|
); |
3411 |
|
|
## TODO: Namespace well-formedness check (NSURI) |
3412 |
|
|
$r-> |
3413 |
|
|
set_attribute_node_ns |
3414 |
|
|
($__attr); |
3415 |
|
|
## This method changes |specified| flag |
3416 |
|
|
$__attr-> |
3417 |
|
|
specified |
3418 |
|
|
( |
3419 |
|
|
0 |
3420 |
|
|
); |
3421 |
|
|
} |
3422 |
|
|
} |
3423 |
|
|
} # attrdefs |
3424 |
|
|
for my $__pfx (keys %__gattr) { |
3425 |
|
|
my $__nsuri = $__pfx_to_uri{$__pfx}; |
3426 |
|
|
unless (defined $__nsuri) { |
3427 |
|
|
## TODO: Namespace well-formedness error |
3428 |
|
|
} |
3429 |
|
|
LN: for my $__ln (keys %{$__gattr{$__pfx}}) { |
3430 |
|
|
if ($__has_attr{defined $__nsuri ? $__nsuri : ''}->{$__ln}) { |
3431 |
|
|
## TODO: Namespace well-formedness error |
3432 |
|
|
next LN; |
3433 |
|
|
} |
3434 |
|
|
## TODO: NCName check, prefix check and NSURI check |
3435 |
|
|
my $__at = $__gattr{$__pfx}->{$__ln}; |
3436 |
|
|
my $__attr = $self-> |
3437 |
|
|
create_attribute_ns |
3438 |
|
|
|
3439 |
|
|
($__nsuri, [$__pfx, $__ln]); |
3440 |
|
|
for my $__at_child (@{$__at-> |
3441 |
|
|
child_nodes |
3442 |
|
|
}) { |
3443 |
|
|
$__attr-> |
3444 |
|
|
append_child |
3445 |
|
|
|
3446 |
|
|
($__at_child-> |
3447 |
|
|
clone_node |
3448 |
|
|
( |
3449 |
|
|
1 |
3450 |
|
|
)); |
3451 |
|
|
} |
3452 |
|
|
$__attr-> |
3453 |
|
|
manakai_attribute_type |
3454 |
|
|
|
3455 |
|
|
($__at-> |
3456 |
|
|
declared_type |
3457 |
|
|
); |
3458 |
|
|
$r-> |
3459 |
|
|
set_attribute_node_ns |
3460 |
|
|
($__attr); |
3461 |
|
|
## This method changes |specified| flag |
3462 |
|
|
$__attr-> |
3463 |
|
|
specified |
3464 |
|
|
( |
3465 |
|
|
0 |
3466 |
|
|
); |
3467 |
|
|
$__has_attr{defined $__nsuri ? $__nsuri : ''}->{$__ln} = |
3468 |
|
|
1 |
3469 |
|
|
; |
3470 |
|
|
} # LN |
3471 |
|
|
} # pfx |
3472 |
|
|
$__cfg-> |
3473 |
|
|
set_parameter |
3474 |
|
|
|
3475 |
|
|
( |
3476 |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
3477 |
|
|
=> $__copy_asis); |
3478 |
|
|
$self-> |
3479 |
|
|
strict_error_checking |
3480 |
|
|
($__orig_strict); |
3481 |
|
|
} |
3482 |
wakaba |
1.2 |
} # XDA |
3483 |
wakaba |
1.1 |
|
3484 |
|
|
|
3485 |
|
|
|
3486 |
|
|
;} |
3487 |
|
|
|
3488 |
|
|
|
3489 |
|
|
;} |
3490 |
|
|
|
3491 |
|
|
; |
3492 |
|
|
|
3493 |
|
|
|
3494 |
|
|
;} |
3495 |
|
|
|
3496 |
|
|
; |
3497 |
|
|
|
3498 |
|
|
|
3499 |
|
|
;} |
3500 |
|
|
$r} |
3501 |
|
|
sub create_attribute ($$) { |
3502 |
|
|
my ($self, $name) = @_; |
3503 |
|
|
my $r; |
3504 |
|
|
|
3505 |
|
|
{ |
3506 |
|
|
|
3507 |
|
|
my |
3508 |
|
|
$strict = $self-> |
3509 |
|
|
strict_error_checking |
3510 |
|
|
; |
3511 |
|
|
if ($strict) { |
3512 |
|
|
my $version = $self-> |
3513 |
|
|
xml_version |
3514 |
|
|
; |
3515 |
|
|
|
3516 |
|
|
|
3517 |
|
|
{ |
3518 |
|
|
|
3519 |
|
|
if |
3520 |
|
|
(defined $name) { |
3521 |
|
|
|
3522 |
|
|
|
3523 |
|
|
{ |
3524 |
|
|
|
3525 |
|
|
if |
3526 |
|
|
(((not defined $version or $version eq '1.0') and |
3527 |
|
|
not |
3528 |
|
|
($name =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
3529 |
|
|
) or |
3530 |
|
|
(defined $version and $version eq '1.1' and |
3531 |
|
|
not |
3532 |
|
|
($name =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
3533 |
|
|
)) { |
3534 |
|
|
|
3535 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $name, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
3536 |
|
|
|
3537 |
|
|
; |
3538 |
|
|
} |
3539 |
|
|
|
3540 |
|
|
|
3541 |
|
|
|
3542 |
|
|
;} |
3543 |
|
|
|
3544 |
|
|
; |
3545 |
|
|
|
3546 |
|
|
|
3547 |
|
|
; |
3548 |
|
|
} |
3549 |
|
|
|
3550 |
|
|
|
3551 |
|
|
;} |
3552 |
|
|
|
3553 |
|
|
; |
3554 |
|
|
} |
3555 |
|
|
|
3556 |
|
|
|
3557 |
|
|
{ |
3558 |
|
|
|
3559 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3560 |
|
|
|
3561 |
|
|
{ |
3562 |
|
|
|
3563 |
|
|
|
3564 |
|
|
|
3565 |
|
|
$self-> |
3566 |
|
|
strict_error_checking |
3567 |
|
|
( |
3568 |
|
|
0 |
3569 |
|
|
); |
3570 |
|
|
$r = $self-> |
3571 |
|
|
create_attribute_ns |
3572 |
|
|
( |
3573 |
|
|
undef |
3574 |
|
|
, [ |
3575 |
|
|
undef |
3576 |
|
|
, $name]); |
3577 |
|
|
$self-> |
3578 |
|
|
strict_error_checking |
3579 |
|
|
($strict); |
3580 |
|
|
|
3581 |
|
|
|
3582 |
|
|
|
3583 |
|
|
;} |
3584 |
|
|
|
3585 |
|
|
|
3586 |
|
|
;} |
3587 |
|
|
|
3588 |
|
|
; |
3589 |
|
|
|
3590 |
|
|
|
3591 |
|
|
;} |
3592 |
|
|
$r} |
3593 |
|
|
sub create_attribute_ns ($$$) { |
3594 |
|
|
my ($self, $namespaceURI, $qualifiedName) = @_; |
3595 |
|
|
|
3596 |
|
|
{ |
3597 |
|
|
|
3598 |
|
|
if |
3599 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
3600 |
|
|
|
3601 |
|
|
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:1143811080:18264:zbjED29418+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3602 |
|
|
|
3603 |
|
|
; |
3604 |
|
|
|
3605 |
|
|
|
3606 |
|
|
|
3607 |
|
|
{ |
3608 |
|
|
|
3609 |
|
|
|
3610 |
|
|
$namespaceURI = undef; |
3611 |
|
|
|
3612 |
|
|
|
3613 |
|
|
|
3614 |
|
|
;} |
3615 |
|
|
|
3616 |
|
|
; |
3617 |
|
|
} |
3618 |
|
|
|
3619 |
|
|
|
3620 |
|
|
;} |
3621 |
|
|
my $r; |
3622 |
|
|
|
3623 |
|
|
{ |
3624 |
|
|
|
3625 |
|
|
require |
3626 |
|
|
Message::DOM::Element; |
3627 |
|
|
|
3628 |
|
|
my ($prefix, $lname) = ref $qualifiedName eq 'ARRAY' |
3629 |
|
|
? @$qualifiedName |
3630 |
|
|
: split /:/, $qualifiedName, 2; |
3631 |
|
|
($prefix, $lname) = ( |
3632 |
|
|
undef |
3633 |
|
|
, $prefix) unless defined $lname; |
3634 |
|
|
|
3635 |
|
|
## TODO: autoload |
3636 |
|
|
if ((defined $namespaceURI and $namespaceURI eq |
3637 |
|
|
'http://www.w3.org/XML/1998/namespace' |
3638 |
|
|
) or |
3639 |
|
|
($lname =~ /^xml:/)) { |
3640 |
|
|
require Message::DOM::XML; |
3641 |
|
|
} |
3642 |
|
|
|
3643 |
|
|
if ($self-> |
3644 |
|
|
strict_error_checking |
3645 |
|
|
) { |
3646 |
|
|
my $version = $self-> |
3647 |
|
|
xml_version |
3648 |
|
|
; |
3649 |
|
|
$qualifiedName = defined $prefix ? $prefix.':'.$lname |
3650 |
|
|
: $lname; |
3651 |
|
|
|
3652 |
|
|
|
3653 |
|
|
{ |
3654 |
|
|
|
3655 |
|
|
if |
3656 |
|
|
(defined $version and $version eq '1.1') { |
3657 |
|
|
unless ( |
3658 |
|
|
($qualifiedName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
3659 |
|
|
) { |
3660 |
|
|
|
3661 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
3662 |
|
|
|
3663 |
|
|
; |
3664 |
|
|
} |
3665 |
|
|
unless ( |
3666 |
|
|
($qualifiedName =~ /\A\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*(?::\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*)?\z/) |
3667 |
|
|
) { |
3668 |
|
|
|
3669 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => '1.1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
3670 |
|
|
|
3671 |
|
|
; |
3672 |
|
|
} |
3673 |
|
|
} else { |
3674 |
|
|
unless ( |
3675 |
|
|
($qualifiedName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
3676 |
|
|
) { |
3677 |
|
|
|
3678 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
3679 |
|
|
|
3680 |
|
|
; |
3681 |
|
|
} |
3682 |
|
|
unless ( |
3683 |
|
|
($qualifiedName =~ /\A\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*(?::\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*)?\z/) |
3684 |
|
|
) { |
3685 |
|
|
|
3686 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_MALFORMED_QNAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $qualifiedName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_NAME'; |
3687 |
|
|
|
3688 |
|
|
; |
3689 |
|
|
} |
3690 |
|
|
} |
3691 |
|
|
|
3692 |
|
|
|
3693 |
|
|
;} |
3694 |
|
|
|
3695 |
|
|
; |
3696 |
|
|
|
3697 |
|
|
|
3698 |
|
|
{ |
3699 |
|
|
|
3700 |
|
|
if |
3701 |
|
|
(defined $prefix) { |
3702 |
|
|
if (not defined $namespaceURI) { |
3703 |
|
|
|
3704 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_PREFIX_WITH_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3705 |
|
|
|
3706 |
|
|
; |
3707 |
|
|
} elsif ($prefix eq 'xml' and $namespaceURI ne |
3708 |
|
|
'http://www.w3.org/XML/1998/namespace' |
3709 |
|
|
) { |
3710 |
|
|
|
3711 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XML_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3712 |
|
|
|
3713 |
|
|
; |
3714 |
|
|
} elsif ($prefix eq 'xmlns' and $namespaceURI ne |
3715 |
|
|
'http://www.w3.org/2000/xmlns/' |
3716 |
|
|
) { |
3717 |
|
|
|
3718 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_XMLNS_WITH_OTHER_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3719 |
|
|
|
3720 |
|
|
; |
3721 |
|
|
} elsif ($namespaceURI eq |
3722 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
3723 |
|
|
$prefix ne 'xml') { |
3724 |
|
|
|
3725 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XML_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3726 |
|
|
|
3727 |
|
|
; |
3728 |
|
|
} elsif ($namespaceURI eq |
3729 |
|
|
'http://www.w3.org/2000/xmlns/' and |
3730 |
|
|
$prefix ne 'xmlns') { |
3731 |
|
|
|
3732 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3733 |
|
|
|
3734 |
|
|
; |
3735 |
|
|
} |
3736 |
|
|
} else { ## No prefix |
3737 |
|
|
if (not defined $namespaceURI) { |
3738 |
|
|
# |
3739 |
|
|
} elsif ($namespaceURI eq |
3740 |
|
|
'http://www.w3.org/2000/xmlns/' and |
3741 |
|
|
$lname ne 'xmlns') { |
3742 |
|
|
|
3743 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://www.w3.org/2001/04/infoset#prefix' => undef, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23checkXMLNamesQName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
3744 |
|
|
|
3745 |
|
|
; |
3746 |
|
|
} |
3747 |
|
|
} |
3748 |
|
|
|
3749 |
|
|
|
3750 |
|
|
;} |
3751 |
|
|
|
3752 |
|
|
; |
3753 |
|
|
} |
3754 |
|
|
|
3755 |
|
|
my $bag = |
3756 |
|
|
$self->{'b'} |
3757 |
|
|
; |
3758 |
|
|
my $stem; |
3759 |
|
|
|
3760 |
|
|
|
3761 |
|
|
{ |
3762 |
|
|
|
3763 |
|
|
|
3764 |
|
|
$stem = 'Message::DOM::Element::ManakaiDOMAttr'->___create_node_stem ($bag, { |
3765 |
|
|
|
3766 |
|
|
'rc' |
3767 |
|
|
=> 0, |
3768 |
|
|
|
3769 |
|
|
'id' |
3770 |
|
|
=> \ |
3771 |
|
|
( |
3772 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
3773 |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
3774 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3775 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3776 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3777 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3778 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3779 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3780 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3781 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3782 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3783 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3784 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3785 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3786 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3787 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3788 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
3789 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
3790 |
|
|
) |
3791 |
|
|
, |
3792 |
|
|
}, { |
3793 |
|
|
'od' => $self, |
3794 |
|
|
'ns' => \$namespaceURI, |
3795 |
|
|
'pfx' => \$prefix, |
3796 |
|
|
'ln' => \$lname, |
3797 |
|
|
'specified' => 1, |
3798 |
|
|
}); |
3799 |
|
|
|
3800 |
|
|
|
3801 |
|
|
{ |
3802 |
|
|
|
3803 |
|
|
if |
3804 |
|
|
(defined 'Message::DOM::Element::ManakaiDOMAttr') { |
3805 |
|
|
if (ref 'Message::DOM::Element::ManakaiDOMAttr' eq 'SCALAR') { |
3806 |
|
|
$stem->{'cls'} = 'Message::DOM::Element::ManakaiDOMAttr'; |
3807 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}) { |
3808 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}; |
3809 |
|
|
} else { |
3810 |
|
|
require Scalar::Util; |
3811 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'} = \('Message::DOM::Element::ManakaiDOMAttr'); |
3812 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}); |
3813 |
|
|
} |
3814 |
|
|
} else { |
3815 |
|
|
CORE::delete $stem->{'cls'}; |
3816 |
|
|
} |
3817 |
|
|
|
3818 |
|
|
|
3819 |
|
|
;} |
3820 |
|
|
|
3821 |
|
|
; |
3822 |
|
|
$bag->{${$stem->{ |
3823 |
|
|
'id' |
3824 |
|
|
}}} = $stem; |
3825 |
|
|
|
3826 |
|
|
|
3827 |
|
|
;} |
3828 |
|
|
|
3829 |
|
|
; |
3830 |
|
|
|
3831 |
|
|
|
3832 |
|
|
{ |
3833 |
|
|
|
3834 |
|
|
|
3835 |
|
|
$r = ${$stem->{ |
3836 |
|
|
'cls' |
3837 |
|
|
}}->___create_node_ref ({ |
3838 |
|
|
|
3839 |
|
|
'id' |
3840 |
|
|
=> $stem->{ |
3841 |
|
|
'id' |
3842 |
|
|
}, |
3843 |
|
|
|
3844 |
|
|
'b' |
3845 |
|
|
=> $bag, |
3846 |
|
|
}, { |
3847 |
|
|
}); |
3848 |
|
|
$stem->{ |
3849 |
|
|
'rc' |
3850 |
|
|
}++; |
3851 |
|
|
|
3852 |
|
|
|
3853 |
|
|
;} |
3854 |
|
|
|
3855 |
|
|
; |
3856 |
|
|
|
3857 |
|
|
## Attribute type information |
3858 |
|
|
if ((defined $namespaceURI and $namespaceURI eq |
3859 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
3860 |
|
|
|
3861 |
|
|
$lname eq 'id') or |
3862 |
|
|
(not defined $namespaceURI and $lname eq 'xml:id')) { |
3863 |
|
|
|
3864 |
|
|
|
3865 |
|
|
{ |
3866 |
|
|
|
3867 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3868 |
|
|
|
3869 |
|
|
{ |
3870 |
|
|
|
3871 |
|
|
|
3872 |
|
|
if |
3873 |
|
|
($self-> |
3874 |
|
|
dom_config |
3875 |
|
|
|
3876 |
|
|
-> |
3877 |
|
|
get_parameter |
3878 |
|
|
|
3879 |
|
|
( |
3880 |
|
|
'http://suika.fam.cx/www/2006/dom-config/xml-id' |
3881 |
|
|
)) { |
3882 |
|
|
$r-> |
3883 |
|
|
manakai_attribute_type |
3884 |
|
|
( |
3885 |
|
|
2 |
3886 |
|
|
); |
3887 |
|
|
} |
3888 |
|
|
|
3889 |
|
|
|
3890 |
|
|
|
3891 |
|
|
;} |
3892 |
|
|
|
3893 |
|
|
|
3894 |
|
|
;} |
3895 |
|
|
|
3896 |
|
|
; |
3897 |
|
|
} |
3898 |
|
|
|
3899 |
|
|
|
3900 |
|
|
;} |
3901 |
|
|
$r} |
3902 |
|
|
sub create_text_node ($$) { |
3903 |
|
|
my ($self, $data) = @_; |
3904 |
|
|
my $r; |
3905 |
|
|
|
3906 |
|
|
{ |
3907 |
|
|
|
3908 |
|
|
my |
3909 |
|
|
$bag = |
3910 |
|
|
$self->{'b'} |
3911 |
|
|
; |
3912 |
|
|
my $stem; |
3913 |
|
|
|
3914 |
|
|
|
3915 |
|
|
{ |
3916 |
|
|
|
3917 |
|
|
|
3918 |
|
|
$stem = 'Message::DOM::TreeCore::ManakaiDOMText'->___create_node_stem ($bag, { |
3919 |
|
|
|
3920 |
|
|
'rc' |
3921 |
|
|
=> 0, |
3922 |
|
|
|
3923 |
|
|
'id' |
3924 |
|
|
=> \ |
3925 |
|
|
( |
3926 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
3927 |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
3928 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3929 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3930 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3931 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3932 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3933 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3934 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3935 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3936 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3937 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3938 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3939 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
3940 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
3941 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
3942 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
3943 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
3944 |
|
|
) |
3945 |
|
|
, |
3946 |
|
|
}, { |
3947 |
|
|
'od' => $self, |
3948 |
|
|
'con' => \$data, |
3949 |
|
|
}); |
3950 |
|
|
|
3951 |
|
|
|
3952 |
|
|
{ |
3953 |
|
|
|
3954 |
|
|
if |
3955 |
|
|
(defined 'Message::DOM::TreeCore::ManakaiDOMText') { |
3956 |
|
|
if (ref 'Message::DOM::TreeCore::ManakaiDOMText' eq 'SCALAR') { |
3957 |
|
|
$stem->{'cls'} = 'Message::DOM::TreeCore::ManakaiDOMText'; |
3958 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMText'}) { |
3959 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMText'}; |
3960 |
|
|
} else { |
3961 |
|
|
require Scalar::Util; |
3962 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMText'} = \('Message::DOM::TreeCore::ManakaiDOMText'); |
3963 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMText'}); |
3964 |
|
|
} |
3965 |
|
|
} else { |
3966 |
|
|
CORE::delete $stem->{'cls'}; |
3967 |
|
|
} |
3968 |
|
|
|
3969 |
|
|
|
3970 |
|
|
;} |
3971 |
|
|
|
3972 |
|
|
; |
3973 |
|
|
$bag->{${$stem->{ |
3974 |
|
|
'id' |
3975 |
|
|
}}} = $stem; |
3976 |
|
|
|
3977 |
|
|
|
3978 |
|
|
;} |
3979 |
|
|
|
3980 |
|
|
; |
3981 |
|
|
|
3982 |
|
|
|
3983 |
|
|
{ |
3984 |
|
|
|
3985 |
|
|
|
3986 |
|
|
$r = ${$stem->{ |
3987 |
|
|
'cls' |
3988 |
|
|
}}->___create_node_ref ({ |
3989 |
|
|
|
3990 |
|
|
'id' |
3991 |
|
|
=> $stem->{ |
3992 |
|
|
'id' |
3993 |
|
|
}, |
3994 |
|
|
|
3995 |
|
|
'b' |
3996 |
|
|
=> $bag, |
3997 |
|
|
}, { |
3998 |
|
|
}); |
3999 |
|
|
$stem->{ |
4000 |
|
|
'rc' |
4001 |
|
|
}++; |
4002 |
|
|
|
4003 |
|
|
|
4004 |
|
|
;} |
4005 |
|
|
|
4006 |
|
|
; |
4007 |
|
|
|
4008 |
|
|
|
4009 |
|
|
;} |
4010 |
|
|
$r} |
4011 |
|
|
sub create_cdata_section ($$) { |
4012 |
|
|
my ($self, $data) = @_; |
4013 |
|
|
my $r; |
4014 |
|
|
|
4015 |
|
|
{ |
4016 |
|
|
|
4017 |
|
|
require |
4018 |
|
|
Message::DOM::XML; |
4019 |
|
|
my $bag = |
4020 |
|
|
$self->{'b'} |
4021 |
|
|
; |
4022 |
|
|
my $stem; |
4023 |
|
|
|
4024 |
|
|
|
4025 |
|
|
{ |
4026 |
|
|
|
4027 |
|
|
|
4028 |
|
|
$stem = 'Message::DOM::XML::ManakaiDOMCDATASection'->___create_node_stem ($bag, { |
4029 |
|
|
|
4030 |
|
|
'rc' |
4031 |
|
|
=> 0, |
4032 |
|
|
|
4033 |
|
|
'id' |
4034 |
|
|
=> \ |
4035 |
|
|
( |
4036 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
4037 |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
4038 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4039 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4040 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4041 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4042 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4043 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4044 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4045 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4046 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4047 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4048 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4049 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4050 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4051 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4052 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
4053 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
4054 |
|
|
) |
4055 |
|
|
, |
4056 |
|
|
}, { |
4057 |
|
|
'od' => $self, |
4058 |
|
|
'con' => \$data, |
4059 |
|
|
}); |
4060 |
|
|
|
4061 |
|
|
|
4062 |
|
|
{ |
4063 |
|
|
|
4064 |
|
|
if |
4065 |
|
|
(defined 'Message::DOM::XML::ManakaiDOMCDATASection') { |
4066 |
|
|
if (ref 'Message::DOM::XML::ManakaiDOMCDATASection' eq 'SCALAR') { |
4067 |
|
|
$stem->{'cls'} = 'Message::DOM::XML::ManakaiDOMCDATASection'; |
4068 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMCDATASection'}) { |
4069 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMCDATASection'}; |
4070 |
|
|
} else { |
4071 |
|
|
require Scalar::Util; |
4072 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMCDATASection'} = \('Message::DOM::XML::ManakaiDOMCDATASection'); |
4073 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMCDATASection'}); |
4074 |
|
|
} |
4075 |
|
|
} else { |
4076 |
|
|
CORE::delete $stem->{'cls'}; |
4077 |
|
|
} |
4078 |
|
|
|
4079 |
|
|
|
4080 |
|
|
;} |
4081 |
|
|
|
4082 |
|
|
; |
4083 |
|
|
$bag->{${$stem->{ |
4084 |
|
|
'id' |
4085 |
|
|
}}} = $stem; |
4086 |
|
|
|
4087 |
|
|
|
4088 |
|
|
;} |
4089 |
|
|
|
4090 |
|
|
; |
4091 |
|
|
|
4092 |
|
|
|
4093 |
|
|
{ |
4094 |
|
|
|
4095 |
|
|
|
4096 |
|
|
$r = ${$stem->{ |
4097 |
|
|
'cls' |
4098 |
|
|
}}->___create_node_ref ({ |
4099 |
|
|
|
4100 |
|
|
'id' |
4101 |
|
|
=> $stem->{ |
4102 |
|
|
'id' |
4103 |
|
|
}, |
4104 |
|
|
|
4105 |
|
|
'b' |
4106 |
|
|
=> $bag, |
4107 |
|
|
}, { |
4108 |
|
|
}); |
4109 |
|
|
$stem->{ |
4110 |
|
|
'rc' |
4111 |
|
|
}++; |
4112 |
|
|
|
4113 |
|
|
|
4114 |
|
|
;} |
4115 |
|
|
|
4116 |
|
|
; |
4117 |
|
|
|
4118 |
|
|
|
4119 |
|
|
;} |
4120 |
|
|
$r} |
4121 |
|
|
sub create_comment ($$) { |
4122 |
|
|
my ($self, $data) = @_; |
4123 |
|
|
my $r; |
4124 |
|
|
|
4125 |
|
|
{ |
4126 |
|
|
|
4127 |
|
|
my |
4128 |
|
|
$bag = |
4129 |
|
|
$self->{'b'} |
4130 |
|
|
; |
4131 |
|
|
my $stem; |
4132 |
|
|
|
4133 |
|
|
|
4134 |
|
|
{ |
4135 |
|
|
|
4136 |
|
|
|
4137 |
|
|
$stem = 'Message::DOM::TreeCore::ManakaiDOMComment'->___create_node_stem ($bag, { |
4138 |
|
|
|
4139 |
|
|
'rc' |
4140 |
|
|
=> 0, |
4141 |
|
|
|
4142 |
|
|
'id' |
4143 |
|
|
=> \ |
4144 |
|
|
( |
4145 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
4146 |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
4147 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4148 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4149 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4150 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4151 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4152 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4153 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4154 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4155 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4156 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4157 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4158 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4159 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4160 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4161 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
4162 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
4163 |
|
|
) |
4164 |
|
|
, |
4165 |
|
|
}, { |
4166 |
|
|
'od' => $self, |
4167 |
|
|
'con' => \$data, |
4168 |
|
|
}); |
4169 |
|
|
|
4170 |
|
|
|
4171 |
|
|
{ |
4172 |
|
|
|
4173 |
|
|
if |
4174 |
|
|
(defined 'Message::DOM::TreeCore::ManakaiDOMComment') { |
4175 |
|
|
if (ref 'Message::DOM::TreeCore::ManakaiDOMComment' eq 'SCALAR') { |
4176 |
|
|
$stem->{'cls'} = 'Message::DOM::TreeCore::ManakaiDOMComment'; |
4177 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMComment'}) { |
4178 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMComment'}; |
4179 |
|
|
} else { |
4180 |
|
|
require Scalar::Util; |
4181 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMComment'} = \('Message::DOM::TreeCore::ManakaiDOMComment'); |
4182 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMComment'}); |
4183 |
|
|
} |
4184 |
|
|
} else { |
4185 |
|
|
CORE::delete $stem->{'cls'}; |
4186 |
|
|
} |
4187 |
|
|
|
4188 |
|
|
|
4189 |
|
|
;} |
4190 |
|
|
|
4191 |
|
|
; |
4192 |
|
|
$bag->{${$stem->{ |
4193 |
|
|
'id' |
4194 |
|
|
}}} = $stem; |
4195 |
|
|
|
4196 |
|
|
|
4197 |
|
|
;} |
4198 |
|
|
|
4199 |
|
|
; |
4200 |
|
|
|
4201 |
|
|
|
4202 |
|
|
{ |
4203 |
|
|
|
4204 |
|
|
|
4205 |
|
|
$r = ${$stem->{ |
4206 |
|
|
'cls' |
4207 |
|
|
}}->___create_node_ref ({ |
4208 |
|
|
|
4209 |
|
|
'id' |
4210 |
|
|
=> $stem->{ |
4211 |
|
|
'id' |
4212 |
|
|
}, |
4213 |
|
|
|
4214 |
|
|
'b' |
4215 |
|
|
=> $bag, |
4216 |
|
|
}, { |
4217 |
|
|
}); |
4218 |
|
|
$stem->{ |
4219 |
|
|
'rc' |
4220 |
|
|
}++; |
4221 |
|
|
|
4222 |
|
|
|
4223 |
|
|
;} |
4224 |
|
|
|
4225 |
|
|
; |
4226 |
|
|
|
4227 |
|
|
|
4228 |
|
|
;} |
4229 |
|
|
$r} |
4230 |
|
|
sub create_document_fragment ($) { |
4231 |
|
|
my ($self) = @_; |
4232 |
|
|
my $r; |
4233 |
|
|
|
4234 |
|
|
{ |
4235 |
|
|
|
4236 |
|
|
my |
4237 |
|
|
$bag = |
4238 |
|
|
$self->{'b'} |
4239 |
|
|
; |
4240 |
|
|
my $stem; |
4241 |
|
|
|
4242 |
|
|
|
4243 |
|
|
{ |
4244 |
|
|
|
4245 |
|
|
|
4246 |
|
|
$stem = 'Message::DOM::Document::ManakaiDOMDocumentFragment'->___create_node_stem ($bag, { |
4247 |
|
|
|
4248 |
|
|
'rc' |
4249 |
|
|
=> 0, |
4250 |
|
|
|
4251 |
|
|
'id' |
4252 |
|
|
=> \ |
4253 |
|
|
( |
4254 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
4255 |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
4256 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4257 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4258 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4259 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4260 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4261 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4262 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4263 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4264 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4265 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4266 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4267 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4268 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4269 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4270 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
4271 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
4272 |
|
|
) |
4273 |
|
|
, |
4274 |
|
|
}, { |
4275 |
|
|
'od' => $self, |
4276 |
|
|
}); |
4277 |
|
|
|
4278 |
|
|
|
4279 |
|
|
{ |
4280 |
|
|
|
4281 |
|
|
if |
4282 |
|
|
(defined 'Message::DOM::Document::ManakaiDOMDocumentFragment') { |
4283 |
|
|
if (ref 'Message::DOM::Document::ManakaiDOMDocumentFragment' eq 'SCALAR') { |
4284 |
|
|
$stem->{'cls'} = 'Message::DOM::Document::ManakaiDOMDocumentFragment'; |
4285 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}) { |
4286 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}; |
4287 |
|
|
} else { |
4288 |
|
|
require Scalar::Util; |
4289 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'} = \('Message::DOM::Document::ManakaiDOMDocumentFragment'); |
4290 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}); |
4291 |
|
|
} |
4292 |
|
|
} else { |
4293 |
|
|
CORE::delete $stem->{'cls'}; |
4294 |
|
|
} |
4295 |
|
|
|
4296 |
|
|
|
4297 |
|
|
;} |
4298 |
|
|
|
4299 |
|
|
; |
4300 |
|
|
$bag->{${$stem->{ |
4301 |
|
|
'id' |
4302 |
|
|
}}} = $stem; |
4303 |
|
|
|
4304 |
|
|
|
4305 |
|
|
;} |
4306 |
|
|
|
4307 |
|
|
; |
4308 |
|
|
|
4309 |
|
|
|
4310 |
|
|
{ |
4311 |
|
|
|
4312 |
|
|
|
4313 |
|
|
$r = ${$stem->{ |
4314 |
|
|
'cls' |
4315 |
|
|
}}->___create_node_ref ({ |
4316 |
|
|
|
4317 |
|
|
'id' |
4318 |
|
|
=> $stem->{ |
4319 |
|
|
'id' |
4320 |
|
|
}, |
4321 |
|
|
|
4322 |
|
|
'b' |
4323 |
|
|
=> $bag, |
4324 |
|
|
}, { |
4325 |
|
|
}); |
4326 |
|
|
$stem->{ |
4327 |
|
|
'rc' |
4328 |
|
|
}++; |
4329 |
|
|
|
4330 |
|
|
|
4331 |
|
|
;} |
4332 |
|
|
|
4333 |
|
|
; |
4334 |
|
|
|
4335 |
|
|
|
4336 |
|
|
;} |
4337 |
|
|
$r} |
4338 |
|
|
sub create_entity_reference ($$) { |
4339 |
|
|
my ($self, $name) = @_; |
4340 |
|
|
my $r; |
4341 |
|
|
|
4342 |
|
|
{ |
4343 |
|
|
|
4344 |
|
|
require |
4345 |
|
|
Message::DOM::XML; |
4346 |
|
|
our $CreateEntityReference_OpenEntity; |
4347 |
|
|
## NOTE: Multithread unsafe |
4348 |
|
|
|
4349 |
|
|
my $orig_strict = $self-> |
4350 |
|
|
strict_error_checking |
4351 |
|
|
; |
4352 |
|
|
if ($orig_strict) { |
4353 |
|
|
my $version = $self-> |
4354 |
|
|
xml_version |
4355 |
|
|
; |
4356 |
|
|
|
4357 |
|
|
|
4358 |
|
|
{ |
4359 |
|
|
|
4360 |
|
|
if |
4361 |
|
|
(defined $name) { |
4362 |
|
|
|
4363 |
|
|
|
4364 |
|
|
{ |
4365 |
|
|
|
4366 |
|
|
if |
4367 |
|
|
(((not defined $version or $version eq '1.0') and |
4368 |
|
|
not |
4369 |
|
|
($name =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
4370 |
|
|
) or |
4371 |
|
|
(defined $version and $version eq '1.1' and |
4372 |
|
|
not |
4373 |
|
|
($name =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
4374 |
|
|
)) { |
4375 |
|
|
|
4376 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $name, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
4377 |
|
|
|
4378 |
|
|
; |
4379 |
|
|
} |
4380 |
|
|
|
4381 |
|
|
|
4382 |
|
|
|
4383 |
|
|
;} |
4384 |
|
|
|
4385 |
|
|
; |
4386 |
|
|
|
4387 |
|
|
|
4388 |
|
|
; |
4389 |
|
|
} |
4390 |
|
|
|
4391 |
|
|
|
4392 |
|
|
;} |
4393 |
|
|
|
4394 |
|
|
; |
4395 |
|
|
} |
4396 |
|
|
|
4397 |
|
|
my $bag = |
4398 |
|
|
$self->{'b'} |
4399 |
|
|
; |
4400 |
|
|
my $stem; |
4401 |
|
|
|
4402 |
|
|
|
4403 |
|
|
{ |
4404 |
|
|
|
4405 |
|
|
|
4406 |
|
|
$stem = 'Message::DOM::XML::ManakaiDOMEntityReference'->___create_node_stem ($bag, { |
4407 |
|
|
|
4408 |
|
|
'rc' |
4409 |
|
|
=> 0, |
4410 |
|
|
|
4411 |
|
|
'id' |
4412 |
|
|
=> \ |
4413 |
|
|
( |
4414 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
4415 |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
4416 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4417 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4418 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4419 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4420 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4421 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4422 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4423 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4424 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4425 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4426 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4427 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4428 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4429 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4430 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
4431 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
4432 |
|
|
) |
4433 |
|
|
, |
4434 |
|
|
}, { |
4435 |
|
|
'xname' => \$name, |
4436 |
|
|
'od' => $self, |
4437 |
|
|
}); |
4438 |
|
|
|
4439 |
|
|
|
4440 |
|
|
{ |
4441 |
|
|
|
4442 |
|
|
if |
4443 |
|
|
(defined 'Message::DOM::XML::ManakaiDOMEntityReference') { |
4444 |
|
|
if (ref 'Message::DOM::XML::ManakaiDOMEntityReference' eq 'SCALAR') { |
4445 |
|
|
$stem->{'cls'} = 'Message::DOM::XML::ManakaiDOMEntityReference'; |
4446 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMEntityReference'}) { |
4447 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMEntityReference'}; |
4448 |
|
|
} else { |
4449 |
|
|
require Scalar::Util; |
4450 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMEntityReference'} = \('Message::DOM::XML::ManakaiDOMEntityReference'); |
4451 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMEntityReference'}); |
4452 |
|
|
} |
4453 |
|
|
} else { |
4454 |
|
|
CORE::delete $stem->{'cls'}; |
4455 |
|
|
} |
4456 |
|
|
|
4457 |
|
|
|
4458 |
|
|
;} |
4459 |
|
|
|
4460 |
|
|
; |
4461 |
|
|
$bag->{${$stem->{ |
4462 |
|
|
'id' |
4463 |
|
|
}}} = $stem; |
4464 |
|
|
|
4465 |
|
|
|
4466 |
|
|
;} |
4467 |
|
|
|
4468 |
|
|
; |
4469 |
|
|
|
4470 |
|
|
|
4471 |
|
|
{ |
4472 |
|
|
|
4473 |
|
|
|
4474 |
|
|
$r = ${$stem->{ |
4475 |
|
|
'cls' |
4476 |
|
|
}}->___create_node_ref ({ |
4477 |
|
|
|
4478 |
|
|
'id' |
4479 |
|
|
=> $stem->{ |
4480 |
|
|
'id' |
4481 |
|
|
}, |
4482 |
|
|
|
4483 |
|
|
'b' |
4484 |
|
|
=> $bag, |
4485 |
|
|
}, { |
4486 |
|
|
}); |
4487 |
|
|
$stem->{ |
4488 |
|
|
'rc' |
4489 |
|
|
}++; |
4490 |
|
|
|
4491 |
|
|
|
4492 |
|
|
;} |
4493 |
|
|
|
4494 |
|
|
; |
4495 |
|
|
|
4496 |
|
|
## Expansion |
4497 |
|
|
|
4498 |
|
|
|
4499 |
|
|
{ |
4500 |
|
|
|
4501 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4502 |
|
|
|
4503 |
|
|
{ |
4504 |
|
|
|
4505 |
|
|
|
4506 |
|
|
unless |
4507 |
|
|
($CreateEntityReference_OpenEntity->{$name}) { |
4508 |
|
|
local $CreateEntityReference_OpenEntity->{$name} = |
4509 |
|
|
1 |
4510 |
|
|
; |
4511 |
|
|
my $__doctype = $self-> |
4512 |
|
|
doctype |
4513 |
|
|
; |
4514 |
|
|
$__doctype = $__doctype-> |
4515 |
|
|
get_feature |
4516 |
|
|
|
4517 |
|
|
( |
4518 |
|
|
'http://suika.fam.cx/www/2006/feature/XDoctype' |
4519 |
|
|
=> '3.0') |
4520 |
|
|
if $__doctype; |
4521 |
|
|
if ($__doctype) { |
4522 |
|
|
my $__et = $__doctype-> |
4523 |
|
|
get_general_entity_node |
4524 |
|
|
($name); |
4525 |
|
|
if ($__et) { |
4526 |
|
|
$self-> |
4527 |
|
|
strict_error_checking |
4528 |
|
|
( |
4529 |
|
|
0 |
4530 |
|
|
); |
4531 |
|
|
my @node; |
4532 |
|
|
for my $c (@{$__et-> |
4533 |
|
|
child_nodes |
4534 |
|
|
}) { |
4535 |
|
|
my $clone = $c-> |
4536 |
|
|
clone_node |
4537 |
|
|
( |
4538 |
|
|
1 |
4539 |
|
|
); |
4540 |
|
|
$r-> |
4541 |
|
|
append_child |
4542 |
|
|
($clone); |
4543 |
|
|
push @node, $clone; |
4544 |
|
|
} |
4545 |
|
|
$r-> |
4546 |
|
|
manakai_expanded |
4547 |
|
|
|
4548 |
|
|
($__et-> |
4549 |
|
|
has_replacement_tree |
4550 |
|
|
); |
4551 |
|
|
$self-> |
4552 |
|
|
strict_error_checking |
4553 |
|
|
($orig_strict); |
4554 |
|
|
} # entity |
4555 |
|
|
} # doctype |
4556 |
|
|
} |
4557 |
|
|
$r-> |
4558 |
|
|
manakai_set_read_only |
4559 |
|
|
( |
4560 |
|
|
1 |
4561 |
|
|
, |
4562 |
|
|
1 |
4563 |
|
|
); |
4564 |
|
|
|
4565 |
|
|
|
4566 |
|
|
|
4567 |
|
|
;} |
4568 |
|
|
|
4569 |
|
|
|
4570 |
|
|
;} |
4571 |
|
|
|
4572 |
|
|
; |
4573 |
|
|
|
4574 |
|
|
|
4575 |
|
|
;} |
4576 |
|
|
$r} |
4577 |
|
|
sub create_processing_instruction ($$$) { |
4578 |
|
|
my ($self, $target, $data) = @_; |
4579 |
|
|
my $r; |
4580 |
|
|
|
4581 |
|
|
{ |
4582 |
|
|
|
4583 |
|
|
require |
4584 |
|
|
Message::DOM::XML; |
4585 |
|
|
|
4586 |
|
|
if ($self-> |
4587 |
|
|
strict_error_checking |
4588 |
|
|
) { |
4589 |
|
|
my $version = $self-> |
4590 |
|
|
xml_version |
4591 |
|
|
; |
4592 |
|
|
|
4593 |
|
|
|
4594 |
|
|
{ |
4595 |
|
|
|
4596 |
|
|
if |
4597 |
|
|
(defined $target) { |
4598 |
|
|
|
4599 |
|
|
|
4600 |
|
|
{ |
4601 |
|
|
|
4602 |
|
|
if |
4603 |
|
|
(((not defined $version or $version eq '1.0') and |
4604 |
|
|
not |
4605 |
|
|
($target =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
4606 |
|
|
) or |
4607 |
|
|
(defined $version and $version eq '1.1' and |
4608 |
|
|
not |
4609 |
|
|
($target =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
4610 |
|
|
)) { |
4611 |
|
|
|
4612 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $target, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
4613 |
|
|
|
4614 |
|
|
; |
4615 |
|
|
} |
4616 |
|
|
|
4617 |
|
|
|
4618 |
|
|
|
4619 |
|
|
;} |
4620 |
|
|
|
4621 |
|
|
; |
4622 |
|
|
|
4623 |
|
|
|
4624 |
|
|
; |
4625 |
|
|
} |
4626 |
|
|
|
4627 |
|
|
|
4628 |
|
|
;} |
4629 |
|
|
|
4630 |
|
|
; |
4631 |
|
|
} |
4632 |
|
|
|
4633 |
|
|
my $bag = |
4634 |
|
|
$self->{'b'} |
4635 |
|
|
; |
4636 |
|
|
$data = '' unless defined $data; |
4637 |
|
|
my $stem; |
4638 |
|
|
|
4639 |
|
|
|
4640 |
|
|
{ |
4641 |
|
|
|
4642 |
|
|
|
4643 |
|
|
$stem = 'Message::DOM::XML::ManakaiDOMProcessingInstruction'->___create_node_stem ($bag, { |
4644 |
|
|
|
4645 |
|
|
'rc' |
4646 |
|
|
=> 0, |
4647 |
|
|
|
4648 |
|
|
'id' |
4649 |
|
|
=> \ |
4650 |
|
|
( |
4651 |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
4652 |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
4653 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4654 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4655 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4656 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4657 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4658 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4659 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4660 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4661 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4662 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4663 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4664 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
4665 |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
4666 |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
4667 |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
4668 |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
4669 |
|
|
) |
4670 |
|
|
, |
4671 |
|
|
}, { |
4672 |
|
|
'target' => \$target, |
4673 |
|
|
'con' => \$data, |
4674 |
|
|
'od' => $self, |
4675 |
|
|
}); |
4676 |
|
|
|
4677 |
|
|
|
4678 |
|
|
{ |
4679 |
|
|
|
4680 |
|
|
if |
4681 |
|
|
(defined 'Message::DOM::XML::ManakaiDOMProcessingInstruction') { |
4682 |
|
|
if (ref 'Message::DOM::XML::ManakaiDOMProcessingInstruction' eq 'SCALAR') { |
4683 |
|
|
$stem->{'cls'} = 'Message::DOM::XML::ManakaiDOMProcessingInstruction'; |
4684 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMProcessingInstruction'}) { |
4685 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMProcessingInstruction'}; |
4686 |
|
|
} else { |
4687 |
|
|
require Scalar::Util; |
4688 |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMProcessingInstruction'} = \('Message::DOM::XML::ManakaiDOMProcessingInstruction'); |
4689 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMProcessingInstruction'}); |
4690 |
|
|
} |
4691 |
|
|
} else { |
4692 |
|
|
CORE::delete $stem->{'cls'}; |
4693 |
|
|
} |
4694 |
|
|
|
4695 |
|
|
|
4696 |
|
|
;} |
4697 |
|
|
|
4698 |
|
|
; |
4699 |
|
|
$bag->{${$stem->{ |
4700 |
|
|
'id' |
4701 |
|
|
}}} = $stem; |
4702 |
|
|
|
4703 |
|
|
|
4704 |
|
|
;} |
4705 |
|
|
|
4706 |
|
|
; |
4707 |
|
|
|
4708 |
|
|
|
4709 |
|
|
{ |
4710 |
|
|
|
4711 |
|
|
|
4712 |
|
|
$r = ${$stem->{ |
4713 |
|
|
'cls' |
4714 |
|
|
}}->___create_node_ref ({ |
4715 |
|
|
|
4716 |
|
|
'id' |
4717 |
|
|
=> $stem->{ |
4718 |
|
|
'id' |
4719 |
|
|
}, |
4720 |
|
|
|
4721 |
|
|
'b' |
4722 |
|
|
=> $bag, |
4723 |
|
|
}, { |
4724 |
|
|
}); |
4725 |
|
|
$stem->{ |
4726 |
|
|
'rc' |
4727 |
|
|
}++; |
4728 |
|
|
|
4729 |
|
|
|
4730 |
|
|
;} |
4731 |
|
|
|
4732 |
|
|
; |
4733 |
|
|
|
4734 |
|
|
|
4735 |
|
|
;} |
4736 |
|
|
$r} |
4737 |
|
|
sub strict_error_checking ($;$) { |
4738 |
|
|
if (@_ == 1) {my ($self) = @_; |
4739 |
|
|
my $r = 0; |
4740 |
|
|
|
4741 |
|
|
{ |
4742 |
|
|
|
4743 |
|
|
|
4744 |
|
|
{ |
4745 |
|
|
|
4746 |
|
|
|
4747 |
|
|
$r = $self->{ |
4748 |
|
|
'b' |
4749 |
|
|
}->{${$self->{ |
4750 |
|
|
'id' |
4751 |
|
|
}}} |
4752 |
|
|
->{'chk'}; |
4753 |
|
|
|
4754 |
|
|
|
4755 |
|
|
;} |
4756 |
|
|
|
4757 |
|
|
; |
4758 |
|
|
$r = |
4759 |
|
|
1 unless |
4760 |
|
|
defined $r; |
4761 |
|
|
|
4762 |
|
|
|
4763 |
|
|
;} |
4764 |
|
|
$r; |
4765 |
|
|
} else {my ($self, $given) = @_; |
4766 |
|
|
|
4767 |
|
|
{ |
4768 |
|
|
|
4769 |
|
|
|
4770 |
|
|
{ |
4771 |
|
|
|
4772 |
|
|
|
4773 |
|
|
$self->{ |
4774 |
|
|
'b' |
4775 |
|
|
}->{${$self->{ |
4776 |
|
|
'id' |
4777 |
|
|
}}} |
4778 |
|
|
->{'chk'} = $given ? 1 : 0; |
4779 |
|
|
|
4780 |
|
|
|
4781 |
|
|
;} |
4782 |
|
|
|
4783 |
|
|
; |
4784 |
|
|
|
4785 |
|
|
|
4786 |
|
|
;} |
4787 |
|
|
} |
4788 |
|
|
} |
4789 |
|
|
sub dom_config ($;$) { |
4790 |
|
|
if (@_ == 1) {my ($self) = @_; |
4791 |
|
|
my $r; |
4792 |
|
|
|
4793 |
|
|
{ |
4794 |
|
|
|
4795 |
|
|
|
4796 |
|
|
{ |
4797 |
|
|
|
4798 |
|
|
|
4799 |
|
|
$r = bless [$self, ($self->{'b'}->{${$self->{'id'}}}), 'Message::DOM::IFLatest::Document'], |
4800 |
|
|
|
4801 |
|
|
'Message::DOM::DOMCore::ManakaiDOMConfiguration' |
4802 |
|
|
; |
4803 |
|
|
|
4804 |
|
|
|
4805 |
|
|
;} |
4806 |
|
|
|
4807 |
|
|
; |
4808 |
|
|
|
4809 |
|
|
|
4810 |
|
|
;} |
4811 |
|
|
$r; |
4812 |
|
|
} else {my ($self) = @_; |
4813 |
|
|
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'; |
4814 |
|
|
} |
4815 |
|
|
} |
4816 |
|
|
sub document_element ($;$) { |
4817 |
|
|
if (@_ == 1) {my ($self) = @_; |
4818 |
|
|
my $r; |
4819 |
|
|
|
4820 |
|
|
{ |
4821 |
|
|
|
4822 |
|
|
|
4823 |
|
|
{ |
4824 |
|
|
|
4825 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4826 |
|
|
|
4827 |
|
|
{ |
4828 |
|
|
|
4829 |
|
|
|
4830 |
|
|
F: |
4831 |
|
|
for my $child (@{$self-> |
4832 |
|
|
child_nodes |
4833 |
|
|
}) { |
4834 |
|
|
if ($child-> |
4835 |
|
|
node_type |
4836 |
|
|
== |
4837 |
|
|
1 |
4838 |
|
|
) { |
4839 |
|
|
$r = $child; |
4840 |
|
|
last F; |
4841 |
|
|
} |
4842 |
|
|
} # F |
4843 |
|
|
|
4844 |
|
|
|
4845 |
|
|
|
4846 |
|
|
;} |
4847 |
|
|
|
4848 |
|
|
|
4849 |
|
|
;} |
4850 |
|
|
|
4851 |
|
|
; |
4852 |
|
|
|
4853 |
|
|
|
4854 |
|
|
;} |
4855 |
|
|
$r; |
4856 |
|
|
} else {my ($self) = @_; |
4857 |
|
|
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'; |
4858 |
|
|
} |
4859 |
|
|
} |
4860 |
|
|
sub implementation ($;$) { |
4861 |
|
|
if (@_ == 1) {my ($self) = @_; |
4862 |
|
|
my $r; |
4863 |
|
|
|
4864 |
|
|
{ |
4865 |
|
|
|
4866 |
|
|
|
4867 |
|
|
{ |
4868 |
|
|
|
4869 |
|
|
my |
4870 |
|
|
$__v = $self->{ |
4871 |
|
|
'b' |
4872 |
|
|
}->{${$self->{ |
4873 |
|
|
'id' |
4874 |
|
|
}}} |
4875 |
|
|
->{'impl'}; |
4876 |
|
|
if (defined $__v) { |
4877 |
|
|
|
4878 |
|
|
|
4879 |
|
|
{ |
4880 |
|
|
|
4881 |
|
|
|
4882 |
|
|
$r = ${$self->{'b'}->{${$__v}}->{ |
4883 |
|
|
'cls' |
4884 |
|
|
}}->___create_node_ref ({ |
4885 |
|
|
|
4886 |
|
|
'id' |
4887 |
|
|
=> $__v, |
4888 |
|
|
|
4889 |
|
|
'b' |
4890 |
|
|
=> $self->{'b'}, |
4891 |
|
|
}, { |
4892 |
|
|
'nrifs' => ['Message::DOM::IFLatest::DOMImplementation'], |
4893 |
|
|
}); |
4894 |
|
|
$self->{'b'}->{${$__v}}->{ |
4895 |
|
|
'rc' |
4896 |
|
|
}++; |
4897 |
|
|
|
4898 |
|
|
|
4899 |
|
|
;} |
4900 |
|
|
|
4901 |
|
|
; |
4902 |
|
|
} |
4903 |
|
|
|
4904 |
|
|
|
4905 |
|
|
;} |
4906 |
|
|
|
4907 |
|
|
; |
4908 |
|
|
|
4909 |
|
|
|
4910 |
|
|
;} |
4911 |
|
|
$r; |
4912 |
|
|
} else {my ($self) = @_; |
4913 |
|
|
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'; |
4914 |
|
|
} |
4915 |
|
|
} |
4916 |
|
|
sub xml_version ($;$) { |
4917 |
|
|
if (@_ == 1) {my ($self) = @_; |
4918 |
|
|
my $r = ''; |
4919 |
|
|
|
4920 |
|
|
{ |
4921 |
|
|
|
4922 |
|
|
|
4923 |
|
|
{ |
4924 |
|
|
|
4925 |
|
|
|
4926 |
|
|
$r = $self->{ |
4927 |
|
|
'b' |
4928 |
|
|
}->{${$self->{ |
4929 |
|
|
'id' |
4930 |
|
|
}}} |
4931 |
|
|
->{'http://www.w3.org/2001/04/infoset#version'}; |
4932 |
|
|
|
4933 |
|
|
|
4934 |
|
|
;} |
4935 |
|
|
|
4936 |
|
|
; |
4937 |
|
|
$r = '1.0' unless defined $r; |
4938 |
|
|
|
4939 |
|
|
|
4940 |
|
|
;} |
4941 |
|
|
$r; |
4942 |
|
|
} else {my ($self, $given) = @_; |
4943 |
|
|
|
4944 |
|
|
{ |
4945 |
|
|
|
4946 |
|
|
|
4947 |
|
|
{ |
4948 |
|
|
|
4949 |
|
|
if |
4950 |
|
|
($self-> |
4951 |
|
|
manakai_read_only |
4952 |
|
|
) { |
4953 |
|
|
|
4954 |
|
|
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'; |
4955 |
|
|
|
4956 |
|
|
; |
4957 |
|
|
} |
4958 |
|
|
|
4959 |
|
|
|
4960 |
|
|
;} |
4961 |
|
|
|
4962 |
|
|
; |
4963 |
|
|
if (defined $given and |
4964 |
|
|
($given eq '1.0' or $given eq '1.1' or |
4965 |
|
|
not $self-> |
4966 |
|
|
strict_error_checking |
4967 |
|
|
)) { |
4968 |
|
|
|
4969 |
|
|
|
4970 |
|
|
{ |
4971 |
|
|
|
4972 |
|
|
|
4973 |
|
|
$self->{ |
4974 |
|
|
'b' |
4975 |
|
|
}->{${$self->{ |
4976 |
|
|
'id' |
4977 |
|
|
}}} |
4978 |
|
|
->{'http://www.w3.org/2001/04/infoset#version'} = $given; |
4979 |
|
|
|
4980 |
|
|
|
4981 |
|
|
;} |
4982 |
|
|
|
4983 |
|
|
; |
4984 |
|
|
} else { |
4985 |
|
|
|
4986 |
|
|
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; |
4987 |
|
|
|
4988 |
|
|
; |
4989 |
|
|
} |
4990 |
|
|
|
4991 |
|
|
|
4992 |
|
|
;} |
4993 |
|
|
} |
4994 |
|
|
} |
4995 |
|
|
sub doctype ($;$) { |
4996 |
|
|
if (@_ == 1) {my ($self) = @_; |
4997 |
|
|
my $r; |
4998 |
|
|
|
4999 |
|
|
{ |
5000 |
|
|
|
5001 |
|
|
|
5002 |
|
|
{ |
5003 |
|
|
|
5004 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5005 |
|
|
|
5006 |
|
|
{ |
5007 |
|
|
|
5008 |
|
|
|
5009 |
|
|
F: |
5010 |
|
|
for my $child (@{$self-> |
5011 |
|
|
child_nodes |
5012 |
|
|
}) { |
5013 |
|
|
my $nt = $child-> |
5014 |
|
|
node_type |
5015 |
|
|
; |
5016 |
|
|
if ($nt == |
5017 |
|
|
10 |
5018 |
|
|
) { |
5019 |
|
|
$r = $child; |
5020 |
|
|
last F; |
5021 |
|
|
} elsif ($nt == |
5022 |
|
|
1 |
5023 |
|
|
) { # document element |
5024 |
|
|
last F; |
5025 |
|
|
} |
5026 |
|
|
} # F |
5027 |
|
|
|
5028 |
|
|
|
5029 |
|
|
|
5030 |
|
|
;} |
5031 |
|
|
|
5032 |
|
|
|
5033 |
|
|
;} |
5034 |
|
|
|
5035 |
|
|
; |
5036 |
|
|
|
5037 |
|
|
|
5038 |
|
|
;} |
5039 |
|
|
$r; |
5040 |
|
|
} else {my ($self) = @_; |
5041 |
|
|
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'; |
5042 |
|
|
} |
5043 |
|
|
} |
5044 |
|
|
sub document_uri ($;$) { |
5045 |
|
|
if (@_ == 1) {my ($self) = @_; |
5046 |
|
|
my $r = ''; |
5047 |
|
|
|
5048 |
|
|
{ |
5049 |
|
|
|
5050 |
|
|
|
5051 |
|
|
{ |
5052 |
|
|
|
5053 |
|
|
|
5054 |
|
|
$r = $self->{ |
5055 |
|
|
'b' |
5056 |
|
|
}->{${$self->{ |
5057 |
|
|
'id' |
5058 |
|
|
}}} |
5059 |
|
|
->{'duri'}; |
5060 |
|
|
|
5061 |
|
|
|
5062 |
|
|
;} |
5063 |
|
|
|
5064 |
|
|
; |
5065 |
|
|
|
5066 |
|
|
|
5067 |
|
|
;} |
5068 |
|
|
$r; |
5069 |
|
|
} else {my ($self, $given) = @_; |
5070 |
|
|
|
5071 |
|
|
{ |
5072 |
|
|
|
5073 |
|
|
|
5074 |
|
|
{ |
5075 |
|
|
|
5076 |
|
|
if |
5077 |
|
|
($self-> |
5078 |
|
|
manakai_read_only |
5079 |
|
|
) { |
5080 |
|
|
|
5081 |
|
|
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'; |
5082 |
|
|
|
5083 |
|
|
; |
5084 |
|
|
} |
5085 |
|
|
|
5086 |
|
|
|
5087 |
|
|
;} |
5088 |
|
|
|
5089 |
|
|
; |
5090 |
|
|
|
5091 |
|
|
|
5092 |
|
|
{ |
5093 |
|
|
|
5094 |
|
|
|
5095 |
|
|
$self->{ |
5096 |
|
|
'b' |
5097 |
|
|
}->{${$self->{ |
5098 |
|
|
'id' |
5099 |
|
|
}}} |
5100 |
|
|
->{'duri'} = $given; |
5101 |
|
|
|
5102 |
|
|
|
5103 |
|
|
;} |
5104 |
|
|
|
5105 |
|
|
; |
5106 |
|
|
|
5107 |
|
|
|
5108 |
|
|
;} |
5109 |
|
|
} |
5110 |
|
|
} |
5111 |
|
|
sub input_encoding ($;$) { |
5112 |
|
|
if (@_ == 1) {my ($self) = @_; |
5113 |
|
|
my $r = ''; |
5114 |
|
|
|
5115 |
|
|
{ |
5116 |
|
|
|
5117 |
|
|
|
5118 |
|
|
{ |
5119 |
|
|
|
5120 |
|
|
|
5121 |
|
|
$r = $self->{ |
5122 |
|
|
'b' |
5123 |
|
|
}->{${$self->{ |
5124 |
|
|
'id' |
5125 |
|
|
}}} |
5126 |
|
|
->{'ces'}; |
5127 |
|
|
|
5128 |
|
|
|
5129 |
|
|
;} |
5130 |
|
|
|
5131 |
|
|
; |
5132 |
|
|
|
5133 |
|
|
|
5134 |
|
|
;} |
5135 |
|
|
$r; |
5136 |
|
|
} else {my ($self, $given) = @_; |
5137 |
|
|
|
5138 |
|
|
{ |
5139 |
|
|
|
5140 |
|
|
|
5141 |
|
|
{ |
5142 |
|
|
|
5143 |
|
|
if |
5144 |
|
|
($self-> |
5145 |
|
|
manakai_read_only |
5146 |
|
|
) { |
5147 |
|
|
|
5148 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#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'; |
5149 |
|
|
|
5150 |
|
|
; |
5151 |
|
|
} |
5152 |
|
|
|
5153 |
|
|
|
5154 |
|
|
;} |
5155 |
|
|
|
5156 |
|
|
; |
5157 |
|
|
|
5158 |
|
|
|
5159 |
|
|
{ |
5160 |
|
|
|
5161 |
|
|
|
5162 |
|
|
$self->{ |
5163 |
|
|
'b' |
5164 |
|
|
}->{${$self->{ |
5165 |
|
|
'id' |
5166 |
|
|
}}} |
5167 |
|
|
->{'ces'} = $given; |
5168 |
|
|
|
5169 |
|
|
|
5170 |
|
|
;} |
5171 |
|
|
|
5172 |
|
|
; |
5173 |
|
|
|
5174 |
|
|
|
5175 |
|
|
;} |
5176 |
|
|
} |
5177 |
|
|
} |
5178 |
|
|
sub xml_encoding ($;$) { |
5179 |
|
|
if (@_ == 1) {my ($self) = @_; |
5180 |
|
|
my $r = ''; |
5181 |
|
|
|
5182 |
|
|
{ |
5183 |
|
|
|
5184 |
|
|
|
5185 |
|
|
{ |
5186 |
|
|
|
5187 |
|
|
|
5188 |
|
|
$r = $self->{ |
5189 |
|
|
'b' |
5190 |
|
|
}->{${$self->{ |
5191 |
|
|
'id' |
5192 |
|
|
}}} |
5193 |
|
|
->{'xcs'}; |
5194 |
|
|
|
5195 |
|
|
|
5196 |
|
|
;} |
5197 |
|
|
|
5198 |
|
|
; |
5199 |
|
|
|
5200 |
|
|
|
5201 |
|
|
;} |
5202 |
|
|
$r; |
5203 |
|
|
} else {my ($self, $given) = @_; |
5204 |
|
|
|
5205 |
|
|
{ |
5206 |
|
|
|
5207 |
|
|
|
5208 |
|
|
{ |
5209 |
|
|
|
5210 |
|
|
if |
5211 |
|
|
($self-> |
5212 |
|
|
manakai_read_only |
5213 |
|
|
) { |
5214 |
|
|
|
5215 |
|
|
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'; |
5216 |
|
|
|
5217 |
|
|
; |
5218 |
|
|
} |
5219 |
|
|
|
5220 |
|
|
|
5221 |
|
|
;} |
5222 |
|
|
|
5223 |
|
|
; |
5224 |
|
|
|
5225 |
|
|
|
5226 |
|
|
{ |
5227 |
|
|
|
5228 |
|
|
|
5229 |
|
|
$self->{ |
5230 |
|
|
'b' |
5231 |
|
|
}->{${$self->{ |
5232 |
|
|
'id' |
5233 |
|
|
}}} |
5234 |
|
|
->{'xcs'} = $given; |
5235 |
|
|
|
5236 |
|
|
|
5237 |
|
|
;} |
5238 |
|
|
|
5239 |
|
|
; |
5240 |
|
|
|
5241 |
|
|
|
5242 |
|
|
;} |
5243 |
|
|
} |
5244 |
|
|
} |
5245 |
|
|
sub xml_standalone ($;$) { |
5246 |
|
|
if (@_ == 1) {my ($self) = @_; |
5247 |
|
|
my $r = 0; |
5248 |
|
|
|
5249 |
|
|
{ |
5250 |
|
|
|
5251 |
|
|
|
5252 |
|
|
{ |
5253 |
|
|
|
5254 |
|
|
|
5255 |
|
|
$r = $self->{ |
5256 |
|
|
'b' |
5257 |
|
|
}->{${$self->{ |
5258 |
|
|
'id' |
5259 |
|
|
}}} |
5260 |
|
|
->{'http://www.w3.org/2001/04/infoset#standalone'}; |
5261 |
|
|
|
5262 |
|
|
|
5263 |
|
|
;} |
5264 |
|
|
|
5265 |
|
|
; |
5266 |
|
|
|
5267 |
|
|
|
5268 |
|
|
;} |
5269 |
|
|
$r; |
5270 |
|
|
} else {my ($self, $given) = @_; |
5271 |
|
|
|
5272 |
|
|
{ |
5273 |
|
|
|
5274 |
|
|
|
5275 |
|
|
{ |
5276 |
|
|
|
5277 |
|
|
if |
5278 |
|
|
($self-> |
5279 |
|
|
manakai_read_only |
5280 |
|
|
) { |
5281 |
|
|
|
5282 |
|
|
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'; |
5283 |
|
|
|
5284 |
|
|
; |
5285 |
|
|
} |
5286 |
|
|
|
5287 |
|
|
|
5288 |
|
|
;} |
5289 |
|
|
|
5290 |
|
|
; |
5291 |
|
|
|
5292 |
|
|
|
5293 |
|
|
{ |
5294 |
|
|
|
5295 |
|
|
|
5296 |
|
|
$self->{ |
5297 |
|
|
'b' |
5298 |
|
|
}->{${$self->{ |
5299 |
|
|
'id' |
5300 |
|
|
}}} |
5301 |
|
|
->{'http://www.w3.org/2001/04/infoset#standalone'} = $given; |
5302 |
|
|
|
5303 |
|
|
|
5304 |
|
|
;} |
5305 |
|
|
|
5306 |
|
|
; |
5307 |
|
|
|
5308 |
|
|
|
5309 |
|
|
;} |
5310 |
|
|
} |
5311 |
|
|
} |
5312 |
|
|
sub adopt_node ($$) { |
5313 |
|
|
my ($self, $source) = @_; |
5314 |
|
|
my $r; |
5315 |
|
|
|
5316 |
|
|
{ |
5317 |
|
|
|
5318 |
|
|
if |
5319 |
|
|
($source->isa ( |
5320 |
|
|
'Message::DOM::TreeCore::ManakaiDOMNode' |
5321 |
|
|
) and |
5322 |
|
|
|
5323 |
|
|
$self->{'b'} |
5324 |
|
|
eq |
5325 |
|
|
|
5326 |
|
|
$source->{'b'} |
5327 |
|
|
) { |
5328 |
wakaba |
1.2 |
my $strict = $self-> |
5329 |
|
|
strict_error_checking |
5330 |
|
|
; |
5331 |
|
|
if ($strict and $self-> |
5332 |
wakaba |
1.1 |
manakai_read_only |
5333 |
|
|
) { |
5334 |
|
|
|
5335 |
|
|
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'; |
5336 |
|
|
|
5337 |
|
|
; |
5338 |
|
|
} |
5339 |
|
|
my $parent = $source-> |
5340 |
|
|
parent_node |
5341 |
|
|
; |
5342 |
wakaba |
1.2 |
if ($strict and defined $parent and |
5343 |
|
|
$parent-> |
5344 |
wakaba |
1.1 |
manakai_read_only |
5345 |
|
|
) { |
5346 |
|
|
|
5347 |
|
|
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'; |
5348 |
|
|
|
5349 |
|
|
; |
5350 |
|
|
} |
5351 |
|
|
my $nt = $source-> |
5352 |
|
|
node_type |
5353 |
|
|
; |
5354 |
|
|
my $oe; |
5355 |
|
|
if ($nt == |
5356 |
|
|
2 |
5357 |
|
|
) { |
5358 |
|
|
$oe = $source-> |
5359 |
|
|
owner_element |
5360 |
|
|
; |
5361 |
wakaba |
1.2 |
if ($strict and defined $oe and $oe-> |
5362 |
wakaba |
1.1 |
manakai_read_only |
5363 |
|
|
) { |
5364 |
|
|
|
5365 |
|
|
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'; |
5366 |
|
|
|
5367 |
|
|
; |
5368 |
|
|
} |
5369 |
|
|
} elsif ($nt == |
5370 |
|
|
9 or |
5371 |
|
|
|
5372 |
|
|
$nt == |
5373 |
|
|
10 or |
5374 |
|
|
|
5375 |
|
|
$nt == |
5376 |
|
|
6 or |
5377 |
|
|
|
5378 |
|
|
$nt == |
5379 |
|
|
12 |
5380 |
|
|
) { |
5381 |
|
|
|
5382 |
|
|
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'; |
5383 |
|
|
|
5384 |
|
|
; |
5385 |
|
|
} |
5386 |
|
|
|
5387 |
|
|
my @change_od; |
5388 |
|
|
my @nodes = ($source); |
5389 |
|
|
while (@nodes) { |
5390 |
|
|
my $node = shift @nodes; |
5391 |
|
|
my $nt = $node-> |
5392 |
|
|
node_type |
5393 |
|
|
; |
5394 |
wakaba |
1.2 |
if ($strict and $node-> |
5395 |
wakaba |
1.1 |
manakai_read_only |
5396 |
|
|
) { |
5397 |
|
|
|
5398 |
|
|
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; |
5399 |
|
|
|
5400 |
|
|
; |
5401 |
|
|
} |
5402 |
|
|
if ($nt == |
5403 |
|
|
1 |
5404 |
|
|
) { |
5405 |
|
|
push @change_od, $node; |
5406 |
|
|
push @nodes, @{$node-> |
5407 |
|
|
child_nodes |
5408 |
|
|
}; |
5409 |
|
|
my $attrs = $node-> |
5410 |
|
|
attributes |
5411 |
|
|
; |
5412 |
|
|
my $attrsLength = $attrs-> |
5413 |
|
|
length |
5414 |
|
|
; |
5415 |
|
|
for my $i (0..($attrsLength - 1)) { |
5416 |
|
|
push @nodes, $attrs-> |
5417 |
|
|
item |
5418 |
|
|
($i); |
5419 |
|
|
} |
5420 |
|
|
} elsif ($nt == |
5421 |
|
|
2 or |
5422 |
|
|
|
5423 |
|
|
$nt == |
5424 |
|
|
5 or |
5425 |
|
|
|
5426 |
|
|
$nt == |
5427 |
|
|
11 |
5428 |
|
|
) { |
5429 |
|
|
push @change_od, $node; |
5430 |
|
|
push @nodes, @{$node-> |
5431 |
|
|
child_nodes |
5432 |
|
|
}; |
5433 |
|
|
} elsif ($nt == |
5434 |
|
|
3 or |
5435 |
|
|
|
5436 |
|
|
$nt == |
5437 |
|
|
8 or |
5438 |
|
|
|
5439 |
|
|
$nt == |
5440 |
|
|
7 or |
5441 |
|
|
|
5442 |
|
|
$nt == |
5443 |
|
|
4 |
5444 |
|
|
) { |
5445 |
|
|
push @change_od, $node; |
5446 |
|
|
} else { |
5447 |
|
|
## TODO: assertion |
5448 |
|
|
} |
5449 |
|
|
} # nodes |
5450 |
|
|
|
5451 |
wakaba |
1.2 |
|
5452 |
wakaba |
1.1 |
|
5453 |
|
|
{ |
5454 |
|
|
|
5455 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5456 |
|
|
|
5457 |
|
|
{ |
5458 |
|
|
|
5459 |
|
|
|
5460 |
wakaba |
1.2 |
if |
5461 |
|
|
(defined $parent) { |
5462 |
wakaba |
1.1 |
$parent-> |
5463 |
|
|
remove_child |
5464 |
|
|
($source); |
5465 |
wakaba |
1.2 |
} elsif (defined $oe) { |
5466 |
wakaba |
1.1 |
$oe-> |
5467 |
|
|
remove_attribute_node |
5468 |
|
|
($source); |
5469 |
wakaba |
1.2 |
} |
5470 |
|
|
|
5471 |
wakaba |
1.1 |
|
5472 |
|
|
|
5473 |
|
|
;} |
5474 |
|
|
|
5475 |
|
|
|
5476 |
|
|
;} |
5477 |
|
|
|
5478 |
|
|
; |
5479 |
|
|
|
5480 |
|
|
my $old_od = $change_od[0]-> |
5481 |
|
|
owner_document |
5482 |
|
|
; |
5483 |
|
|
## NOTE: The array must have more than zero |
5484 |
|
|
## nodes by definition. In addition, |
5485 |
|
|
## it cannot contain document or document |
5486 |
|
|
## type nodes in current implementation. |
5487 |
|
|
my $old_od_list; |
5488 |
|
|
|
5489 |
|
|
|
5490 |
|
|
{ |
5491 |
|
|
|
5492 |
|
|
|
5493 |
|
|
$old_od_list = $old_od->{ |
5494 |
|
|
'b' |
5495 |
|
|
}->{${$old_od->{ |
5496 |
|
|
'id' |
5497 |
|
|
}}} |
5498 |
|
|
->{'do'}; |
5499 |
|
|
|
5500 |
|
|
|
5501 |
|
|
;} |
5502 |
|
|
|
5503 |
|
|
; |
5504 |
|
|
my $new_od_list; |
5505 |
|
|
|
5506 |
|
|
|
5507 |
|
|
{ |
5508 |
|
|
|
5509 |
|
|
|
5510 |
|
|
$new_od_list = $self->{ |
5511 |
|
|
'b' |
5512 |
|
|
}->{${$self->{ |
5513 |
|
|
'id' |
5514 |
|
|
}}} |
5515 |
|
|
->{'do'}; |
5516 |
|
|
|
5517 |
|
|
|
5518 |
|
|
;} |
5519 |
|
|
|
5520 |
|
|
; |
5521 |
|
|
for my $n (@change_od) { |
5522 |
|
|
|
5523 |
|
|
|
5524 |
|
|
{ |
5525 |
|
|
|
5526 |
|
|
|
5527 |
|
|
$n->{ |
5528 |
|
|
'b' |
5529 |
|
|
}->{${$n->{ |
5530 |
|
|
'id' |
5531 |
|
|
}}} |
5532 |
|
|
->{'od'} = $self->{ |
5533 |
|
|
'id' |
5534 |
|
|
}; |
5535 |
|
|
|
5536 |
|
|
|
5537 |
|
|
;} |
5538 |
|
|
|
5539 |
|
|
; |
5540 |
|
|
my $nid = |
5541 |
|
|
$n->{'id'} |
5542 |
|
|
; |
5543 |
|
|
CORE::delete $old_od_list->{$$nid}; |
5544 |
|
|
$new_od_list->{$$nid} = $nid; |
5545 |
|
|
} |
5546 |
|
|
|
5547 |
|
|
for my $src (@change_od) { |
5548 |
|
|
my $src_ud; |
5549 |
|
|
|
5550 |
|
|
|
5551 |
|
|
{ |
5552 |
|
|
|
5553 |
|
|
|
5554 |
|
|
$src_ud = $src->{ |
5555 |
|
|
'b' |
5556 |
|
|
}->{${$src->{ |
5557 |
|
|
'id' |
5558 |
|
|
}}} |
5559 |
|
|
->{'ud'}; |
5560 |
|
|
|
5561 |
|
|
|
5562 |
|
|
;} |
5563 |
|
|
|
5564 |
|
|
; |
5565 |
|
|
for my $key (keys %{$src_ud or {}}) { |
5566 |
|
|
my $dh = $src_ud->{$key}->[1]; |
5567 |
|
|
if ($dh) { |
5568 |
|
|
$dh-> |
5569 |
|
|
handle |
5570 |
|
|
|
5571 |
|
|
( |
5572 |
|
|
5 |
5573 |
|
|
, |
5574 |
|
|
$key, $src_ud->{$key}->[0], $src, |
5575 |
|
|
undef |
5576 |
|
|
); |
5577 |
|
|
} |
5578 |
|
|
} |
5579 |
|
|
} |
5580 |
|
|
$r = $source; |
5581 |
|
|
} # compatible class |
5582 |
|
|
|
5583 |
|
|
|
5584 |
|
|
;} |
5585 |
|
|
$r} |
5586 |
|
|
sub get_element_by_id ($$) { |
5587 |
|
|
my ($self, $elementId) = @_; |
5588 |
|
|
my $r; |
5589 |
|
|
|
5590 |
|
|
{ |
5591 |
|
|
|
5592 |
|
|
|
5593 |
|
|
{ |
5594 |
|
|
|
5595 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5596 |
|
|
|
5597 |
|
|
{ |
5598 |
|
|
|
5599 |
|
|
|
5600 |
|
|
my |
5601 |
|
|
@nodes = @{$self-> |
5602 |
|
|
child_nodes |
5603 |
|
|
}; |
5604 |
|
|
N: while (@nodes) { |
5605 |
|
|
my $node = shift @nodes; |
5606 |
|
|
next N unless $node-> |
5607 |
|
|
node_type |
5608 |
|
|
== |
5609 |
|
|
1 |
5610 |
|
|
; |
5611 |
|
|
for my $attr (@{$node-> |
5612 |
|
|
attributes |
5613 |
|
|
}) { |
5614 |
|
|
if ($attr-> |
5615 |
|
|
is_id and |
5616 |
|
|
|
5617 |
|
|
$attr-> |
5618 |
|
|
value eq |
5619 |
|
|
$elementId) { |
5620 |
|
|
$r = $attr; |
5621 |
|
|
last N; |
5622 |
|
|
} |
5623 |
|
|
} |
5624 |
|
|
unshift @nodes, @{$node-> |
5625 |
|
|
child_nodes |
5626 |
|
|
}; |
5627 |
|
|
} # N |
5628 |
|
|
|
5629 |
|
|
|
5630 |
|
|
|
5631 |
|
|
;} |
5632 |
|
|
|
5633 |
|
|
|
5634 |
|
|
;} |
5635 |
|
|
|
5636 |
|
|
; |
5637 |
|
|
|
5638 |
|
|
|
5639 |
|
|
;} |
5640 |
|
|
$r} |
5641 |
|
|
sub get_elements_by_tag_name ($$) { |
5642 |
|
|
my ($self, $name) = @_; |
5643 |
|
|
my $r; |
5644 |
|
|
|
5645 |
|
|
{ |
5646 |
|
|
|
5647 |
|
|
|
5648 |
|
|
$name = "$name"; |
5649 |
|
|
my $chk; |
5650 |
|
|
if ($name eq '*') { |
5651 |
|
|
$chk = sub { |
5652 |
|
|
1 |
5653 |
|
|
}; |
5654 |
|
|
} else { |
5655 |
|
|
$chk = sub { |
5656 |
|
|
my $node = shift; |
5657 |
|
|
my $nodeName = $node-> |
5658 |
|
|
node_name |
5659 |
|
|
; |
5660 |
|
|
($nodeName eq $name); |
5661 |
|
|
}; |
5662 |
|
|
} |
5663 |
|
|
|
5664 |
|
|
|
5665 |
|
|
{ |
5666 |
|
|
|
5667 |
|
|
|
5668 |
|
|
$r = bless \[$self, $chk], |
5669 |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
5670 |
|
|
; |
5671 |
|
|
|
5672 |
|
|
|
5673 |
|
|
;} |
5674 |
|
|
|
5675 |
|
|
; |
5676 |
|
|
|
5677 |
|
|
|
5678 |
|
|
;} |
5679 |
|
|
$r} |
5680 |
|
|
sub get_elements_by_tag_name_ns ($$$) { |
5681 |
|
|
my ($self, $namespaceURI, $localName) = @_; |
5682 |
|
|
|
5683 |
|
|
{ |
5684 |
|
|
|
5685 |
|
|
if |
5686 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
5687 |
|
|
|
5688 |
|
|
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:1143811080:18264:zbjED29418+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
5689 |
|
|
|
5690 |
|
|
; |
5691 |
|
|
|
5692 |
|
|
|
5693 |
|
|
|
5694 |
|
|
{ |
5695 |
|
|
|
5696 |
|
|
|
5697 |
|
|
$namespaceURI = undef; |
5698 |
|
|
|
5699 |
|
|
|
5700 |
|
|
|
5701 |
|
|
;} |
5702 |
|
|
|
5703 |
|
|
; |
5704 |
|
|
} |
5705 |
|
|
|
5706 |
|
|
|
5707 |
|
|
;} |
5708 |
|
|
my $r; |
5709 |
|
|
|
5710 |
|
|
{ |
5711 |
|
|
|
5712 |
|
|
|
5713 |
|
|
$namespaceURI = "$namespaceURI" if defined $namespaceURI; |
5714 |
|
|
$localName = "$localName"; |
5715 |
|
|
my $chk; |
5716 |
|
|
if (not defined $namespaceURI) { |
5717 |
|
|
if ($localName eq '*') { |
5718 |
|
|
$chk = sub { |
5719 |
|
|
my $node = shift; |
5720 |
|
|
(not defined $node-> |
5721 |
|
|
namespace_uri |
5722 |
|
|
); |
5723 |
|
|
}; |
5724 |
|
|
} else { |
5725 |
|
|
$chk = sub { |
5726 |
|
|
my $node = shift; |
5727 |
|
|
(not defined $node-> |
5728 |
|
|
namespace_uri and |
5729 |
|
|
|
5730 |
|
|
$node-> |
5731 |
|
|
local_name eq |
5732 |
|
|
$localName); |
5733 |
|
|
}; |
5734 |
|
|
} |
5735 |
|
|
} elsif ($namespaceURI eq '*') { |
5736 |
|
|
if ($localName eq '*') { |
5737 |
|
|
$chk = sub { |
5738 |
|
|
1 |
5739 |
|
|
}; |
5740 |
|
|
} else { |
5741 |
|
|
$chk = sub { |
5742 |
|
|
my $node = shift; |
5743 |
|
|
($node-> |
5744 |
|
|
local_name eq |
5745 |
|
|
$localName); |
5746 |
|
|
}; |
5747 |
|
|
} |
5748 |
|
|
} else { |
5749 |
|
|
if ($localName eq '*') { |
5750 |
|
|
$chk = sub { |
5751 |
|
|
my $node = shift; |
5752 |
|
|
my $nsuri = $node-> |
5753 |
|
|
namespace_uri |
5754 |
|
|
; |
5755 |
|
|
(defined $nsuri and $nsuri eq $namespaceURI); |
5756 |
|
|
}; |
5757 |
|
|
} else { |
5758 |
|
|
$chk = sub { |
5759 |
|
|
my $node = shift; |
5760 |
|
|
my $nsuri = $node-> |
5761 |
|
|
namespace_uri |
5762 |
|
|
; |
5763 |
|
|
(defined $nsuri and $nsuri eq $namespaceURI and |
5764 |
|
|
$node-> |
5765 |
|
|
local_name eq |
5766 |
|
|
$localName); |
5767 |
|
|
}; |
5768 |
|
|
} |
5769 |
|
|
} |
5770 |
|
|
|
5771 |
|
|
|
5772 |
|
|
{ |
5773 |
|
|
|
5774 |
|
|
|
5775 |
|
|
$r = bless \[$self, $chk], |
5776 |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
5777 |
|
|
; |
5778 |
|
|
|
5779 |
|
|
|
5780 |
|
|
;} |
5781 |
|
|
|
5782 |
|
|
; |
5783 |
|
|
|
5784 |
|
|
|
5785 |
|
|
;} |
5786 |
|
|
$r} |
5787 |
|
|
sub import_node ($$;$) { |
5788 |
|
|
my ($self, $importedNode, $deep) = @_; |
5789 |
|
|
my $r; |
5790 |
|
|
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'; |
5791 |
|
|
$r} |
5792 |
|
|
sub normalize_document ($) { |
5793 |
|
|
my ($self) = @_; |
5794 |
|
|
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'; |
5795 |
|
|
} |
5796 |
|
|
sub rename_node ($$$$) { |
5797 |
|
|
my ($self, $n, $namespaceURI, $qualifiedName) = @_; |
5798 |
|
|
|
5799 |
|
|
{ |
5800 |
|
|
|
5801 |
|
|
if |
5802 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
5803 |
|
|
|
5804 |
|
|
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:1143811080:18264:zbjED29418+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
5805 |
|
|
|
5806 |
|
|
; |
5807 |
|
|
|
5808 |
|
|
|
5809 |
|
|
|
5810 |
|
|
{ |
5811 |
|
|
|
5812 |
|
|
|
5813 |
|
|
$namespaceURI = undef; |
5814 |
|
|
|
5815 |
|
|
|
5816 |
|
|
|
5817 |
|
|
;} |
5818 |
|
|
|
5819 |
|
|
; |
5820 |
|
|
} |
5821 |
|
|
|
5822 |
|
|
|
5823 |
|
|
;} |
5824 |
|
|
my $r; |
5825 |
|
|
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'; |
5826 |
|
|
$r} |
5827 |
|
|
sub manakai_entity_base_uri ($;$) { |
5828 |
|
|
if (@_ == 1) {my ($self) = @_; |
5829 |
|
|
my $r = ''; |
5830 |
|
|
|
5831 |
|
|
{ |
5832 |
|
|
|
5833 |
|
|
|
5834 |
|
|
{ |
5835 |
|
|
|
5836 |
|
|
|
5837 |
|
|
$r = $self->{ |
5838 |
|
|
'b' |
5839 |
|
|
}->{${$self->{ |
5840 |
|
|
'id' |
5841 |
|
|
}}} |
5842 |
|
|
->{'buri'}; |
5843 |
|
|
|
5844 |
|
|
|
5845 |
|
|
;} |
5846 |
|
|
|
5847 |
|
|
; |
5848 |
|
|
unless (defined $r) { |
5849 |
|
|
|
5850 |
|
|
|
5851 |
|
|
{ |
5852 |
|
|
|
5853 |
|
|
|
5854 |
|
|
$r = $self->{ |
5855 |
|
|
'b' |
5856 |
|
|
}->{${$self->{ |
5857 |
|
|
'id' |
5858 |
|
|
}}} |
5859 |
|
|
->{'duri'}; |
5860 |
|
|
|
5861 |
|
|
|
5862 |
|
|
;} |
5863 |
|
|
|
5864 |
|
|
; |
5865 |
|
|
} |
5866 |
|
|
|
5867 |
|
|
|
5868 |
|
|
;} |
5869 |
|
|
$r; |
5870 |
|
|
} else {my ($self, $given) = @_; |
5871 |
|
|
|
5872 |
|
|
{ |
5873 |
|
|
|
5874 |
|
|
|
5875 |
|
|
{ |
5876 |
|
|
|
5877 |
|
|
if |
5878 |
|
|
($self-> |
5879 |
|
|
manakai_read_only |
5880 |
|
|
) { |
5881 |
|
|
|
5882 |
|
|
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'; |
5883 |
|
|
|
5884 |
|
|
; |
5885 |
|
|
} |
5886 |
|
|
|
5887 |
|
|
|
5888 |
|
|
;} |
5889 |
|
|
|
5890 |
|
|
; |
5891 |
|
|
|
5892 |
|
|
|
5893 |
|
|
{ |
5894 |
|
|
|
5895 |
|
|
|
5896 |
|
|
$self->{ |
5897 |
|
|
'b' |
5898 |
|
|
}->{${$self->{ |
5899 |
|
|
'id' |
5900 |
|
|
}}} |
5901 |
|
|
->{'buri'} = $given; |
5902 |
|
|
|
5903 |
|
|
|
5904 |
|
|
;} |
5905 |
|
|
|
5906 |
|
|
; |
5907 |
|
|
|
5908 |
|
|
|
5909 |
|
|
;} |
5910 |
|
|
} |
5911 |
|
|
} |
5912 |
|
|
sub all_declarations_processed ($;$) { |
5913 |
|
|
if (@_ == 1) {my ($self) = @_; |
5914 |
|
|
my $r = 0; |
5915 |
|
|
|
5916 |
|
|
{ |
5917 |
|
|
|
5918 |
|
|
|
5919 |
|
|
{ |
5920 |
|
|
|
5921 |
|
|
|
5922 |
|
|
$r = $self->{ |
5923 |
|
|
'b' |
5924 |
|
|
}->{${$self->{ |
5925 |
|
|
'id' |
5926 |
|
|
}}} |
5927 |
|
|
->{'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed'}; |
5928 |
|
|
|
5929 |
|
|
|
5930 |
|
|
;} |
5931 |
|
|
|
5932 |
|
|
; |
5933 |
|
|
|
5934 |
|
|
|
5935 |
|
|
;} |
5936 |
|
|
$r; |
5937 |
|
|
} else {my ($self, $given) = @_; |
5938 |
|
|
|
5939 |
|
|
{ |
5940 |
|
|
|
5941 |
|
|
|
5942 |
|
|
{ |
5943 |
|
|
|
5944 |
|
|
if |
5945 |
|
|
($self-> |
5946 |
|
|
manakai_read_only |
5947 |
|
|
) { |
5948 |
|
|
|
5949 |
|
|
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'; |
5950 |
|
|
|
5951 |
|
|
; |
5952 |
|
|
} |
5953 |
|
|
|
5954 |
|
|
|
5955 |
|
|
;} |
5956 |
|
|
|
5957 |
|
|
; |
5958 |
|
|
|
5959 |
|
|
|
5960 |
|
|
{ |
5961 |
|
|
|
5962 |
|
|
|
5963 |
|
|
$self->{ |
5964 |
|
|
'b' |
5965 |
|
|
}->{${$self->{ |
5966 |
|
|
'id' |
5967 |
|
|
}}} |
5968 |
|
|
->{'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed'} = $given; |
5969 |
|
|
|
5970 |
|
|
|
5971 |
|
|
;} |
5972 |
|
|
|
5973 |
|
|
; |
5974 |
|
|
|
5975 |
|
|
|
5976 |
|
|
;} |
5977 |
|
|
} |
5978 |
|
|
} |
5979 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocument>}->{has_feature} = {'core', |
5980 |
|
|
{'', |
5981 |
|
|
'1', |
5982 |
|
|
'1.0', |
5983 |
|
|
'1', |
5984 |
|
|
'2.0', |
5985 |
|
|
'1', |
5986 |
|
|
'3.0', |
5987 |
|
|
'1'}, |
5988 |
|
|
'xml', |
5989 |
|
|
{'', |
5990 |
|
|
'1', |
5991 |
|
|
'1.0', |
5992 |
|
|
'1', |
5993 |
|
|
'2.0', |
5994 |
|
|
'1', |
5995 |
|
|
'3.0', |
5996 |
|
|
'1'}, |
5997 |
|
|
'xmlversion', |
5998 |
|
|
{'', |
5999 |
|
|
'1', |
6000 |
|
|
'1.0', |
6001 |
|
|
'1', |
6002 |
|
|
'1.1', |
6003 |
|
|
'1'}}; |
6004 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocument>} = 14.1; |
6005 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocument>}->{compat_class}->{q<Message::DOM::Document::ManakaiDOMDocument>} = 1; |
6006 |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Document::ManakaiDOMDocument>} = {'s1a', |
6007 |
|
|
['child'], |
6008 |
|
|
'v1h', |
6009 |
|
|
['do'], |
6010 |
|
|
'w0', |
6011 |
|
|
['impl']}; |
6012 |
|
|
package Message::DOM::IFLatest::DocumentFragment; |
6013 |
wakaba |
1.2 |
our $VERSION = 20060403.0600; |
6014 |
wakaba |
1.1 |
package Message::DOM::Document::ManakaiDOMDocumentFragment; |
6015 |
wakaba |
1.2 |
our $VERSION = 20060403.0600; |
6016 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
6017 |
|
|
'Message::DOM::IF::DocumentFragment', |
6018 |
|
|
'Message::DOM::IF::Node', |
6019 |
|
|
'Message::DOM::IFLatest::DocumentFragment', |
6020 |
|
|
'Message::DOM::IFLatest::Node', |
6021 |
|
|
'Message::DOM::IFLevel1::DocumentFragment', |
6022 |
|
|
'Message::DOM::IFLevel1::Node', |
6023 |
|
|
'Message::DOM::IFLevel2::DocumentFragment', |
6024 |
|
|
'Message::DOM::IFLevel2::Node', |
6025 |
|
|
'Message::DOM::IFLevel3::DocumentFragment', |
6026 |
|
|
'Message::DOM::IFLevel3::Node'; |
6027 |
|
|
sub ___create_node_stem ($$$$) { |
6028 |
|
|
my ($self, $bag, $obj, $opt) = @_; |
6029 |
|
|
my $r = {}; |
6030 |
|
|
|
6031 |
|
|
{ |
6032 |
|
|
|
6033 |
|
|
|
6034 |
|
|
$obj->{ |
6035 |
|
|
'child' |
6036 |
|
|
} = []; |
6037 |
|
|
|
6038 |
|
|
|
6039 |
|
|
{ |
6040 |
|
|
|
6041 |
|
|
|
6042 |
|
|
$obj->{'od'} = $opt->{'od'}->{ |
6043 |
|
|
'id' |
6044 |
|
|
}; |
6045 |
|
|
$bag->{${$opt->{'od'}->{ |
6046 |
|
|
'id' |
6047 |
|
|
}}} |
6048 |
|
|
->{'do'}->{${$obj->{ |
6049 |
|
|
'id' |
6050 |
|
|
}}} |
6051 |
|
|
= $obj->{ |
6052 |
|
|
'id' |
6053 |
|
|
}; |
6054 |
|
|
|
6055 |
|
|
|
6056 |
|
|
;} |
6057 |
|
|
|
6058 |
|
|
; |
6059 |
|
|
$r = $obj; |
6060 |
|
|
|
6061 |
|
|
|
6062 |
|
|
;} |
6063 |
|
|
$r} |
6064 |
|
|
sub node_type ($;$) { |
6065 |
|
|
if (@_ == 1) {my ($self) = @_; |
6066 |
|
|
my $r; |
6067 |
|
|
$r = 11; |
6068 |
|
|
$r; |
6069 |
|
|
} else {my ($self) = @_; |
6070 |
|
|
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'; |
6071 |
|
|
} |
6072 |
|
|
} |
6073 |
|
|
sub append_child ($$) { |
6074 |
|
|
my ($self, $newChild) = @_; |
6075 |
|
|
my $r; |
6076 |
|
|
|
6077 |
|
|
{ |
6078 |
|
|
|
6079 |
|
|
if |
6080 |
|
|
($self eq $newChild) { |
6081 |
|
|
|
6082 |
|
|
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'; |
6083 |
|
|
|
6084 |
|
|
; |
6085 |
|
|
} |
6086 |
|
|
my $self_od = $self-> |
6087 |
|
|
owner_document |
6088 |
|
|
; |
6089 |
|
|
my $child_od = $newChild-> |
6090 |
|
|
owner_document |
6091 |
|
|
; |
6092 |
|
|
my $child_nt = $newChild-> |
6093 |
|
|
node_type |
6094 |
|
|
; |
6095 |
|
|
|
6096 |
|
|
|
6097 |
|
|
{ |
6098 |
|
|
|
6099 |
|
|
|
6100 |
|
|
{ |
6101 |
|
|
|
6102 |
|
|
local $Error::Depth = $Error::Depth + 1; |
6103 |
|
|
|
6104 |
|
|
{ |
6105 |
|
|
|
6106 |
|
|
|
6107 |
|
|
my |
6108 |
|
|
$strict = $self_od-> |
6109 |
|
|
strict_error_checking |
6110 |
|
|
; |
6111 |
|
|
|
6112 |
|
|
## -- Node Type check |
6113 |
|
|
my @new_child; |
6114 |
|
|
if ({ |
6115 |
|
|
3 => 1, |
6116 |
|
|
5 => 1, |
6117 |
|
|
1 => 1, |
6118 |
|
|
7 => 1, |
6119 |
|
|
4 => 1, |
6120 |
|
|
8 => 1, |
6121 |
|
|
}->{$child_nt}) { |
6122 |
|
|
push @new_child, $newChild; |
6123 |
|
|
} elsif ($child_nt == |
6124 |
|
|
11 |
6125 |
|
|
) { |
6126 |
|
|
for my $cn (@{$newChild-> |
6127 |
|
|
child_nodes |
6128 |
|
|
}) { |
6129 |
|
|
unless ({ |
6130 |
|
|
3 => 1, |
6131 |
|
|
5 => 1, |
6132 |
|
|
1 => 1, |
6133 |
|
|
7 => 1, |
6134 |
|
|
4 => 1, |
6135 |
|
|
8 => 1, |
6136 |
|
|
}->{$cn-> |
6137 |
|
|
node_type |
6138 |
|
|
}) { |
6139 |
|
|
|
6140 |
|
|
|
6141 |
|
|
{ |
6142 |
|
|
|
6143 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6144 |
|
|
|
6145 |
|
|
{ |
6146 |
|
|
|
6147 |
|
|
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; |
6148 |
|
|
|
6149 |
|
|
|
6150 |
|
|
;} |
6151 |
|
|
|
6152 |
|
|
|
6153 |
|
|
;} |
6154 |
|
|
|
6155 |
|
|
; |
6156 |
|
|
} |
6157 |
|
|
push @new_child, $cn; |
6158 |
|
|
} |
6159 |
|
|
} else { |
6160 |
|
|
|
6161 |
|
|
|
6162 |
|
|
{ |
6163 |
|
|
|
6164 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6165 |
|
|
|
6166 |
|
|
{ |
6167 |
|
|
|
6168 |
|
|
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; |
6169 |
|
|
|
6170 |
|
|
|
6171 |
|
|
;} |
6172 |
|
|
|
6173 |
|
|
|
6174 |
|
|
;} |
6175 |
|
|
|
6176 |
|
|
; |
6177 |
|
|
} |
6178 |
|
|
|
6179 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
6180 |
|
|
parent_node |
6181 |
|
|
: |
6182 |
|
|
|
6183 |
|
|
undef |
6184 |
|
|
; |
6185 |
|
|
if ($strict) { |
6186 |
|
|
## -- Wrong-document check |
6187 |
|
|
unless ($self_od eq $child_od) { |
6188 |
|
|
|
6189 |
|
|
|
6190 |
|
|
{ |
6191 |
|
|
|
6192 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6193 |
|
|
|
6194 |
|
|
{ |
6195 |
|
|
|
6196 |
|
|
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; |
6197 |
|
|
|
6198 |
|
|
|
6199 |
|
|
;} |
6200 |
|
|
|
6201 |
|
|
|
6202 |
|
|
;} |
6203 |
|
|
|
6204 |
|
|
; |
6205 |
|
|
} |
6206 |
|
|
|
6207 |
|
|
## -- Read-onlyness check |
6208 |
|
|
if ($self-> |
6209 |
|
|
manakai_read_only |
6210 |
|
|
) { |
6211 |
|
|
|
6212 |
|
|
|
6213 |
|
|
{ |
6214 |
|
|
|
6215 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6216 |
|
|
|
6217 |
|
|
{ |
6218 |
|
|
|
6219 |
|
|
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'; |
6220 |
|
|
|
6221 |
|
|
|
6222 |
|
|
;} |
6223 |
|
|
|
6224 |
|
|
|
6225 |
|
|
;} |
6226 |
|
|
|
6227 |
|
|
; |
6228 |
|
|
} |
6229 |
|
|
if (@new_child) { |
6230 |
|
|
if ($nc_parent and |
6231 |
|
|
$nc_parent-> |
6232 |
|
|
manakai_read_only |
6233 |
|
|
) { |
6234 |
|
|
|
6235 |
|
|
|
6236 |
|
|
{ |
6237 |
|
|
|
6238 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6239 |
|
|
|
6240 |
|
|
{ |
6241 |
|
|
|
6242 |
|
|
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'; |
6243 |
|
|
|
6244 |
|
|
|
6245 |
|
|
;} |
6246 |
|
|
|
6247 |
|
|
|
6248 |
|
|
;} |
6249 |
|
|
|
6250 |
|
|
; |
6251 |
|
|
} |
6252 |
|
|
} |
6253 |
|
|
} |
6254 |
|
|
|
6255 |
|
|
## -- Insert at... |
6256 |
|
|
my $index = -1; # last |
6257 |
|
|
|
6258 |
|
|
|
6259 |
|
|
; # FOR !tc:ForAppendChild |
6260 |
|
|
|
6261 |
|
|
## -- Removes from parent |
6262 |
|
|
if ($nc_parent) { |
6263 |
|
|
if ($child_nt == |
6264 |
|
|
11 |
6265 |
|
|
) { |
6266 |
|
|
|
6267 |
|
|
|
6268 |
|
|
{ |
6269 |
|
|
|
6270 |
|
|
|
6271 |
|
|
$newChild->{ |
6272 |
|
|
'b' |
6273 |
|
|
}->{${$newChild->{ |
6274 |
|
|
'id' |
6275 |
|
|
}}} |
6276 |
|
|
->{'child'} = []; |
6277 |
|
|
|
6278 |
|
|
|
6279 |
|
|
;} |
6280 |
|
|
|
6281 |
|
|
; |
6282 |
|
|
} else { |
6283 |
|
|
my $v; |
6284 |
|
|
|
6285 |
|
|
|
6286 |
|
|
{ |
6287 |
|
|
|
6288 |
|
|
|
6289 |
|
|
$v = $nc_parent->{ |
6290 |
|
|
'b' |
6291 |
|
|
}->{${$nc_parent->{ |
6292 |
|
|
'id' |
6293 |
|
|
}}} |
6294 |
|
|
->{'child'}; |
6295 |
|
|
|
6296 |
|
|
|
6297 |
|
|
;} |
6298 |
|
|
|
6299 |
|
|
; |
6300 |
|
|
RP: for my $i (0..$#$v) { |
6301 |
|
|
my $nodeid = $v->[$i]; |
6302 |
|
|
if ( |
6303 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
6304 |
|
|
) { |
6305 |
|
|
splice @$v, $i, 1, (); |
6306 |
|
|
last RP; |
6307 |
|
|
} |
6308 |
|
|
} # RP |
6309 |
|
|
} |
6310 |
|
|
} |
6311 |
|
|
|
6312 |
|
|
## -- Rewrite the |parentNode| properties |
6313 |
|
|
for my $nc (@new_child) { |
6314 |
|
|
|
6315 |
|
|
|
6316 |
|
|
{ |
6317 |
|
|
|
6318 |
|
|
|
6319 |
|
|
$nc->{ |
6320 |
|
|
'b' |
6321 |
|
|
}->{${$nc->{ |
6322 |
|
|
'id' |
6323 |
|
|
}}} |
6324 |
|
|
->{'parent'} = $self->{ |
6325 |
|
|
'id' |
6326 |
|
|
}; |
6327 |
|
|
|
6328 |
|
|
|
6329 |
|
|
;} |
6330 |
|
|
|
6331 |
|
|
; |
6332 |
|
|
} |
6333 |
|
|
|
6334 |
|
|
my $children; |
6335 |
|
|
|
6336 |
|
|
|
6337 |
|
|
{ |
6338 |
|
|
|
6339 |
|
|
|
6340 |
|
|
$children = $self->{ |
6341 |
|
|
'b' |
6342 |
|
|
}->{${$self->{ |
6343 |
|
|
'id' |
6344 |
|
|
}}} |
6345 |
|
|
->{'child'}; |
6346 |
|
|
|
6347 |
|
|
|
6348 |
|
|
;} |
6349 |
|
|
|
6350 |
|
|
; |
6351 |
|
|
|
6352 |
|
|
|
6353 |
|
|
|
6354 |
|
|
{ |
6355 |
|
|
|
6356 |
|
|
|
6357 |
|
|
## -- Adds to children list |
6358 |
|
|
push @$children, map { |
6359 |
|
|
|
6360 |
|
|
$_->{'id'} |
6361 |
|
|
|
6362 |
|
|
} @new_child; |
6363 |
|
|
$r = $newChild; |
6364 |
|
|
|
6365 |
|
|
|
6366 |
|
|
|
6367 |
|
|
;} |
6368 |
|
|
|
6369 |
|
|
; |
6370 |
|
|
|
6371 |
|
|
|
6372 |
|
|
|
6373 |
|
|
; |
6374 |
|
|
|
6375 |
|
|
|
6376 |
|
|
|
6377 |
|
|
; |
6378 |
|
|
|
6379 |
|
|
|
6380 |
|
|
|
6381 |
|
|
;} |
6382 |
|
|
|
6383 |
|
|
|
6384 |
|
|
;} |
6385 |
|
|
|
6386 |
|
|
; |
6387 |
|
|
|
6388 |
|
|
|
6389 |
|
|
;} |
6390 |
|
|
|
6391 |
|
|
; |
6392 |
|
|
|
6393 |
|
|
|
6394 |
|
|
;} |
6395 |
|
|
$r} |
6396 |
|
|
sub insert_before ($$;$) { |
6397 |
|
|
my ($self, $newChild, $refChild) = @_; |
6398 |
|
|
my $r; |
6399 |
|
|
|
6400 |
|
|
{ |
6401 |
|
|
|
6402 |
|
|
if |
6403 |
|
|
($self eq $newChild) { |
6404 |
|
|
|
6405 |
|
|
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'; |
6406 |
|
|
|
6407 |
|
|
; |
6408 |
|
|
} |
6409 |
|
|
my $self_od = $self-> |
6410 |
|
|
owner_document |
6411 |
|
|
; |
6412 |
|
|
my $child_od = $newChild-> |
6413 |
|
|
owner_document |
6414 |
|
|
; |
6415 |
|
|
my $child_nt = $newChild-> |
6416 |
|
|
node_type |
6417 |
|
|
; |
6418 |
|
|
|
6419 |
|
|
|
6420 |
|
|
{ |
6421 |
|
|
|
6422 |
|
|
|
6423 |
|
|
{ |
6424 |
|
|
|
6425 |
|
|
local $Error::Depth = $Error::Depth + 1; |
6426 |
|
|
|
6427 |
|
|
{ |
6428 |
|
|
|
6429 |
|
|
|
6430 |
|
|
my |
6431 |
|
|
$strict = $self_od-> |
6432 |
|
|
strict_error_checking |
6433 |
|
|
; |
6434 |
|
|
|
6435 |
|
|
## -- Node Type check |
6436 |
|
|
my @new_child; |
6437 |
|
|
if ({ |
6438 |
|
|
3 => 1, |
6439 |
|
|
5 => 1, |
6440 |
|
|
1 => 1, |
6441 |
|
|
7 => 1, |
6442 |
|
|
4 => 1, |
6443 |
|
|
8 => 1, |
6444 |
|
|
}->{$child_nt}) { |
6445 |
|
|
push @new_child, $newChild; |
6446 |
|
|
} elsif ($child_nt == |
6447 |
|
|
11 |
6448 |
|
|
) { |
6449 |
|
|
for my $cn (@{$newChild-> |
6450 |
|
|
child_nodes |
6451 |
|
|
}) { |
6452 |
|
|
unless ({ |
6453 |
|
|
3 => 1, |
6454 |
|
|
5 => 1, |
6455 |
|
|
1 => 1, |
6456 |
|
|
7 => 1, |
6457 |
|
|
4 => 1, |
6458 |
|
|
8 => 1, |
6459 |
|
|
}->{$cn-> |
6460 |
|
|
node_type |
6461 |
|
|
}) { |
6462 |
|
|
|
6463 |
|
|
|
6464 |
|
|
{ |
6465 |
|
|
|
6466 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6467 |
|
|
|
6468 |
|
|
{ |
6469 |
|
|
|
6470 |
|
|
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; |
6471 |
|
|
|
6472 |
|
|
|
6473 |
|
|
;} |
6474 |
|
|
|
6475 |
|
|
|
6476 |
|
|
;} |
6477 |
|
|
|
6478 |
|
|
; |
6479 |
|
|
} |
6480 |
|
|
push @new_child, $cn; |
6481 |
|
|
} |
6482 |
|
|
} else { |
6483 |
|
|
|
6484 |
|
|
|
6485 |
|
|
{ |
6486 |
|
|
|
6487 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6488 |
|
|
|
6489 |
|
|
{ |
6490 |
|
|
|
6491 |
|
|
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; |
6492 |
|
|
|
6493 |
|
|
|
6494 |
|
|
;} |
6495 |
|
|
|
6496 |
|
|
|
6497 |
|
|
;} |
6498 |
|
|
|
6499 |
|
|
; |
6500 |
|
|
} |
6501 |
|
|
|
6502 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
6503 |
|
|
parent_node |
6504 |
|
|
: |
6505 |
|
|
|
6506 |
|
|
undef |
6507 |
|
|
; |
6508 |
|
|
if ($strict) { |
6509 |
|
|
## -- Wrong-document check |
6510 |
|
|
unless ($self_od eq $child_od) { |
6511 |
|
|
|
6512 |
|
|
|
6513 |
|
|
{ |
6514 |
|
|
|
6515 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6516 |
|
|
|
6517 |
|
|
{ |
6518 |
|
|
|
6519 |
|
|
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; |
6520 |
|
|
|
6521 |
|
|
|
6522 |
|
|
;} |
6523 |
|
|
|
6524 |
|
|
|
6525 |
|
|
;} |
6526 |
|
|
|
6527 |
|
|
; |
6528 |
|
|
} |
6529 |
|
|
|
6530 |
|
|
## -- Read-onlyness check |
6531 |
|
|
if ($self-> |
6532 |
|
|
manakai_read_only |
6533 |
|
|
) { |
6534 |
|
|
|
6535 |
|
|
|
6536 |
|
|
{ |
6537 |
|
|
|
6538 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6539 |
|
|
|
6540 |
|
|
{ |
6541 |
|
|
|
6542 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_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'; |
6543 |
|
|
|
6544 |
|
|
|
6545 |
|
|
;} |
6546 |
|
|
|
6547 |
|
|
|
6548 |
|
|
;} |
6549 |
|
|
|
6550 |
|
|
; |
6551 |
|
|
} |
6552 |
|
|
if (@new_child) { |
6553 |
|
|
if ($nc_parent and |
6554 |
|
|
$nc_parent-> |
6555 |
|
|
manakai_read_only |
6556 |
|
|
) { |
6557 |
|
|
|
6558 |
|
|
|
6559 |
|
|
{ |
6560 |
|
|
|
6561 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6562 |
|
|
|
6563 |
|
|
{ |
6564 |
|
|
|
6565 |
|
|
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'; |
6566 |
|
|
|
6567 |
|
|
|
6568 |
|
|
;} |
6569 |
|
|
|
6570 |
|
|
|
6571 |
|
|
;} |
6572 |
|
|
|
6573 |
|
|
; |
6574 |
|
|
} |
6575 |
|
|
} |
6576 |
|
|
} |
6577 |
|
|
|
6578 |
|
|
## -- Insert at... |
6579 |
|
|
my $index = -1; # last |
6580 |
|
|
|
6581 |
|
|
|
6582 |
|
|
{ |
6583 |
|
|
|
6584 |
|
|
|
6585 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
6586 |
|
|
if (defined $refChild) { |
6587 |
|
|
if ($refChild eq $newChild) { |
6588 |
|
|
|
6589 |
|
|
|
6590 |
|
|
{ |
6591 |
|
|
|
6592 |
|
|
|
6593 |
|
|
{ |
6594 |
|
|
|
6595 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6596 |
|
|
|
6597 |
|
|
{ |
6598 |
|
|
|
6599 |
|
|
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'; |
6600 |
|
|
|
6601 |
|
|
|
6602 |
|
|
;} |
6603 |
|
|
|
6604 |
|
|
|
6605 |
|
|
;} |
6606 |
|
|
|
6607 |
|
|
; |
6608 |
|
|
|
6609 |
|
|
|
6610 |
|
|
|
6611 |
|
|
;} |
6612 |
|
|
|
6613 |
|
|
; |
6614 |
|
|
|
6615 |
|
|
|
6616 |
|
|
; |
6617 |
|
|
} |
6618 |
|
|
|
6619 |
|
|
my $cns = $self-> |
6620 |
|
|
child_nodes |
6621 |
|
|
; |
6622 |
|
|
my $cnsl = @$cns; |
6623 |
|
|
C: { |
6624 |
|
|
$index = 0; |
6625 |
|
|
for my $i (0..($cnsl-1)) { |
6626 |
|
|
my $cn = $cns->[$i]; |
6627 |
|
|
if ($cn eq $refChild) { |
6628 |
|
|
$index += $i; |
6629 |
|
|
last C; |
6630 |
|
|
} elsif ($cn eq $newChild) { |
6631 |
|
|
$index = -1; # offset |
6632 |
|
|
} |
6633 |
|
|
} |
6634 |
|
|
|
6635 |
|
|
|
6636 |
|
|
{ |
6637 |
|
|
|
6638 |
|
|
|
6639 |
|
|
{ |
6640 |
|
|
|
6641 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6642 |
|
|
|
6643 |
|
|
{ |
6644 |
|
|
|
6645 |
|
|
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; |
6646 |
|
|
|
6647 |
|
|
|
6648 |
|
|
;} |
6649 |
|
|
|
6650 |
|
|
|
6651 |
|
|
;} |
6652 |
|
|
|
6653 |
|
|
; |
6654 |
|
|
|
6655 |
|
|
|
6656 |
|
|
|
6657 |
|
|
;} |
6658 |
|
|
|
6659 |
|
|
; |
6660 |
|
|
|
6661 |
|
|
|
6662 |
|
|
; |
6663 |
|
|
} # C |
6664 |
|
|
} else { # |oldChild| is not defined |
6665 |
|
|
|
6666 |
|
|
|
6667 |
|
|
; |
6668 |
|
|
} |
6669 |
|
|
|
6670 |
|
|
|
6671 |
|
|
|
6672 |
|
|
;} |
6673 |
|
|
|
6674 |
|
|
; # FOR !tc:ForAppendChild |
6675 |
|
|
|
6676 |
|
|
## -- Removes from parent |
6677 |
|
|
if ($nc_parent) { |
6678 |
|
|
if ($child_nt == |
6679 |
|
|
11 |
6680 |
|
|
) { |
6681 |
|
|
|
6682 |
|
|
|
6683 |
|
|
{ |
6684 |
|
|
|
6685 |
|
|
|
6686 |
|
|
$newChild->{ |
6687 |
|
|
'b' |
6688 |
|
|
}->{${$newChild->{ |
6689 |
|
|
'id' |
6690 |
|
|
}}} |
6691 |
|
|
->{'child'} = []; |
6692 |
|
|
|
6693 |
|
|
|
6694 |
|
|
;} |
6695 |
|
|
|
6696 |
|
|
; |
6697 |
|
|
} else { |
6698 |
|
|
my $v; |
6699 |
|
|
|
6700 |
|
|
|
6701 |
|
|
{ |
6702 |
|
|
|
6703 |
|
|
|
6704 |
|
|
$v = $nc_parent->{ |
6705 |
|
|
'b' |
6706 |
|
|
}->{${$nc_parent->{ |
6707 |
|
|
'id' |
6708 |
|
|
}}} |
6709 |
|
|
->{'child'}; |
6710 |
|
|
|
6711 |
|
|
|
6712 |
|
|
;} |
6713 |
|
|
|
6714 |
|
|
; |
6715 |
|
|
RP: for my $i (0..$#$v) { |
6716 |
|
|
my $nodeid = $v->[$i]; |
6717 |
|
|
if ( |
6718 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
6719 |
|
|
) { |
6720 |
|
|
splice @$v, $i, 1, (); |
6721 |
|
|
last RP; |
6722 |
|
|
} |
6723 |
|
|
} # RP |
6724 |
|
|
} |
6725 |
|
|
} |
6726 |
|
|
|
6727 |
|
|
## -- Rewrite the |parentNode| properties |
6728 |
|
|
for my $nc (@new_child) { |
6729 |
|
|
|
6730 |
|
|
|
6731 |
|
|
{ |
6732 |
|
|
|
6733 |
|
|
|
6734 |
|
|
$nc->{ |
6735 |
|
|
'b' |
6736 |
|
|
}->{${$nc->{ |
6737 |
|
|
'id' |
6738 |
|
|
}}} |
6739 |
|
|
->{'parent'} = $self->{ |
6740 |
|
|
'id' |
6741 |
|
|
}; |
6742 |
|
|
|
6743 |
|
|
|
6744 |
|
|
;} |
6745 |
|
|
|
6746 |
|
|
; |
6747 |
|
|
} |
6748 |
|
|
|
6749 |
|
|
my $children; |
6750 |
|
|
|
6751 |
|
|
|
6752 |
|
|
{ |
6753 |
|
|
|
6754 |
|
|
|
6755 |
|
|
$children = $self->{ |
6756 |
|
|
'b' |
6757 |
|
|
}->{${$self->{ |
6758 |
|
|
'id' |
6759 |
|
|
}}} |
6760 |
|
|
->{'child'}; |
6761 |
|
|
|
6762 |
|
|
|
6763 |
|
|
;} |
6764 |
|
|
|
6765 |
|
|
; |
6766 |
|
|
|
6767 |
|
|
|
6768 |
|
|
|
6769 |
|
|
; |
6770 |
|
|
|
6771 |
|
|
|
6772 |
|
|
|
6773 |
|
|
{ |
6774 |
|
|
|
6775 |
|
|
|
6776 |
|
|
## -- Adds to children list |
6777 |
|
|
if ($index == -1) { |
6778 |
|
|
push @$children, map { |
6779 |
|
|
|
6780 |
|
|
$_->{'id'} |
6781 |
|
|
|
6782 |
|
|
} @new_child; |
6783 |
|
|
} else { |
6784 |
|
|
splice @$children, $index, 0, map { |
6785 |
|
|
|
6786 |
|
|
$_->{'id'} |
6787 |
|
|
|
6788 |
|
|
} @new_child; |
6789 |
|
|
} |
6790 |
|
|
$r = $newChild; |
6791 |
|
|
|
6792 |
|
|
|
6793 |
|
|
|
6794 |
|
|
;} |
6795 |
|
|
|
6796 |
|
|
; |
6797 |
|
|
|
6798 |
|
|
|
6799 |
|
|
|
6800 |
|
|
; |
6801 |
|
|
|
6802 |
|
|
|
6803 |
|
|
|
6804 |
|
|
;} |
6805 |
|
|
|
6806 |
|
|
|
6807 |
|
|
;} |
6808 |
|
|
|
6809 |
|
|
; |
6810 |
|
|
|
6811 |
|
|
|
6812 |
|
|
;} |
6813 |
|
|
|
6814 |
|
|
; |
6815 |
|
|
|
6816 |
|
|
|
6817 |
|
|
;} |
6818 |
|
|
$r} |
6819 |
|
|
sub replace_child ($$$) { |
6820 |
|
|
my ($self, $newChild, $oldChild) = @_; |
6821 |
|
|
my $r; |
6822 |
|
|
|
6823 |
|
|
{ |
6824 |
|
|
|
6825 |
|
|
if |
6826 |
|
|
($self eq $newChild) { |
6827 |
|
|
|
6828 |
|
|
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'; |
6829 |
|
|
|
6830 |
|
|
; |
6831 |
|
|
} |
6832 |
|
|
my $self_od = $self-> |
6833 |
|
|
owner_document |
6834 |
|
|
; |
6835 |
|
|
my $child_od = $newChild-> |
6836 |
|
|
owner_document |
6837 |
|
|
; |
6838 |
|
|
my $child_nt = $newChild-> |
6839 |
|
|
node_type |
6840 |
|
|
; |
6841 |
|
|
|
6842 |
|
|
|
6843 |
|
|
{ |
6844 |
|
|
|
6845 |
|
|
|
6846 |
|
|
{ |
6847 |
|
|
|
6848 |
|
|
local $Error::Depth = $Error::Depth + 1; |
6849 |
|
|
|
6850 |
|
|
{ |
6851 |
|
|
|
6852 |
|
|
|
6853 |
|
|
my |
6854 |
|
|
$strict = $self_od-> |
6855 |
|
|
strict_error_checking |
6856 |
|
|
; |
6857 |
|
|
|
6858 |
|
|
## -- Node Type check |
6859 |
|
|
my @new_child; |
6860 |
|
|
if ({ |
6861 |
|
|
3 => 1, |
6862 |
|
|
5 => 1, |
6863 |
|
|
1 => 1, |
6864 |
|
|
7 => 1, |
6865 |
|
|
4 => 1, |
6866 |
|
|
8 => 1, |
6867 |
|
|
}->{$child_nt}) { |
6868 |
|
|
push @new_child, $newChild; |
6869 |
|
|
} elsif ($child_nt == |
6870 |
|
|
11 |
6871 |
|
|
) { |
6872 |
|
|
for my $cn (@{$newChild-> |
6873 |
|
|
child_nodes |
6874 |
|
|
}) { |
6875 |
|
|
unless ({ |
6876 |
|
|
3 => 1, |
6877 |
|
|
5 => 1, |
6878 |
|
|
1 => 1, |
6879 |
|
|
7 => 1, |
6880 |
|
|
4 => 1, |
6881 |
|
|
8 => 1, |
6882 |
|
|
}->{$cn-> |
6883 |
|
|
node_type |
6884 |
|
|
}) { |
6885 |
|
|
|
6886 |
|
|
|
6887 |
|
|
{ |
6888 |
|
|
|
6889 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6890 |
|
|
|
6891 |
|
|
{ |
6892 |
|
|
|
6893 |
|
|
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; |
6894 |
|
|
|
6895 |
|
|
|
6896 |
|
|
;} |
6897 |
|
|
|
6898 |
|
|
|
6899 |
|
|
;} |
6900 |
|
|
|
6901 |
|
|
; |
6902 |
|
|
} |
6903 |
|
|
push @new_child, $cn; |
6904 |
|
|
} |
6905 |
|
|
} else { |
6906 |
|
|
|
6907 |
|
|
|
6908 |
|
|
{ |
6909 |
|
|
|
6910 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6911 |
|
|
|
6912 |
|
|
{ |
6913 |
|
|
|
6914 |
|
|
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; |
6915 |
|
|
|
6916 |
|
|
|
6917 |
|
|
;} |
6918 |
|
|
|
6919 |
|
|
|
6920 |
|
|
;} |
6921 |
|
|
|
6922 |
|
|
; |
6923 |
|
|
} |
6924 |
|
|
|
6925 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
6926 |
|
|
parent_node |
6927 |
|
|
: |
6928 |
|
|
|
6929 |
|
|
undef |
6930 |
|
|
; |
6931 |
|
|
if ($strict) { |
6932 |
|
|
## -- Wrong-document check |
6933 |
|
|
unless ($self_od eq $child_od) { |
6934 |
|
|
|
6935 |
|
|
|
6936 |
|
|
{ |
6937 |
|
|
|
6938 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6939 |
|
|
|
6940 |
|
|
{ |
6941 |
|
|
|
6942 |
|
|
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; |
6943 |
|
|
|
6944 |
|
|
|
6945 |
|
|
;} |
6946 |
|
|
|
6947 |
|
|
|
6948 |
|
|
;} |
6949 |
|
|
|
6950 |
|
|
; |
6951 |
|
|
} |
6952 |
|
|
|
6953 |
|
|
## -- Read-onlyness check |
6954 |
|
|
if ($self-> |
6955 |
|
|
manakai_read_only |
6956 |
|
|
) { |
6957 |
|
|
|
6958 |
|
|
|
6959 |
|
|
{ |
6960 |
|
|
|
6961 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6962 |
|
|
|
6963 |
|
|
{ |
6964 |
|
|
|
6965 |
|
|
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'; |
6966 |
|
|
|
6967 |
|
|
|
6968 |
|
|
;} |
6969 |
|
|
|
6970 |
|
|
|
6971 |
|
|
;} |
6972 |
|
|
|
6973 |
|
|
; |
6974 |
|
|
} |
6975 |
|
|
if (@new_child) { |
6976 |
|
|
if ($nc_parent and |
6977 |
|
|
$nc_parent-> |
6978 |
|
|
manakai_read_only |
6979 |
|
|
) { |
6980 |
|
|
|
6981 |
|
|
|
6982 |
|
|
{ |
6983 |
|
|
|
6984 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6985 |
|
|
|
6986 |
|
|
{ |
6987 |
|
|
|
6988 |
|
|
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'; |
6989 |
|
|
|
6990 |
|
|
|
6991 |
|
|
;} |
6992 |
|
|
|
6993 |
|
|
|
6994 |
|
|
;} |
6995 |
|
|
|
6996 |
|
|
; |
6997 |
|
|
} |
6998 |
|
|
} |
6999 |
|
|
} |
7000 |
|
|
|
7001 |
|
|
## -- Insert at... |
7002 |
|
|
my $index = -1; # last |
7003 |
|
|
|
7004 |
|
|
|
7005 |
|
|
{ |
7006 |
|
|
|
7007 |
|
|
|
7008 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
7009 |
|
|
if (defined $oldChild) { |
7010 |
|
|
if ($oldChild eq $newChild) { |
7011 |
|
|
|
7012 |
|
|
|
7013 |
|
|
; |
7014 |
|
|
|
7015 |
|
|
|
7016 |
|
|
{ |
7017 |
|
|
|
7018 |
|
|
|
7019 |
|
|
{ |
7020 |
|
|
|
7021 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7022 |
|
|
|
7023 |
|
|
{ |
7024 |
|
|
|
7025 |
|
|
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'; |
7026 |
|
|
|
7027 |
|
|
|
7028 |
|
|
;} |
7029 |
|
|
|
7030 |
|
|
|
7031 |
|
|
;} |
7032 |
|
|
|
7033 |
|
|
; |
7034 |
|
|
|
7035 |
|
|
|
7036 |
|
|
|
7037 |
|
|
;} |
7038 |
|
|
|
7039 |
|
|
; |
7040 |
|
|
} |
7041 |
|
|
|
7042 |
|
|
my $cns = $self-> |
7043 |
|
|
child_nodes |
7044 |
|
|
; |
7045 |
|
|
my $cnsl = @$cns; |
7046 |
|
|
C: { |
7047 |
|
|
$index = 0; |
7048 |
|
|
for my $i (0..($cnsl-1)) { |
7049 |
|
|
my $cn = $cns->[$i]; |
7050 |
|
|
if ($cn eq $oldChild) { |
7051 |
|
|
$index += $i; |
7052 |
|
|
last C; |
7053 |
|
|
} elsif ($cn eq $newChild) { |
7054 |
|
|
$index = -1; # offset |
7055 |
|
|
} |
7056 |
|
|
} |
7057 |
|
|
|
7058 |
|
|
|
7059 |
|
|
; |
7060 |
|
|
|
7061 |
|
|
|
7062 |
|
|
{ |
7063 |
|
|
|
7064 |
|
|
|
7065 |
|
|
{ |
7066 |
|
|
|
7067 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7068 |
|
|
|
7069 |
|
|
{ |
7070 |
|
|
|
7071 |
|
|
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; |
7072 |
|
|
|
7073 |
|
|
|
7074 |
|
|
;} |
7075 |
|
|
|
7076 |
|
|
|
7077 |
|
|
;} |
7078 |
|
|
|
7079 |
|
|
; |
7080 |
|
|
|
7081 |
|
|
|
7082 |
|
|
|
7083 |
|
|
;} |
7084 |
|
|
|
7085 |
|
|
; |
7086 |
|
|
} # C |
7087 |
|
|
} else { # |oldChild| is not defined |
7088 |
|
|
|
7089 |
|
|
|
7090 |
|
|
{ |
7091 |
|
|
|
7092 |
|
|
|
7093 |
|
|
{ |
7094 |
|
|
|
7095 |
|
|
local $Error::Depth = $Error::Depth - 1; |
7096 |
|
|
|
7097 |
|
|
{ |
7098 |
|
|
|
7099 |
|
|
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; |
7100 |
|
|
|
7101 |
|
|
|
7102 |
|
|
;} |
7103 |
|
|
|
7104 |
|
|
|
7105 |
|
|
;} |
7106 |
|
|
|
7107 |
|
|
; |
7108 |
|
|
|
7109 |
|
|
|
7110 |
|
|
|
7111 |
|
|
;} |
7112 |
|
|
|
7113 |
|
|
; |
7114 |
|
|
} |
7115 |
|
|
|
7116 |
|
|
|
7117 |
|
|
|
7118 |
|
|
;} |
7119 |
|
|
|
7120 |
|
|
; # FOR !tc:ForAppendChild |
7121 |
|
|
|
7122 |
|
|
## -- Removes from parent |
7123 |
|
|
if ($nc_parent) { |
7124 |
|
|
if ($child_nt == |
7125 |
|
|
11 |
7126 |
|
|
) { |
7127 |
|
|
|
7128 |
|
|
|
7129 |
|
|
{ |
7130 |
|
|
|
7131 |
|
|
|
7132 |
|
|
$newChild->{ |
7133 |
|
|
'b' |
7134 |
|
|
}->{${$newChild->{ |
7135 |
|
|
'id' |
7136 |
|
|
}}} |
7137 |
|
|
->{'child'} = []; |
7138 |
|
|
|
7139 |
|
|
|
7140 |
|
|
;} |
7141 |
|
|
|
7142 |
|
|
; |
7143 |
|
|
} else { |
7144 |
|
|
my $v; |
7145 |
|
|
|
7146 |
|
|
|
7147 |
|
|
{ |
7148 |
|
|
|
7149 |
|
|
|
7150 |
|
|
$v = $nc_parent->{ |
7151 |
|
|
'b' |
7152 |
|
|
}->{${$nc_parent->{ |
7153 |
|
|
'id' |
7154 |
|
|
}}} |
7155 |
|
|
->{'child'}; |
7156 |
|
|
|
7157 |
|
|
|
7158 |
|
|
;} |
7159 |
|
|
|
7160 |
|
|
; |
7161 |
|
|
RP: for my $i (0..$#$v) { |
7162 |
|
|
my $nodeid = $v->[$i]; |
7163 |
|
|
if ( |
7164 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
7165 |
|
|
) { |
7166 |
|
|
splice @$v, $i, 1, (); |
7167 |
|
|
last RP; |
7168 |
|
|
} |
7169 |
|
|
} # RP |
7170 |
|
|
} |
7171 |
|
|
} |
7172 |
|
|
|
7173 |
|
|
## -- Rewrite the |parentNode| properties |
7174 |
|
|
for my $nc (@new_child) { |
7175 |
|
|
|
7176 |
|
|
|
7177 |
|
|
{ |
7178 |
|
|
|
7179 |
|
|
|
7180 |
|
|
$nc->{ |
7181 |
|
|
'b' |
7182 |
|
|
}->{${$nc->{ |
7183 |
|
|
'id' |
7184 |
|
|
}}} |
7185 |
|
|
->{'parent'} = $self->{ |
7186 |
|
|
'id' |
7187 |
|
|
}; |
7188 |
|
|
|
7189 |
|
|
|
7190 |
|
|
;} |
7191 |
|
|
|
7192 |
|
|
; |
7193 |
|
|
} |
7194 |
|
|
|
7195 |
|
|
my $children; |
7196 |
|
|
|
7197 |
|
|
|
7198 |
|
|
{ |
7199 |
|
|
|
7200 |
|
|
|
7201 |
|
|
$children = $self->{ |
7202 |
|
|
'b' |
7203 |
|
|
}->{${$self->{ |
7204 |
|
|
'id' |
7205 |
|
|
}}} |
7206 |
|
|
->{'child'}; |
7207 |
|
|
|
7208 |
|
|
|
7209 |
|
|
;} |
7210 |
|
|
|
7211 |
|
|
; |
7212 |
|
|
|
7213 |
|
|
|
7214 |
|
|
|
7215 |
|
|
; |
7216 |
|
|
|
7217 |
|
|
|
7218 |
|
|
|
7219 |
|
|
; |
7220 |
|
|
|
7221 |
|
|
|
7222 |
|
|
|
7223 |
|
|
{ |
7224 |
|
|
|
7225 |
|
|
|
7226 |
|
|
## -- Replaces the node |
7227 |
|
|
splice @$children, $index, 1, map { |
7228 |
|
|
|
7229 |
|
|
$_->{'id'} |
7230 |
|
|
|
7231 |
|
|
} @new_child; |
7232 |
|
|
|
7233 |
|
|
|
7234 |
|
|
{ |
7235 |
|
|
|
7236 |
|
|
CORE::delete |
7237 |
|
|
$oldChild->{ |
7238 |
|
|
'b' |
7239 |
|
|
}->{${$oldChild->{ |
7240 |
|
|
'id' |
7241 |
|
|
}}} |
7242 |
|
|
->{'parent'}; |
7243 |
|
|
|
7244 |
|
|
|
7245 |
|
|
;} |
7246 |
|
|
|
7247 |
|
|
; |
7248 |
|
|
$r = $oldChild; |
7249 |
|
|
|
7250 |
|
|
|
7251 |
|
|
|
7252 |
|
|
;} |
7253 |
|
|
|
7254 |
|
|
; |
7255 |
|
|
|
7256 |
|
|
|
7257 |
|
|
|
7258 |
|
|
;} |
7259 |
|
|
|
7260 |
|
|
|
7261 |
|
|
;} |
7262 |
|
|
|
7263 |
|
|
; |
7264 |
|
|
|
7265 |
|
|
|
7266 |
|
|
;} |
7267 |
|
|
|
7268 |
|
|
; |
7269 |
|
|
|
7270 |
|
|
|
7271 |
|
|
;} |
7272 |
|
|
$r} |
7273 |
|
|
sub node_name ($;$) { |
7274 |
|
|
if (@_ == 1) {my ($self) = @_; |
7275 |
|
|
my $r = ''; |
7276 |
|
|
$r = '#document-fragment'; |
7277 |
|
|
$r; |
7278 |
|
|
} else {my ($self) = @_; |
7279 |
|
|
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'; |
7280 |
|
|
} |
7281 |
|
|
} |
7282 |
|
|
sub manakai_append_text ($$) { |
7283 |
|
|
my ($self, $string) = @_; |
7284 |
|
|
my $r; |
7285 |
|
|
|
7286 |
|
|
{ |
7287 |
|
|
|
7288 |
|
|
|
7289 |
|
|
{ |
7290 |
|
|
|
7291 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7292 |
|
|
|
7293 |
|
|
{ |
7294 |
|
|
|
7295 |
|
|
|
7296 |
|
|
my |
7297 |
|
|
$lc = $self-> |
7298 |
|
|
last_child |
7299 |
|
|
; |
7300 |
|
|
if (defined $lc and |
7301 |
|
|
$lc-> |
7302 |
|
|
node_type |
7303 |
|
|
== |
7304 |
|
|
3 |
7305 |
|
|
) { |
7306 |
|
|
$lc-> |
7307 |
|
|
manakai_append_text |
7308 |
|
|
|
7309 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
7310 |
|
|
} else { |
7311 |
|
|
my $text = $self-> |
7312 |
|
|
owner_document |
7313 |
|
|
|
7314 |
|
|
-> |
7315 |
|
|
create_text_node |
7316 |
|
|
|
7317 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
7318 |
|
|
$self-> |
7319 |
|
|
append_child |
7320 |
|
|
($text); |
7321 |
|
|
} |
7322 |
|
|
$r = $self; |
7323 |
|
|
|
7324 |
|
|
|
7325 |
|
|
|
7326 |
|
|
;} |
7327 |
|
|
|
7328 |
|
|
|
7329 |
|
|
;} |
7330 |
|
|
|
7331 |
|
|
; |
7332 |
|
|
|
7333 |
|
|
|
7334 |
|
|
;} |
7335 |
|
|
$r} |
7336 |
|
|
sub get_feature ($$$) { |
7337 |
|
|
my ($self, $feature, $version) = @_; |
7338 |
|
|
|
7339 |
|
|
{ |
7340 |
|
|
|
7341 |
|
|
|
7342 |
|
|
$feature = lc $feature; |
7343 |
|
|
|
7344 |
|
|
|
7345 |
|
|
;} |
7346 |
|
|
|
7347 |
|
|
{ |
7348 |
|
|
|
7349 |
|
|
|
7350 |
|
|
$version = '' unless defined $version; |
7351 |
|
|
|
7352 |
|
|
|
7353 |
|
|
;} |
7354 |
|
|
my $r; |
7355 |
|
|
|
7356 |
|
|
{ |
7357 |
|
|
|
7358 |
|
|
|
7359 |
|
|
$feature =~ s/^\+//; |
7360 |
|
|
|
7361 |
|
|
|
7362 |
|
|
{ |
7363 |
|
|
|
7364 |
|
|
if |
7365 |
|
|
($Message::DOM::DOMFeature::ClassInfo->{ref $self} |
7366 |
|
|
->{has_feature}->{$feature}->{$version}) { |
7367 |
|
|
$r = $self; |
7368 |
|
|
} else { |
7369 |
|
|
CLASS: for my $__class (sort { |
7370 |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
7371 |
|
|
} grep { |
7372 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Document::ManakaiDOMDocumentFragment'} |
7373 |
|
|
->{compat_class}->{$_} |
7374 |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Document::ManakaiDOMDocumentFragment'} |
7375 |
|
|
->{compat_class} or {}}) { |
7376 |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
7377 |
|
|
->{has_feature}->{$feature}->{$version}) { |
7378 |
|
|
|
7379 |
|
|
|
7380 |
|
|
{ |
7381 |
|
|
|
7382 |
|
|
|
7383 |
|
|
$r = ${($self->{'b'})->{${($self->{'id'})}}->{ |
7384 |
|
|
'cls' |
7385 |
|
|
}}->___create_node_ref ({ |
7386 |
|
|
|
7387 |
|
|
'id' |
7388 |
|
|
=> ($self->{'id'}), |
7389 |
|
|
|
7390 |
|
|
'b' |
7391 |
|
|
=> ($self->{'b'}), |
7392 |
|
|
}, { |
7393 |
|
|
'nrcls' => \$__class, |
7394 |
|
|
}); |
7395 |
|
|
($self->{'b'})->{${($self->{'id'})}}->{ |
7396 |
|
|
'rc' |
7397 |
|
|
}++; |
7398 |
|
|
|
7399 |
|
|
|
7400 |
|
|
;} |
7401 |
|
|
|
7402 |
|
|
; |
7403 |
|
|
last CLASS; |
7404 |
|
|
} |
7405 |
|
|
} # CLASS |
7406 |
|
|
} |
7407 |
|
|
|
7408 |
|
|
|
7409 |
|
|
;} |
7410 |
|
|
|
7411 |
|
|
; |
7412 |
|
|
unless (defined $r) { |
7413 |
|
|
|
7414 |
|
|
|
7415 |
|
|
{ |
7416 |
|
|
|
7417 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7418 |
|
|
|
7419 |
|
|
{ |
7420 |
|
|
|
7421 |
|
|
|
7422 |
|
|
|
7423 |
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
7424 |
|
|
|
7425 |
|
|
|
7426 |
|
|
|
7427 |
|
|
;} |
7428 |
|
|
|
7429 |
|
|
|
7430 |
|
|
;} |
7431 |
|
|
|
7432 |
|
|
; |
7433 |
|
|
} |
7434 |
|
|
|
7435 |
|
|
|
7436 |
|
|
;} |
7437 |
|
|
$r} |
7438 |
|
|
sub base_uri ($;$) { |
7439 |
|
|
if (@_ == 1) {my ($self) = @_; |
7440 |
|
|
my $r = ''; |
7441 |
|
|
|
7442 |
|
|
{ |
7443 |
|
|
|
7444 |
|
|
|
7445 |
|
|
{ |
7446 |
|
|
|
7447 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7448 |
|
|
|
7449 |
|
|
{ |
7450 |
|
|
|
7451 |
|
|
|
7452 |
|
|
|
7453 |
|
|
$r = $self-> |
7454 |
|
|
owner_document |
7455 |
|
|
-> |
7456 |
|
|
base_uri |
7457 |
|
|
; |
7458 |
|
|
|
7459 |
|
|
|
7460 |
|
|
|
7461 |
|
|
;} |
7462 |
|
|
|
7463 |
|
|
|
7464 |
|
|
;} |
7465 |
|
|
|
7466 |
|
|
; |
7467 |
|
|
|
7468 |
|
|
|
7469 |
|
|
;} |
7470 |
|
|
$r; |
7471 |
|
|
} else {my ($self) = @_; |
7472 |
|
|
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'; |
7473 |
|
|
} |
7474 |
|
|
} |
7475 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>}->{has_feature} = {'core', |
7476 |
|
|
{'', |
7477 |
|
|
'1', |
7478 |
|
|
'1.0', |
7479 |
|
|
'1', |
7480 |
|
|
'2.0', |
7481 |
|
|
'1', |
7482 |
|
|
'3.0', |
7483 |
|
|
'1'}, |
7484 |
|
|
'xml', |
7485 |
|
|
{'', |
7486 |
|
|
'1', |
7487 |
|
|
'1.0', |
7488 |
|
|
'1', |
7489 |
|
|
'2.0', |
7490 |
|
|
'1', |
7491 |
|
|
'3.0', |
7492 |
|
|
'1'}, |
7493 |
|
|
'xmlversion', |
7494 |
|
|
{'', |
7495 |
|
|
'1', |
7496 |
|
|
'1.0', |
7497 |
|
|
'1', |
7498 |
|
|
'1.1', |
7499 |
|
|
'1'}}; |
7500 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = 14.1; |
7501 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>}->{compat_class}->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = 1; |
7502 |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = {'s1a', |
7503 |
|
|
['child'], |
7504 |
|
|
'w0', |
7505 |
|
|
['od']}; |
7506 |
|
|
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::){} |
7507 |
|
|
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
7508 |
|
|
1; |