/[suikacvs]/messaging/manakai/lib/Message/DOM/Document.pm
Suika

Contents of /messaging/manakai/lib/Message/DOM/Document.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations) (download)
Fri Dec 29 14:45:41 2006 UTC (17 years, 10 months ago) by wakaba
Branch: MAIN
Changes since 1.12: +290 -1444 lines
++ manakai/t/ChangeLog	29 Dec 2006 13:56:36 -0000
2006-12-29  Wakaba  <wakaba@suika.fam.cx>

	* .cvsignore: New auto-generated Perl test files
	are added.

++ manakai/lib/Message/Util/ChangeLog	29 Dec 2006 13:53:51 -0000
2006-12-29  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (createPCFile): Removed.
	(createPCDocument): New method.

++ manakai/lib/Message/Util/DIS/ChangeLog	29 Dec 2006 13:54:30 -0000
2006-12-29  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plGeneratePerlModuleFile): Removed.
	(plGeneratePerlModuleDocument): New method.

++ manakai/lib/Message/DOM/ChangeLog	29 Dec 2006 13:53:21 -0000
2006-12-29  Wakaba  <wakaba@suika.fam.cx>

	* TreeCore.dis, DOMCore.dis, Document.dis,
	Element.dis, CharacterData.dis, XML.dis,
	XDoctype.dis, DOMString.dis, TreeStore.dis,
	XMLParser.dis: Use Perl native
	hashs and |Scalar::Util|'s weak references in favor of |Grove.dis|
	for DOM nodes.  See
	also <http://suika.fam.cx/gate/2005/sw/manakai/%E3%83%A1%E3%83%A2/2006-12-29>.

++ manakai/lib/manakai/ChangeLog	29 Dec 2006 13:56:06 -0000
2006-12-29  Wakaba  <wakaba@suika.fam.cx>

	* daf-perl-pm.pl: Use |pl_generate_perl_module_document|
	instead of |pl_generate_perl_module_file|.

	* daf-perl-t.pl: Use |create_pc_document|
	instead of |create_pc_file|.
	(daf_generate_perl_test_file|: Removed.
	(daf_generate_perl_test_document|: New function.

1 wakaba 1.1 #!/usr/bin/perl
2     ## This file is automatically generated
3 wakaba 1.13 ## at 2006-12-29T06:39:26+00:00,
4 wakaba 1.12 ## from file "Document.dis",
5 wakaba 1.1 ## module <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.Document>,
6     ## for <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOMLatest>.
7     ## Don't edit by hand!
8     use strict;
9     require Message::DOM::DOMCore;
10     require Message::DOM::TreeCore;
11     require Message::Util::Error::DOMException;
12     package Message::DOM::Document;
13 wakaba 1.13 our $VERSION = 20061229.0639;
14 wakaba 1.10 package Message::DOM::Document::ManakaiDOMImplementationDocument;
15 wakaba 1.13 our $VERSION = 20061229.0639;
16 wakaba 1.10 push @Message::DOM::DOMCore::ManakaiDOMImplementation::ISA, q<Message::DOM::Document::ManakaiDOMImplementationDocument> unless Message::DOM::DOMCore::ManakaiDOMImplementation->isa (q<Message::DOM::Document::ManakaiDOMImplementationDocument>);
17     sub create_document ($;$$$) {
18     my ($self, $namespaceURI, $qualifiedName, $doctype) = @_;
19    
20     {
21    
22     if
23     (CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) {
24     require Message::DOM::DOMMain;
25    
26 wakaba 1.13 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:1167371291:21034:x54Sv15711+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest';
27 wakaba 1.10
28     ;
29    
30    
31    
32     {
33    
34    
35     $namespaceURI = undef;
36    
37    
38    
39     }
40    
41     ;
42     }
43    
44    
45     }
46     my $r;
47    
48     {
49    
50    
51 wakaba 1.13 $r = bless \({
52 wakaba 1.10
53 wakaba 1.13 'child'
54     => [],
55 wakaba 1.10
56 wakaba 1.13 'impl'
57     => $self,
58 wakaba 1.10
59 wakaba 1.13 'http://www.w3.org/2001/04/infoset#version'
60     => '1.0',
61 wakaba 1.10
62 wakaba 1.13 'chk'
63     => 1,
64     }),
65     'Message::DOM::Document::ManakaiDOMDocument'
66 wakaba 1.10 ;
67    
68     if (defined $doctype) {
69    
70    
71     {
72    
73     local $Error::Depth = $Error::Depth + 1;
74    
75     {
76    
77    
78    
79     $r->
80     append_child
81     ($doctype);
82    
83    
84    
85     }
86    
87    
88     ;}
89    
90     ;
91     }
92    
93     if (defined $qualifiedName) {
94    
95    
96     {
97    
98     local $Error::Depth = $Error::Depth + 1;
99    
100     {
101    
102    
103     my
104     $el = $r->
105     create_element_ns
106    
107     ($namespaceURI, $qualifiedName);
108     $r->
109     append_child
110     ($el);
111     $r = $el->
112     owner_document
113     ;
114     ## Choose the class based on document element type
115    
116    
117    
118     }
119    
120    
121     ;}
122    
123     ;
124     } elsif (defined $namespaceURI) {
125    
126     report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'create_document', 'http://www.w3.org/2001/04/infoset#namespaceURI' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_NULL_QNAME_WITH_NON_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMImplementationDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'namespaceURI';
127    
128     ;
129     }
130    
131    
132     }
133     $r}
134     $Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMImplementationDocument>}->{has_feature} = {};
135     $Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMImplementationDocument>} = 0;
136 wakaba 1.1 package Message::DOM::IFLatest::Document;
137 wakaba 1.13 our $VERSION = 20061229.0639;
138 wakaba 1.1 package Message::DOM::Document::ManakaiDOMDocument;
139 wakaba 1.13 our $VERSION = 20061229.0639;
140 wakaba 1.1 push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode',
141     'Message::DOM::IF::Document',
142     'Message::DOM::IF::Node',
143     'Message::DOM::IFLatest::Document',
144     'Message::DOM::IFLatest::Node',
145     'Message::DOM::IFLevel1::Document',
146     'Message::DOM::IFLevel1::Node',
147     'Message::DOM::IFLevel2::Document',
148     'Message::DOM::IFLevel2::Node',
149     'Message::DOM::IFLevel3::Document',
150     'Message::DOM::IFLevel3::Node';
151     sub node_type ($;$) {
152     if (@_ == 1) {my ($self) = @_;
153     my $r;
154 wakaba 1.7 $r = 9;
155 wakaba 1.1 $r;
156     } else {my ($self) = @_;
157     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';
158     }
159     }
160     sub append_child ($$) {
161     my ($self, $newChild) = @_;
162     my $r;
163    
164     {
165    
166     my
167     $strictc = $self->
168     dom_config
169    
170     ->
171     get_parameter
172    
173     (
174     'http://suika.fam.cx/www/2006/dom-config/strict-document-children'
175     );
176     my $child_od = $newChild->
177     owner_document
178     || $self;
179     my $child_nt = $newChild->
180     node_type
181     ;
182     if ($strictc and $self->
183     strict_error_checking
184     ) {
185    
186    
187     {
188    
189     local $Error::Depth = $Error::Depth + 1;
190    
191     {
192    
193    
194     my
195     $has_el;
196     my $has_dt;
197     if ($child_nt ==
198 wakaba 1.7 1
199 wakaba 1.1 ) {
200     $has_el =
201     1
202     ;
203     } elsif ($child_nt ==
204 wakaba 1.7 10
205 wakaba 1.1 ) {
206     $has_dt =
207     1
208     ;
209     } elsif ($child_nt ==
210 wakaba 1.7 11
211 wakaba 1.1 ) {
212     for my $cn (@{$newChild->
213     child_nodes
214     }) {
215     my $cnt = $cn->
216     node_type
217     ;
218     if ($cnt ==
219 wakaba 1.7 1
220 wakaba 1.1 ) {
221     if ($has_el) {
222    
223    
224     {
225    
226     local $Error::Depth = $Error::Depth - 1;
227    
228     {
229    
230     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;
231    
232    
233 wakaba 1.3 }
234 wakaba 1.1
235    
236     ;}
237    
238     ;
239     }
240     $has_el =
241     1
242     ;
243     }
244     # DocumentType node cannot be contained in DocumentFragments
245     }
246     }
247    
248     if ($has_el) {
249     my $anode = $self->
250     last_child
251     ;
252     while (defined $anode) {
253     if ($anode->
254     node_type
255     ==
256 wakaba 1.7 1
257 wakaba 1.1 ) {
258    
259    
260     {
261    
262     local $Error::Depth = $Error::Depth - 1;
263    
264     {
265    
266     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;
267    
268    
269 wakaba 1.3 }
270 wakaba 1.1
271    
272     ;}
273    
274     ;
275     }
276     $anode = $anode->
277     previous_sibling
278     ;
279     }
280     } # has_el
281     if ($has_dt) {
282     my $anode = $self->
283     last_child
284     ;
285     while (defined $anode) {
286     my $ant = $anode->
287     node_type
288     ;
289     if ($ant ==
290 wakaba 1.7 1
291 wakaba 1.1 ) {
292    
293    
294     {
295    
296     local $Error::Depth = $Error::Depth - 1;
297    
298     {
299    
300     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;
301    
302    
303 wakaba 1.3 }
304 wakaba 1.1
305    
306     ;}
307    
308     ;
309     } elsif ($ant ==
310 wakaba 1.7 10
311 wakaba 1.1 ) {
312    
313    
314     {
315    
316     local $Error::Depth = $Error::Depth - 1;
317    
318     {
319    
320     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;
321    
322    
323 wakaba 1.3 }
324 wakaba 1.1
325    
326     ;}
327    
328     ;
329     }
330     $anode = $anode->
331     previous_sibling
332     ;
333     }
334     } # has_dt
335    
336    
337    
338 wakaba 1.3 }
339 wakaba 1.1
340    
341     ;}
342    
343     ;
344     }
345    
346    
347     {
348    
349    
350     {
351    
352     local $Error::Depth = $Error::Depth + 1;
353    
354     {
355    
356    
357     my
358     $strict = $self->
359     strict_error_checking
360     ;
361    
362     ## -- Node Type check
363     my @new_child;
364     if ({
365 wakaba 1.7 3 => (not $strictc),
366     5 => (not $strictc),
367     1 => 1,
368     4 => (not $strictc),
369     7 => 1,
370     8 => 1,
371     10 => 1,
372 wakaba 1.1 }->{$child_nt}) {
373     push @new_child, $newChild;
374     } elsif ($child_nt ==
375 wakaba 1.7 11
376 wakaba 1.1 ) {
377     for my $cn (@{$newChild->
378     child_nodes
379     }) {
380     unless ({
381 wakaba 1.7 3 => (not $strictc),
382     5 => (not $strictc),
383     1 => 1,
384     4 => (not $strictc),
385     7 => 1,
386     8 => 1,
387     10 => 1,
388 wakaba 1.1 }->{$cn->
389     node_type
390     }) {
391    
392    
393     {
394    
395     local $Error::Depth = $Error::Depth - 1;
396    
397     {
398    
399     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;
400    
401    
402 wakaba 1.3 }
403 wakaba 1.1
404    
405     ;}
406    
407     ;
408     }
409     push @new_child, $cn;
410     }
411     } else {
412    
413    
414     {
415    
416     local $Error::Depth = $Error::Depth - 1;
417    
418     {
419    
420     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;
421    
422    
423 wakaba 1.3 }
424 wakaba 1.1
425    
426     ;}
427    
428     ;
429     }
430    
431     my $nc_parent = @new_child ? $new_child[0]->
432     parent_node
433     :
434    
435     undef
436     ;
437     if ($strict) {
438     ## -- Wrong-document check
439     unless ($self eq $child_od) {
440    
441    
442     {
443    
444     local $Error::Depth = $Error::Depth - 1;
445    
446     {
447    
448     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;
449    
450    
451 wakaba 1.3 }
452 wakaba 1.1
453    
454     ;}
455    
456     ;
457     }
458    
459     ## -- Read-onlyness check
460     if ($self->
461     manakai_read_only
462     ) {
463    
464    
465     {
466    
467     local $Error::Depth = $Error::Depth - 1;
468    
469     {
470    
471     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';
472    
473    
474 wakaba 1.3 }
475 wakaba 1.1
476    
477     ;}
478    
479     ;
480     }
481     if (@new_child) {
482     if ($nc_parent and
483     $nc_parent->
484     manakai_read_only
485     ) {
486    
487    
488     {
489    
490     local $Error::Depth = $Error::Depth - 1;
491    
492     {
493    
494     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';
495    
496    
497 wakaba 1.3 }
498 wakaba 1.1
499    
500     ;}
501    
502     ;
503     }
504     }
505     }
506    
507     ## -- Insert at...
508     my $index = -1; # last
509    
510    
511     ; # FOR !tc:ForAppendChild
512    
513     ## -- Removes from parent
514     if ($nc_parent) {
515     if ($child_nt ==
516 wakaba 1.7 11
517 wakaba 1.1 ) {
518 wakaba 1.13 $$newChild->{
519     'child'
520     } = [];
521 wakaba 1.1 } else {
522 wakaba 1.13 my $v = $$nc_parent->{
523     'child'
524     };
525 wakaba 1.1 RP: for my $i (0..$#$v) {
526 wakaba 1.13 if ($v->[$i] eq $new_child[0]) {
527 wakaba 1.1 splice @$v, $i, 1, ();
528     last RP;
529     }
530     } # RP
531     }
532     }
533    
534     ## -- Rewrite the |parentNode| properties
535     for my $nc (@new_child) {
536 wakaba 1.13 $$nc->{
537     'parent'
538     } = $self;
539     Scalar::Util::weaken ($$nc->{
540     'parent'
541     });
542     }
543 wakaba 1.1
544 wakaba 1.13 my $children = $$self->{
545     'child'
546 wakaba 1.1 };
547    
548    
549    
550     {
551    
552    
553     ## -- Adds to children list
554 wakaba 1.13 push @$children, @new_child;
555 wakaba 1.1 $r = $newChild;
556    
557    
558    
559 wakaba 1.3 }
560 wakaba 1.1
561     ;
562    
563    
564    
565     ;
566    
567    
568    
569     ;
570    
571    
572    
573 wakaba 1.3 }
574 wakaba 1.1
575    
576     ;}
577    
578     ;
579    
580    
581 wakaba 1.3 }
582 wakaba 1.1
583     ;
584     if ($child_nt ==
585 wakaba 1.7 10 and
586 wakaba 1.1
587     not defined $newChild->
588     owner_document
589     ) {
590 wakaba 1.13 CORE::delete $$newChild->{
591     'impl'
592 wakaba 1.1 };
593 wakaba 1.13 $$newChild->{
594     'od'
595     } = $self;
596     Scalar::Util::weaken ($$newChild->{
597     'od'
598     });
599 wakaba 1.1 }
600    
601    
602 wakaba 1.3 }
603 wakaba 1.1 $r}
604     sub insert_before ($$;$) {
605     my ($self, $newChild, $refChild) = @_;
606     my $r;
607    
608     {
609    
610     my
611     $strictc = $self->
612     dom_config
613    
614     ->
615     get_parameter
616    
617     (
618     'http://suika.fam.cx/www/2006/dom-config/strict-document-children'
619     );
620     my $child_od = $newChild->
621     owner_document
622     || $self;
623     my $child_nt = $newChild->
624     node_type
625     ;
626     if ($strictc and $self->
627     strict_error_checking
628     ) {
629    
630    
631     {
632    
633     local $Error::Depth = $Error::Depth + 1;
634    
635     {
636    
637    
638     my
639     $has_el;
640     my $has_dt;
641     if ($child_nt ==
642 wakaba 1.7 1
643 wakaba 1.1 ) {
644     $has_el =
645     1
646     ;
647     } elsif ($child_nt ==
648 wakaba 1.7 10
649 wakaba 1.1 ) {
650     $has_dt =
651     1
652     ;
653     } elsif ($child_nt ==
654 wakaba 1.7 11
655 wakaba 1.1 ) {
656     for my $cn (@{$newChild->
657     child_nodes
658     }) {
659     my $cnt = $cn->
660     node_type
661     ;
662     if ($cnt ==
663 wakaba 1.7 1
664 wakaba 1.1 ) {
665     if ($has_el) {
666    
667    
668     {
669    
670     local $Error::Depth = $Error::Depth - 1;
671    
672     {
673    
674     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;
675    
676    
677 wakaba 1.3 }
678 wakaba 1.1
679    
680     ;}
681    
682     ;
683     }
684     $has_el =
685     1
686     ;
687     }
688     # DocumentType node cannot be contained in DocumentFragments
689     }
690     }
691    
692     if ($has_el) {
693     my $anode = $refChild ? $refChild->
694     previous_sibling
695     :
696     $self->
697     last_child
698     ;
699     while (defined $anode) {
700     if ($anode->
701     node_type
702     ==
703 wakaba 1.7 1
704 wakaba 1.1 ) {
705    
706    
707     {
708    
709     local $Error::Depth = $Error::Depth - 1;
710    
711     {
712    
713     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;
714    
715    
716 wakaba 1.3 }
717 wakaba 1.1
718    
719     ;}
720    
721     ;
722     }
723     $anode = $anode->
724     previous_sibling
725     ;
726     }
727     $anode = $refChild;
728     while (defined $anode) {
729     my $ant = $anode->
730     node_type
731     ;
732     if ($ant ==
733 wakaba 1.7 1
734 wakaba 1.1 ) {
735    
736    
737     {
738    
739     local $Error::Depth = $Error::Depth - 1;
740    
741     {
742    
743     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;
744    
745    
746 wakaba 1.3 }
747 wakaba 1.1
748    
749     ;}
750    
751     ;
752     } elsif ($ant ==
753 wakaba 1.7 10
754 wakaba 1.1 ) {
755    
756    
757     {
758    
759     local $Error::Depth = $Error::Depth - 1;
760    
761     {
762    
763     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;
764    
765    
766 wakaba 1.3 }
767 wakaba 1.1
768    
769     ;}
770    
771     ;
772     }
773     $anode = $anode->
774     next_sibling
775     ;
776     }
777     } # has_el
778     if ($has_dt) {
779     my $anode = $refChild ? $refChild->
780     previous_sibling
781     :
782     $self->
783     last_child
784     ;
785     while (defined $anode) {
786     my $ant = $anode->
787     node_type
788     ;
789     if ($ant ==
790 wakaba 1.7 1
791 wakaba 1.1 ) {
792    
793    
794     {
795    
796     local $Error::Depth = $Error::Depth - 1;
797    
798     {
799    
800     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;
801    
802    
803 wakaba 1.3 }
804 wakaba 1.1
805    
806     ;}
807    
808     ;
809     } elsif ($ant ==
810 wakaba 1.7 10
811 wakaba 1.1 ) {
812    
813    
814     {
815    
816     local $Error::Depth = $Error::Depth - 1;
817    
818     {
819    
820     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;
821    
822    
823 wakaba 1.3 }
824 wakaba 1.1
825    
826     ;}
827    
828     ;
829     }
830     $anode = $anode->
831     previous_sibling
832     ;
833     }
834     $anode = $refChild;
835     while (defined $anode) {
836     if ($anode->
837     node_type
838    
839     ==
840 wakaba 1.7 10
841 wakaba 1.1 ) {
842    
843    
844     {
845    
846     local $Error::Depth = $Error::Depth - 1;
847    
848     {
849    
850     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;
851    
852    
853 wakaba 1.3 }
854 wakaba 1.1
855    
856     ;}
857    
858     ;
859     }
860     $anode = $anode->
861     next_sibling
862     ;
863     }
864     } # has_dt
865    
866    
867    
868 wakaba 1.3 }
869 wakaba 1.1
870    
871     ;}
872    
873     ;
874     }
875    
876    
877     {
878    
879    
880     {
881    
882     local $Error::Depth = $Error::Depth + 1;
883    
884     {
885    
886    
887     my
888     $strict = $self->
889     strict_error_checking
890     ;
891    
892     ## -- Node Type check
893     my @new_child;
894     if ({
895 wakaba 1.7 3 => (not $strictc),
896     5 => (not $strictc),
897     1 => 1,
898     4 => (not $strictc),
899     7 => 1,
900     8 => 1,
901     10 => 1,
902 wakaba 1.1 }->{$child_nt}) {
903     push @new_child, $newChild;
904     } elsif ($child_nt ==
905 wakaba 1.7 11
906 wakaba 1.1 ) {
907     for my $cn (@{$newChild->
908     child_nodes
909     }) {
910     unless ({
911 wakaba 1.7 3 => (not $strictc),
912     5 => (not $strictc),
913     1 => 1,
914     4 => (not $strictc),
915     7 => 1,
916     8 => 1,
917     10 => 1,
918 wakaba 1.1 }->{$cn->
919     node_type
920     }) {
921    
922    
923     {
924    
925     local $Error::Depth = $Error::Depth - 1;
926    
927     {
928    
929     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;
930    
931    
932 wakaba 1.3 }
933 wakaba 1.1
934    
935     ;}
936    
937     ;
938     }
939     push @new_child, $cn;
940     }
941     } else {
942    
943    
944     {
945    
946     local $Error::Depth = $Error::Depth - 1;
947    
948     {
949    
950     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;
951    
952    
953 wakaba 1.3 }
954 wakaba 1.1
955    
956     ;}
957    
958     ;
959     }
960    
961     my $nc_parent = @new_child ? $new_child[0]->
962     parent_node
963     :
964    
965     undef
966     ;
967     if ($strict) {
968     ## -- Wrong-document check
969     unless ($self eq $child_od) {
970    
971    
972     {
973    
974     local $Error::Depth = $Error::Depth - 1;
975    
976     {
977    
978     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;
979    
980    
981 wakaba 1.3 }
982 wakaba 1.1
983    
984     ;}
985    
986     ;
987     }
988    
989     ## -- Read-onlyness check
990     if ($self->
991     manakai_read_only
992     ) {
993    
994    
995     {
996    
997     local $Error::Depth = $Error::Depth - 1;
998    
999     {
1000    
1001     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';
1002    
1003    
1004 wakaba 1.3 }
1005 wakaba 1.1
1006    
1007     ;}
1008    
1009     ;
1010     }
1011     if (@new_child) {
1012     if ($nc_parent and
1013     $nc_parent->
1014     manakai_read_only
1015     ) {
1016    
1017    
1018     {
1019    
1020     local $Error::Depth = $Error::Depth - 1;
1021    
1022     {
1023    
1024     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';
1025    
1026    
1027 wakaba 1.3 }
1028 wakaba 1.1
1029    
1030     ;}
1031    
1032     ;
1033     }
1034     }
1035     }
1036    
1037     ## -- Insert at...
1038     my $index = -1; # last
1039    
1040    
1041     {
1042    
1043    
1044     # tc:ForAppendChild & tc:ForReplaceChild
1045     if (defined $refChild) {
1046     if ($refChild eq $newChild) {
1047    
1048    
1049     {
1050    
1051    
1052     {
1053    
1054     local $Error::Depth = $Error::Depth - 1;
1055    
1056     {
1057    
1058     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';
1059    
1060    
1061 wakaba 1.3 }
1062 wakaba 1.1
1063    
1064     ;}
1065    
1066     ;
1067    
1068    
1069    
1070 wakaba 1.3 }
1071 wakaba 1.1
1072     ;
1073    
1074    
1075     ;
1076     }
1077    
1078     my $cns = $self->
1079     child_nodes
1080     ;
1081     my $cnsl = @$cns;
1082     C: {
1083     $index = 0;
1084     for my $i (0..($cnsl-1)) {
1085     my $cn = $cns->[$i];
1086     if ($cn eq $refChild) {
1087     $index += $i;
1088     last C;
1089     } elsif ($cn eq $newChild) {
1090     $index = -1; # offset
1091     }
1092     }
1093    
1094    
1095     {
1096    
1097    
1098     {
1099    
1100     local $Error::Depth = $Error::Depth - 1;
1101    
1102     {
1103    
1104     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;
1105    
1106    
1107 wakaba 1.3 }
1108 wakaba 1.1
1109    
1110     ;}
1111    
1112     ;
1113    
1114    
1115    
1116 wakaba 1.3 }
1117 wakaba 1.1
1118     ;
1119    
1120    
1121     ;
1122     } # C
1123     } else { # |oldChild| is not defined
1124    
1125    
1126     ;
1127     }
1128    
1129    
1130    
1131 wakaba 1.3 }
1132 wakaba 1.1
1133     ; # FOR !tc:ForAppendChild
1134    
1135     ## -- Removes from parent
1136     if ($nc_parent) {
1137     if ($child_nt ==
1138 wakaba 1.7 11
1139 wakaba 1.1 ) {
1140 wakaba 1.13 $$newChild->{
1141     'child'
1142     } = [];
1143 wakaba 1.1 } else {
1144 wakaba 1.13 my $v = $$nc_parent->{
1145     'child'
1146     };
1147 wakaba 1.1 RP: for my $i (0..$#$v) {
1148 wakaba 1.13 if ($v->[$i] eq $new_child[0]) {
1149 wakaba 1.1 splice @$v, $i, 1, ();
1150     last RP;
1151     }
1152     } # RP
1153     }
1154     }
1155    
1156     ## -- Rewrite the |parentNode| properties
1157     for my $nc (@new_child) {
1158 wakaba 1.13 $$nc->{
1159     'parent'
1160     } = $self;
1161     Scalar::Util::weaken ($$nc->{
1162     'parent'
1163     });
1164     }
1165 wakaba 1.1
1166 wakaba 1.13 my $children = $$self->{
1167     'child'
1168 wakaba 1.1 };
1169    
1170    
1171    
1172     ;
1173    
1174    
1175    
1176     {
1177    
1178    
1179     ## -- Adds to children list
1180     if ($index == -1) {
1181 wakaba 1.13 push @$children, @new_child;
1182 wakaba 1.1 } else {
1183 wakaba 1.13 splice @$children, $index, 0, @new_child;
1184 wakaba 1.1 }
1185     $r = $newChild;
1186    
1187    
1188    
1189 wakaba 1.3 }
1190 wakaba 1.1
1191     ;
1192    
1193    
1194    
1195     ;
1196    
1197    
1198    
1199 wakaba 1.3 }
1200 wakaba 1.1
1201    
1202     ;}
1203    
1204     ;
1205    
1206    
1207 wakaba 1.3 }
1208 wakaba 1.1
1209     ;
1210     if ($child_nt ==
1211 wakaba 1.7 10 and
1212 wakaba 1.1
1213     not defined $newChild->
1214     owner_document
1215     ) {
1216 wakaba 1.13 CORE::delete $$newChild->{
1217     'impl'
1218 wakaba 1.1 };
1219 wakaba 1.13 $$newChild->{
1220     'od'
1221     } = $self;
1222     Scalar::Util::weaken ($$newChild->{
1223     'od'
1224     });
1225 wakaba 1.1 }
1226    
1227    
1228 wakaba 1.3 }
1229 wakaba 1.1 $r}
1230     sub replace_child ($$$) {
1231     my ($self, $newChild, $oldChild) = @_;
1232     my $r;
1233    
1234     {
1235    
1236     my
1237     $strictc = $self->
1238     dom_config
1239    
1240     ->
1241     get_parameter
1242    
1243     (
1244     'http://suika.fam.cx/www/2006/dom-config/strict-document-children'
1245     );
1246     my $child_od = $newChild->
1247     owner_document
1248     || $self;
1249     my $child_nt = $newChild->
1250     node_type
1251     ;
1252     if ($strictc and $self->
1253     strict_error_checking
1254     ) {
1255    
1256    
1257     {
1258    
1259     local $Error::Depth = $Error::Depth + 1;
1260    
1261     {
1262    
1263    
1264     my
1265     $has_el;
1266     my $has_dt;
1267     if ($child_nt ==
1268 wakaba 1.7 1
1269 wakaba 1.1 ) {
1270     $has_el =
1271     1
1272     ;
1273     } elsif ($child_nt ==
1274 wakaba 1.7 10
1275 wakaba 1.1 ) {
1276     $has_dt =
1277     1
1278     ;
1279     } elsif ($child_nt ==
1280 wakaba 1.7 11
1281 wakaba 1.1 ) {
1282     for my $cn (@{$newChild->
1283     child_nodes
1284     }) {
1285     my $cnt = $cn->
1286     node_type
1287     ;
1288     if ($cnt ==
1289 wakaba 1.7 1
1290 wakaba 1.1 ) {
1291     if ($has_el) {
1292    
1293    
1294     {
1295    
1296     local $Error::Depth = $Error::Depth - 1;
1297    
1298     {
1299    
1300     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;
1301    
1302    
1303 wakaba 1.3 }
1304 wakaba 1.1
1305    
1306     ;}
1307    
1308     ;
1309     }
1310     $has_el =
1311     1
1312     ;
1313     }
1314     # DocumentType node cannot be contained in DocumentFragments
1315     }
1316     }
1317    
1318     if ($has_el) {
1319     my $anode = $oldChild->
1320     previous_sibling
1321     ;
1322     while (defined $anode) {
1323     if ($anode->
1324     node_type
1325     ==
1326 wakaba 1.7 1
1327 wakaba 1.1 ) {
1328    
1329    
1330     {
1331    
1332     local $Error::Depth = $Error::Depth - 1;
1333    
1334     {
1335    
1336     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;
1337    
1338    
1339 wakaba 1.3 }
1340 wakaba 1.1
1341    
1342     ;}
1343    
1344     ;
1345     }
1346     $anode = $anode->
1347     previous_sibling
1348     ;
1349     }
1350     $anode = $oldChild->
1351     next_sibling
1352     ;
1353     while (defined $anode) {
1354     my $ant = $anode->
1355     node_type
1356     ;
1357     if ($ant ==
1358 wakaba 1.7 1
1359 wakaba 1.1 ) {
1360    
1361    
1362     {
1363    
1364     local $Error::Depth = $Error::Depth - 1;
1365    
1366     {
1367    
1368     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;
1369    
1370    
1371 wakaba 1.3 }
1372 wakaba 1.1
1373    
1374     ;}
1375    
1376     ;
1377     } elsif ($ant ==
1378 wakaba 1.7 10
1379 wakaba 1.1 ) {
1380    
1381    
1382     {
1383    
1384     local $Error::Depth = $Error::Depth - 1;
1385    
1386     {
1387    
1388     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;
1389    
1390    
1391 wakaba 1.3 }
1392 wakaba 1.1
1393    
1394     ;}
1395    
1396     ;
1397     }
1398     $anode = $anode->
1399     next_sibling
1400     ;
1401     }
1402     } # has_el
1403     if ($has_dt) {
1404     my $anode = $oldChild->
1405     previous_sibling
1406     ;
1407     while (defined $anode) {
1408     my $ant = $anode->
1409     node_type
1410     ;
1411     if ($ant ==
1412 wakaba 1.7 1
1413 wakaba 1.1 ) {
1414    
1415    
1416     {
1417    
1418     local $Error::Depth = $Error::Depth - 1;
1419    
1420     {
1421    
1422     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;
1423    
1424    
1425 wakaba 1.3 }
1426 wakaba 1.1
1427    
1428     ;}
1429    
1430     ;
1431     } elsif ($ant ==
1432 wakaba 1.7 10
1433 wakaba 1.1 ) {
1434    
1435    
1436     {
1437    
1438     local $Error::Depth = $Error::Depth - 1;
1439    
1440     {
1441    
1442     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;
1443    
1444    
1445 wakaba 1.3 }
1446 wakaba 1.1
1447    
1448     ;}
1449    
1450     ;
1451     }
1452     $anode = $anode->
1453     previous_sibling
1454     ;
1455     }
1456     $anode = $oldChild->
1457     next_sibling
1458     ;
1459     while (defined $anode) {
1460     if ($anode->
1461     node_type
1462    
1463     ==
1464 wakaba 1.7 10
1465 wakaba 1.1 ) {
1466    
1467    
1468     {
1469    
1470     local $Error::Depth = $Error::Depth - 1;
1471    
1472     {
1473    
1474     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;
1475    
1476    
1477 wakaba 1.3 }
1478 wakaba 1.1
1479    
1480     ;}
1481    
1482     ;
1483     }
1484     $anode = $anode->
1485     next_sibling
1486     ;
1487     }
1488     } # has_dt
1489    
1490    
1491    
1492 wakaba 1.3 }
1493 wakaba 1.1
1494    
1495     ;}
1496    
1497     ;
1498     }
1499    
1500    
1501     {
1502    
1503    
1504     {
1505    
1506     local $Error::Depth = $Error::Depth + 1;
1507    
1508     {
1509    
1510    
1511     my
1512     $strict = $self->
1513     strict_error_checking
1514     ;
1515    
1516     ## -- Node Type check
1517     my @new_child;
1518     if ({
1519 wakaba 1.7 3 => (not $strictc),
1520     5 => (not $strictc),
1521     1 => 1,
1522     4 => (not $strictc),
1523     7 => 1,
1524     8 => 1,
1525     10 => 1,
1526 wakaba 1.1 }->{$child_nt}) {
1527     push @new_child, $newChild;
1528     } elsif ($child_nt ==
1529 wakaba 1.7 11
1530 wakaba 1.1 ) {
1531     for my $cn (@{$newChild->
1532     child_nodes
1533     }) {
1534     unless ({
1535 wakaba 1.7 3 => (not $strictc),
1536     5 => (not $strictc),
1537     1 => 1,
1538     4 => (not $strictc),
1539     7 => 1,
1540     8 => 1,
1541     10 => 1,
1542 wakaba 1.1 }->{$cn->
1543     node_type
1544     }) {
1545    
1546    
1547     {
1548    
1549     local $Error::Depth = $Error::Depth - 1;
1550    
1551     {
1552    
1553     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;
1554    
1555    
1556 wakaba 1.3 }
1557 wakaba 1.1
1558    
1559     ;}
1560    
1561     ;
1562     }
1563     push @new_child, $cn;
1564     }
1565     } else {
1566    
1567    
1568     {
1569    
1570     local $Error::Depth = $Error::Depth - 1;
1571    
1572     {
1573    
1574     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;
1575    
1576    
1577 wakaba 1.3 }
1578 wakaba 1.1
1579    
1580     ;}
1581    
1582     ;
1583     }
1584    
1585     my $nc_parent = @new_child ? $new_child[0]->
1586     parent_node
1587     :
1588    
1589     undef
1590     ;
1591     if ($strict) {
1592     ## -- Wrong-document check
1593     unless ($self eq $child_od) {
1594    
1595    
1596     {
1597    
1598     local $Error::Depth = $Error::Depth - 1;
1599    
1600     {
1601    
1602     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;
1603    
1604    
1605 wakaba 1.3 }
1606 wakaba 1.1
1607    
1608     ;}
1609    
1610     ;
1611     }
1612    
1613     ## -- Read-onlyness check
1614     if ($self->
1615     manakai_read_only
1616     ) {
1617    
1618    
1619     {
1620    
1621     local $Error::Depth = $Error::Depth - 1;
1622    
1623     {
1624    
1625     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';
1626    
1627    
1628 wakaba 1.3 }
1629 wakaba 1.1
1630    
1631     ;}
1632    
1633     ;
1634     }
1635     if (@new_child) {
1636     if ($nc_parent and
1637     $nc_parent->
1638     manakai_read_only
1639     ) {
1640    
1641    
1642     {
1643    
1644     local $Error::Depth = $Error::Depth - 1;
1645    
1646     {
1647    
1648     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';
1649    
1650    
1651 wakaba 1.3 }
1652 wakaba 1.1
1653    
1654     ;}
1655    
1656     ;
1657     }
1658     }
1659     }
1660    
1661     ## -- Insert at...
1662     my $index = -1; # last
1663    
1664    
1665     {
1666    
1667    
1668     # tc:ForAppendChild & tc:ForReplaceChild
1669     if (defined $oldChild) {
1670     if ($oldChild eq $newChild) {
1671    
1672    
1673     ;
1674    
1675    
1676     {
1677    
1678    
1679     {
1680    
1681     local $Error::Depth = $Error::Depth - 1;
1682    
1683     {
1684    
1685     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';
1686    
1687    
1688 wakaba 1.3 }
1689 wakaba 1.1
1690    
1691     ;}
1692    
1693     ;
1694    
1695    
1696    
1697 wakaba 1.3 }
1698 wakaba 1.1
1699     ;
1700     }
1701    
1702     my $cns = $self->
1703     child_nodes
1704     ;
1705     my $cnsl = @$cns;
1706     C: {
1707     $index = 0;
1708     for my $i (0..($cnsl-1)) {
1709     my $cn = $cns->[$i];
1710     if ($cn eq $oldChild) {
1711     $index += $i;
1712     last C;
1713     } elsif ($cn eq $newChild) {
1714     $index = -1; # offset
1715     }
1716     }
1717    
1718    
1719     ;
1720    
1721    
1722     {
1723    
1724    
1725     {
1726    
1727     local $Error::Depth = $Error::Depth - 1;
1728    
1729     {
1730    
1731     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;
1732    
1733    
1734 wakaba 1.3 }
1735 wakaba 1.1
1736    
1737     ;}
1738    
1739     ;
1740    
1741    
1742    
1743 wakaba 1.3 }
1744 wakaba 1.1
1745     ;
1746     } # C
1747     } else { # |oldChild| is not defined
1748    
1749    
1750     {
1751    
1752    
1753     {
1754    
1755     local $Error::Depth = $Error::Depth - 1;
1756    
1757     {
1758    
1759     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;
1760    
1761    
1762 wakaba 1.3 }
1763 wakaba 1.1
1764    
1765     ;}
1766    
1767     ;
1768    
1769    
1770    
1771 wakaba 1.3 }
1772 wakaba 1.1
1773     ;
1774     }
1775    
1776    
1777    
1778 wakaba 1.3 }
1779 wakaba 1.1
1780     ; # FOR !tc:ForAppendChild
1781    
1782     ## -- Removes from parent
1783     if ($nc_parent) {
1784     if ($child_nt ==
1785 wakaba 1.7 11
1786 wakaba 1.1 ) {
1787 wakaba 1.13 $$newChild->{
1788     'child'
1789     } = [];
1790 wakaba 1.1 } else {
1791 wakaba 1.13 my $v = $$nc_parent->{
1792     'child'
1793     };
1794 wakaba 1.1 RP: for my $i (0..$#$v) {
1795 wakaba 1.13 if ($v->[$i] eq $new_child[0]) {
1796 wakaba 1.1 splice @$v, $i, 1, ();
1797     last RP;
1798     }
1799     } # RP
1800     }
1801     }
1802    
1803     ## -- Rewrite the |parentNode| properties
1804     for my $nc (@new_child) {
1805 wakaba 1.13 $$nc->{
1806     'parent'
1807     } = $self;
1808     Scalar::Util::weaken ($$nc->{
1809     'parent'
1810     });
1811     }
1812 wakaba 1.1
1813 wakaba 1.13 my $children = $$self->{
1814     'child'
1815     };
1816 wakaba 1.1
1817 wakaba 1.13
1818 wakaba 1.1
1819 wakaba 1.13 ;
1820 wakaba 1.1
1821 wakaba 1.13
1822 wakaba 1.1
1823     ;
1824    
1825    
1826    
1827     {
1828    
1829    
1830 wakaba 1.13 ## -- Replaces the node
1831     splice @$children, $index, 1, @new_child;
1832     CORE::delete $$oldChild->{
1833     'parent'
1834     };
1835     $r = $oldChild;
1836    
1837 wakaba 1.1
1838    
1839 wakaba 1.3 }
1840 wakaba 1.1
1841     ;
1842    
1843    
1844    
1845 wakaba 1.13 }
1846    
1847    
1848     ;}
1849 wakaba 1.1
1850     ;
1851    
1852    
1853 wakaba 1.13 }
1854 wakaba 1.1
1855 wakaba 1.13 ;
1856 wakaba 1.1 if ($child_nt ==
1857 wakaba 1.7 10 and
1858 wakaba 1.1
1859     not defined $newChild->
1860     owner_document
1861     ) {
1862 wakaba 1.13 CORE::delete $$newChild->{
1863     'impl'
1864 wakaba 1.1 };
1865 wakaba 1.13 $$newChild->{
1866     'od'
1867     } = $self;
1868     Scalar::Util::weaken ($$newChild->{
1869     'od'
1870     });
1871 wakaba 1.1 }
1872    
1873    
1874 wakaba 1.3 }
1875 wakaba 1.1 $r}
1876     sub manakai_append_text ($$) {
1877     my ($self, $string) = @_;
1878     my $r;
1879    
1880     {
1881    
1882    
1883     {
1884    
1885     local $Error::Depth = $Error::Depth + 1;
1886    
1887     {
1888    
1889    
1890     unless
1891     ($self->
1892     dom_config
1893    
1894     ->
1895     get_parameter
1896    
1897     (
1898     'http://suika.fam.cx/www/2006/dom-config/strict-document-children'
1899     )) {
1900     my $lc = $self->
1901     last_child
1902     ;
1903     if (defined $lc and
1904     $lc->
1905     node_type
1906     ==
1907 wakaba 1.7 3
1908 wakaba 1.1 ) {
1909     $lc->
1910     manakai_append_text
1911    
1912     (ref $string eq 'SCALAR' ? $string : \$string);
1913     } else {
1914     my $text = $self->
1915     create_text_node
1916    
1917     (ref $string eq 'SCALAR' ? $$string : $string);
1918     $self->
1919     append_child
1920     ($text);
1921     }
1922     }
1923     $r = $self;
1924    
1925    
1926    
1927 wakaba 1.3 }
1928 wakaba 1.1
1929    
1930     ;}
1931    
1932     ;
1933    
1934    
1935 wakaba 1.3 }
1936 wakaba 1.1 $r}
1937     sub remove_child ($$) {
1938     my ($self, $oldChild) = @_;
1939     my $r;
1940    
1941     {
1942    
1943     if
1944     ($self->
1945     strict_error_checking and
1946    
1947     $self->
1948     manakai_read_only
1949     ) {
1950    
1951     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';
1952    
1953     ;
1954     }
1955    
1956    
1957     {
1958    
1959     F:
1960     {
1961     my $i = -1;
1962 wakaba 1.13 my $v = $$self->{
1963     'child'
1964     };
1965     for my $cld (@$v) {
1966 wakaba 1.1 $i++;
1967     if ($cld eq $oldChild) {
1968     splice @$v, $i, 1, ();
1969 wakaba 1.13 CORE::delete $$oldChild->{
1970     'parent'
1971     };
1972 wakaba 1.1 $r = $oldChild;
1973     last F;
1974     }
1975     }
1976    
1977     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;
1978    
1979     ;
1980     } # F
1981    
1982    
1983 wakaba 1.3 }
1984 wakaba 1.1
1985     ;
1986    
1987    
1988 wakaba 1.3 }
1989 wakaba 1.1 $r}
1990     sub node_name ($;$) {
1991     if (@_ == 1) {my ($self) = @_;
1992 wakaba 1.12 my $r = '';
1993 wakaba 1.1 $r = '#document';
1994     $r;
1995     } else {my ($self) = @_;
1996     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';
1997     }
1998     }
1999     sub text_content ($;$) {
2000     if (@_ == 1) {my ($self) = @_;
2001 wakaba 1.12 my $r = '';
2002 wakaba 1.1
2003     {
2004    
2005    
2006     {
2007    
2008     local $Error::Depth = $Error::Depth + 1;
2009    
2010     {
2011    
2012    
2013     if
2014     ($self->
2015     dom_config
2016    
2017     ->
2018     get_parameter
2019    
2020     (
2021     'http://suika.fam.cx/www/2006/dom-config/strict-document-children'
2022     )) {
2023     $r =
2024     undef
2025     ;
2026     } else {
2027     $r = '';
2028     my @target = @{$self->
2029     child_nodes
2030     };
2031     C: for my $node (@target) {
2032     my $nt = $node->
2033     node_type
2034     ;
2035     if ($nt ==
2036 wakaba 1.7 3 or
2037 wakaba 1.1
2038     $nt ==
2039 wakaba 1.7 4
2040 wakaba 1.1 ) {
2041     $r .= $node->
2042     data
2043     unless
2044     $node->
2045     is_element_content_whitespace
2046     ;
2047     } elsif ($nt ==
2048 wakaba 1.7 1 or
2049 wakaba 1.1
2050     $nt ==
2051 wakaba 1.7 5
2052 wakaba 1.1 ) {
2053     unshift @target, @{$node->
2054     child_nodes
2055     };
2056     }
2057     }
2058     }
2059    
2060    
2061    
2062 wakaba 1.3 }
2063 wakaba 1.1
2064    
2065     ;}
2066    
2067     ;
2068    
2069    
2070 wakaba 1.3 }
2071 wakaba 1.1 $r;
2072     } else {my ($self, $given) = @_;
2073    
2074     {
2075    
2076     if
2077     ($self->
2078     dom_config
2079    
2080     ->
2081     get_parameter
2082    
2083     (
2084     'http://suika.fam.cx/www/2006/dom-config/strict-document-children'
2085     )) {
2086    
2087     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';
2088    
2089     ;
2090     } else {
2091    
2092    
2093     {
2094    
2095    
2096     {
2097    
2098     if
2099     ($self->
2100     manakai_read_only
2101     ) {
2102    
2103     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';
2104    
2105     ;
2106     }
2107    
2108    
2109 wakaba 1.3 }
2110 wakaba 1.1
2111     ;
2112 wakaba 1.10
2113 wakaba 1.13 for my $__old_child (@{${$self}->{
2114     'child'
2115     }}) {
2116     CORE::delete $$__old_child->{
2117     'parent'
2118 wakaba 1.10 };
2119     }
2120 wakaba 1.1
2121 wakaba 1.10 my @__new_children;
2122     if (defined $given and length $given) {
2123     my $__text = $self->
2124     create_text_node
2125     ($given);
2126 wakaba 1.13 push @__new_children, $__text;
2127     $$__text->{
2128     'parent'
2129     } = $self;
2130     Scalar::Util::weaken ($$__text->{
2131     'parent'
2132     });
2133 wakaba 1.10 }
2134 wakaba 1.1
2135 wakaba 1.13 ${$self}->{
2136     'child'
2137     } = \@__new_children;
2138 wakaba 1.1
2139    
2140 wakaba 1.3 }
2141 wakaba 1.1
2142     ;
2143     }
2144    
2145    
2146 wakaba 1.3 }
2147 wakaba 1.1 }
2148 wakaba 1.10 }
2149     sub get_feature ($$$) {
2150     my ($self, $feature, $version) = @_;
2151 wakaba 1.1
2152 wakaba 1.10 {
2153 wakaba 1.1
2154    
2155 wakaba 1.10 $feature = lc $feature;
2156 wakaba 1.1
2157    
2158 wakaba 1.10 }
2159 wakaba 1.1
2160 wakaba 1.10 {
2161 wakaba 1.1
2162    
2163 wakaba 1.10 $version = '' unless defined $version;
2164 wakaba 1.1
2165    
2166 wakaba 1.3 }
2167 wakaba 1.10 my $r;
2168    
2169     {
2170 wakaba 1.1
2171    
2172 wakaba 1.10 $feature =~ s/^\+//;
2173 wakaba 1.1
2174    
2175     {
2176    
2177 wakaba 1.10 if
2178     ($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) {
2179     $r = $self;
2180     }
2181 wakaba 1.1
2182    
2183 wakaba 1.3 }
2184 wakaba 1.1
2185     ;
2186 wakaba 1.10 unless (defined $r) {
2187    
2188 wakaba 1.1
2189     {
2190    
2191     local $Error::Depth = $Error::Depth + 1;
2192    
2193     {
2194    
2195    
2196    
2197 wakaba 1.10 $r = $self->SUPER::get_feature ($feature, $version);
2198    
2199 wakaba 1.1
2200    
2201 wakaba 1.3 }
2202 wakaba 1.1
2203    
2204     ;}
2205    
2206     ;
2207 wakaba 1.10 }
2208 wakaba 1.1
2209    
2210 wakaba 1.3 }
2211 wakaba 1.1 $r}
2212 wakaba 1.10 sub base_uri ($;$) {
2213     if (@_ == 1) {my ($self) = @_;
2214 wakaba 1.12 my $r = '';
2215 wakaba 1.10
2216     {
2217    
2218 wakaba 1.1
2219 wakaba 1.13 $r = $$self->{
2220     'buri'
2221     };
2222 wakaba 1.10 unless (defined $r) {
2223 wakaba 1.13 $r = $$self->{
2224     'duri'
2225     };
2226 wakaba 1.1 }
2227    
2228    
2229 wakaba 1.3 }
2230 wakaba 1.10 $r;
2231     } else {my ($self) = @_;
2232     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';
2233     }
2234     }
2235     sub create_document_fragment ($) {
2236     my ($self) = @_;
2237     my $r;
2238 wakaba 1.1
2239 wakaba 1.10 {
2240 wakaba 1.1
2241    
2242 wakaba 1.13 $r = bless \({
2243 wakaba 1.1
2244 wakaba 1.13 'od'
2245     => $self,
2246 wakaba 1.1
2247 wakaba 1.13 'child'
2248     => [],
2249     }),
2250     'Message::DOM::Document::ManakaiDOMDocumentFragment'
2251     ;
2252     Scalar::Util::weaken ($$r->{
2253     'od'
2254     });
2255 wakaba 1.1
2256    
2257 wakaba 1.3 }
2258 wakaba 1.1 $r}
2259     sub strict_error_checking ($;$) {
2260     if (@_ == 1) {my ($self) = @_;
2261     my $r = 0;
2262    
2263     {
2264    
2265    
2266 wakaba 1.13 $r = $$self->{
2267     'chk'
2268     };
2269 wakaba 1.1
2270    
2271 wakaba 1.3 }
2272 wakaba 1.1 $r;
2273     } else {my ($self, $given) = @_;
2274    
2275     {
2276    
2277    
2278 wakaba 1.13 $$self->{
2279     'chk'
2280     } = $given;
2281 wakaba 1.1
2282    
2283 wakaba 1.3 }
2284 wakaba 1.1 }
2285     }
2286     sub dom_config ($;$) {
2287     if (@_ == 1) {my ($self) = @_;
2288     my $r;
2289    
2290     {
2291    
2292    
2293     {
2294    
2295    
2296 wakaba 1.13 $r = bless [$self, $$self, 'Message::DOM::IFLatest::Document'],
2297 wakaba 1.1
2298     'Message::DOM::DOMCore::ManakaiDOMConfiguration'
2299     ;
2300    
2301    
2302 wakaba 1.3 }
2303 wakaba 1.1
2304     ;
2305    
2306    
2307 wakaba 1.3 }
2308 wakaba 1.1 $r;
2309     } else {my ($self) = @_;
2310     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';
2311     }
2312     }
2313     sub document_element ($;$) {
2314     if (@_ == 1) {my ($self) = @_;
2315     my $r;
2316    
2317     {
2318    
2319    
2320     {
2321    
2322     local $Error::Depth = $Error::Depth + 1;
2323    
2324     {
2325    
2326    
2327     F:
2328     for my $child (@{$self->
2329     child_nodes
2330     }) {
2331     if ($child->
2332     node_type
2333     ==
2334 wakaba 1.7 1
2335 wakaba 1.1 ) {
2336     $r = $child;
2337     last F;
2338     }
2339     } # F
2340    
2341    
2342    
2343 wakaba 1.3 }
2344 wakaba 1.1
2345    
2346     ;}
2347    
2348     ;
2349    
2350    
2351 wakaba 1.3 }
2352 wakaba 1.1 $r;
2353     } else {my ($self) = @_;
2354     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';
2355     }
2356     }
2357     sub implementation ($;$) {
2358     if (@_ == 1) {my ($self) = @_;
2359     my $r;
2360    
2361     {
2362    
2363    
2364 wakaba 1.13 $r = $$self->{
2365     'impl'
2366     };
2367 wakaba 1.1
2368    
2369 wakaba 1.3 }
2370 wakaba 1.1 $r;
2371     } else {my ($self) = @_;
2372     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';
2373     }
2374     }
2375     sub xml_version ($;$) {
2376     if (@_ == 1) {my ($self) = @_;
2377 wakaba 1.12 my $r = '';
2378 wakaba 1.1
2379     {
2380    
2381    
2382 wakaba 1.13 $r = $$self->{
2383     'http://www.w3.org/2001/04/infoset#version'
2384     };
2385 wakaba 1.1
2386    
2387 wakaba 1.3 }
2388 wakaba 1.1 $r;
2389     } else {my ($self, $given) = @_;
2390    
2391     {
2392    
2393    
2394     {
2395    
2396     if
2397     ($self->
2398     manakai_read_only
2399     ) {
2400    
2401     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';
2402    
2403     ;
2404     }
2405    
2406    
2407 wakaba 1.3 }
2408 wakaba 1.1
2409     ;
2410     if (defined $given and
2411     ($given eq '1.0' or $given eq '1.1' or
2412     not $self->
2413     strict_error_checking
2414     )) {
2415 wakaba 1.13 $$self->{
2416     'http://www.w3.org/2001/04/infoset#version'
2417     } = $given;
2418 wakaba 1.1 } else {
2419    
2420     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;
2421    
2422     ;
2423     }
2424    
2425    
2426 wakaba 1.3 }
2427 wakaba 1.1 }
2428     }
2429     sub doctype ($;$) {
2430     if (@_ == 1) {my ($self) = @_;
2431     my $r;
2432    
2433     {
2434    
2435    
2436     {
2437    
2438     local $Error::Depth = $Error::Depth + 1;
2439    
2440     {
2441    
2442    
2443     F:
2444     for my $child (@{$self->
2445     child_nodes
2446     }) {
2447     my $nt = $child->
2448     node_type
2449     ;
2450     if ($nt ==
2451 wakaba 1.7 10
2452 wakaba 1.1 ) {
2453     $r = $child;
2454     last F;
2455     } elsif ($nt ==
2456 wakaba 1.7 1
2457 wakaba 1.1 ) { # document element
2458     last F;
2459     }
2460     } # F
2461    
2462    
2463    
2464 wakaba 1.3 }
2465 wakaba 1.1
2466    
2467     ;}
2468    
2469     ;
2470    
2471    
2472 wakaba 1.3 }
2473 wakaba 1.1 $r;
2474     } else {my ($self) = @_;
2475     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';
2476     }
2477     }
2478     sub document_uri ($;$) {
2479     if (@_ == 1) {my ($self) = @_;
2480     my $r = '';
2481    
2482     {
2483    
2484    
2485 wakaba 1.13 $r = $$self->{
2486     'duri'
2487     };
2488 wakaba 1.1
2489    
2490 wakaba 1.3 }
2491 wakaba 1.1 $r;
2492     } else {my ($self, $given) = @_;
2493    
2494     {
2495    
2496    
2497     {
2498    
2499     if
2500     ($self->
2501     manakai_read_only
2502     ) {
2503    
2504     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';
2505    
2506     ;
2507     }
2508    
2509    
2510 wakaba 1.3 }
2511 wakaba 1.1
2512     ;
2513 wakaba 1.13 $$self->{
2514     'duri'
2515     } = $given;
2516 wakaba 1.1
2517    
2518 wakaba 1.3 }
2519 wakaba 1.1 }
2520     }
2521     sub input_encoding ($;$) {
2522     if (@_ == 1) {my ($self) = @_;
2523 wakaba 1.12 my $r = '';
2524 wakaba 1.1
2525     {
2526    
2527    
2528 wakaba 1.13 $r = $$self->{
2529     'ces'
2530     };
2531 wakaba 1.1
2532    
2533 wakaba 1.3 }
2534 wakaba 1.1 $r;
2535     } else {my ($self, $given) = @_;
2536    
2537     {
2538    
2539    
2540     {
2541    
2542     if
2543     ($self->
2544     manakai_read_only
2545     ) {
2546    
2547     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';
2548    
2549     ;
2550     }
2551    
2552    
2553 wakaba 1.3 }
2554 wakaba 1.1
2555     ;
2556 wakaba 1.13 $$self->{
2557     'ces'
2558     } = $given;
2559 wakaba 1.1
2560    
2561 wakaba 1.3 }
2562 wakaba 1.1 }
2563     }
2564     sub xml_encoding ($;$) {
2565     if (@_ == 1) {my ($self) = @_;
2566 wakaba 1.12 my $r = '';
2567 wakaba 1.1
2568     {
2569    
2570    
2571 wakaba 1.13 $r = $$self->{
2572     'xcs'
2573     };
2574 wakaba 1.1
2575    
2576 wakaba 1.3 }
2577 wakaba 1.1 $r;
2578     } else {my ($self, $given) = @_;
2579    
2580     {
2581    
2582    
2583     {
2584    
2585     if
2586     ($self->
2587     manakai_read_only
2588     ) {
2589    
2590     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';
2591    
2592     ;
2593     }
2594    
2595    
2596 wakaba 1.3 }
2597 wakaba 1.1
2598     ;
2599 wakaba 1.13 $$self->{
2600     'xcs'
2601     } = $given;
2602 wakaba 1.1
2603    
2604 wakaba 1.3 }
2605 wakaba 1.1 }
2606     }
2607     sub xml_standalone ($;$) {
2608     if (@_ == 1) {my ($self) = @_;
2609     my $r = 0;
2610    
2611     {
2612    
2613    
2614 wakaba 1.13 $r = $$self->{
2615     'http://www.w3.org/2001/04/infoset#standalone'
2616     };
2617 wakaba 1.1
2618    
2619 wakaba 1.3 }
2620 wakaba 1.1 $r;
2621     } else {my ($self, $given) = @_;
2622    
2623     {
2624    
2625    
2626     {
2627    
2628     if
2629     ($self->
2630     manakai_read_only
2631     ) {
2632    
2633     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';
2634    
2635     ;
2636     }
2637    
2638    
2639 wakaba 1.3 }
2640 wakaba 1.1
2641     ;
2642 wakaba 1.13 $$self->{
2643     'http://www.w3.org/2001/04/infoset#standalone'
2644     } = $given;
2645 wakaba 1.1
2646    
2647 wakaba 1.3 }
2648 wakaba 1.1 }
2649     }
2650     sub adopt_node ($$) {
2651     my ($self, $source) = @_;
2652     my $r;
2653    
2654     {
2655    
2656 wakaba 1.3 ADOPT:
2657     {
2658     last ADOPT
2659     unless $source->isa (
2660 wakaba 1.1 'Message::DOM::TreeCore::ManakaiDOMNode'
2661 wakaba 1.13 );
2662 wakaba 1.3
2663 wakaba 1.2 my $strict = $self->
2664     strict_error_checking
2665     ;
2666     if ($strict and $self->
2667 wakaba 1.1 manakai_read_only
2668     ) {
2669    
2670     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';
2671    
2672     ;
2673     }
2674     my $parent = $source->
2675     parent_node
2676     ;
2677 wakaba 1.2 if ($strict and defined $parent and
2678     $parent->
2679 wakaba 1.1 manakai_read_only
2680     ) {
2681    
2682     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';
2683    
2684     ;
2685     }
2686     my $nt = $source->
2687     node_type
2688     ;
2689     my $oe;
2690     if ($nt ==
2691 wakaba 1.7 2
2692 wakaba 1.1 ) {
2693     $oe = $source->
2694     owner_element
2695     ;
2696 wakaba 1.2 if ($strict and defined $oe and $oe->
2697 wakaba 1.1 manakai_read_only
2698     ) {
2699    
2700     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';
2701    
2702     ;
2703     }
2704     } elsif ($nt ==
2705 wakaba 1.7 9 or
2706 wakaba 1.1
2707     $nt ==
2708 wakaba 1.7 10 or
2709 wakaba 1.1
2710     $nt ==
2711 wakaba 1.7 6 or
2712 wakaba 1.1
2713     $nt ==
2714 wakaba 1.7 12
2715 wakaba 1.1 ) {
2716    
2717     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';
2718    
2719     ;
2720     }
2721    
2722     my @change_od;
2723     my @nodes = ($source);
2724     while (@nodes) {
2725     my $node = shift @nodes;
2726     my $nt = $node->
2727     node_type
2728     ;
2729 wakaba 1.2 if ($strict and $node->
2730 wakaba 1.1 manakai_read_only
2731     ) {
2732    
2733     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;
2734    
2735     ;
2736     }
2737     if ($nt ==
2738 wakaba 1.7 1
2739 wakaba 1.1 ) {
2740     push @change_od, $node;
2741     push @nodes, @{$node->
2742     child_nodes
2743     };
2744     my $attrs = $node->
2745     attributes
2746     ;
2747     my $attrsLength = $attrs->
2748     length
2749     ;
2750     for my $i (0..($attrsLength - 1)) {
2751     push @nodes, $attrs->
2752     item
2753     ($i);
2754     }
2755     } elsif ($nt ==
2756 wakaba 1.7 2 or
2757 wakaba 1.1
2758     $nt ==
2759 wakaba 1.7 5 or
2760 wakaba 1.1
2761     $nt ==
2762 wakaba 1.7 11
2763 wakaba 1.1 ) {
2764     push @change_od, $node;
2765     push @nodes, @{$node->
2766     child_nodes
2767     };
2768     } elsif ($nt ==
2769 wakaba 1.7 3 or
2770 wakaba 1.1
2771     $nt ==
2772 wakaba 1.7 8 or
2773 wakaba 1.1
2774     $nt ==
2775 wakaba 1.7 7 or
2776 wakaba 1.1
2777     $nt ==
2778 wakaba 1.7 4
2779 wakaba 1.1 ) {
2780     push @change_od, $node;
2781     } else {
2782     ## TODO: assertion
2783     }
2784     } # nodes
2785    
2786 wakaba 1.2
2787 wakaba 1.1
2788     {
2789    
2790     local $Error::Depth = $Error::Depth + 1;
2791    
2792     {
2793    
2794    
2795 wakaba 1.2 if
2796     (defined $parent) {
2797 wakaba 1.1 $parent->
2798     remove_child
2799     ($source);
2800 wakaba 1.2 } elsif (defined $oe) {
2801 wakaba 1.1 $oe->
2802     remove_attribute_node
2803     ($source);
2804 wakaba 1.2 }
2805    
2806 wakaba 1.1
2807    
2808 wakaba 1.3 }
2809 wakaba 1.1
2810    
2811 wakaba 1.13 ;}
2812 wakaba 1.1
2813 wakaba 1.13 ;
2814 wakaba 1.1
2815 wakaba 1.13 $r = $source;
2816     my $old_od = $change_od[0]->
2817     owner_document
2818     ;
2819     ## NOTE: The array must have more than zero
2820     ## nodes by definition. In addition,
2821     ## it cannot contain document or document
2822     ## type nodes in current implementation.
2823 wakaba 1.1
2824 wakaba 1.13 if ($old_od eq $self) {
2825     last ADOPT;
2826     }
2827 wakaba 1.1
2828 wakaba 1.13 for my $n (@change_od) {
2829     $$n->{
2830     'od'
2831     } = $self;
2832     Scalar::Util::weaken ($$n->{
2833     'od'
2834     });
2835     }
2836 wakaba 1.1
2837 wakaba 1.13 for my $src (@change_od) {
2838     my $src_ud = $$src->{
2839     'ud'
2840     };
2841 wakaba 1.1 for my $key (keys %{$src_ud or {}}) {
2842     my $dh = $src_ud->{$key}->[1];
2843     if ($dh) {
2844     $dh->
2845     handle
2846    
2847     (
2848 wakaba 1.7 5
2849 wakaba 1.1 ,
2850     $key, $src_ud->{$key}->[0], $src,
2851     undef
2852     );
2853     }
2854     }
2855     }
2856 wakaba 1.3 } # ADOPT
2857 wakaba 1.1
2858    
2859 wakaba 1.3 }
2860 wakaba 1.1 $r}
2861     sub get_element_by_id ($$) {
2862     my ($self, $elementId) = @_;
2863     my $r;
2864    
2865     {
2866    
2867    
2868     {
2869    
2870     local $Error::Depth = $Error::Depth + 1;
2871    
2872     {
2873    
2874    
2875     my
2876     @nodes = @{$self->
2877     child_nodes
2878     };
2879     N: while (@nodes) {
2880     my $node = shift @nodes;
2881     next N unless $node->
2882     node_type
2883     ==
2884 wakaba 1.7 1
2885 wakaba 1.1 ;
2886     for my $attr (@{$node->
2887     attributes
2888     }) {
2889     if ($attr->
2890     is_id and
2891    
2892     $attr->
2893     value eq
2894     $elementId) {
2895     $r = $attr;
2896     last N;
2897     }
2898     }
2899     unshift @nodes, @{$node->
2900     child_nodes
2901     };
2902     } # N
2903    
2904    
2905    
2906 wakaba 1.3 }
2907 wakaba 1.1
2908    
2909     ;}
2910    
2911     ;
2912    
2913    
2914 wakaba 1.3 }
2915 wakaba 1.1 $r}
2916     sub get_elements_by_tag_name ($$) {
2917     my ($self, $name) = @_;
2918     my $r;
2919    
2920     {
2921    
2922    
2923     $name = "$name";
2924     my $chk;
2925     if ($name eq '*') {
2926     $chk = sub {
2927     1
2928     };
2929     } else {
2930     $chk = sub {
2931     my $node = shift;
2932     my $nodeName = $node->
2933     node_name
2934     ;
2935     ($nodeName eq $name);
2936     };
2937     }
2938    
2939    
2940     {
2941    
2942    
2943     $r = bless \[$self, $chk],
2944     'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList'
2945     ;
2946    
2947    
2948 wakaba 1.3 }
2949 wakaba 1.1
2950     ;
2951    
2952    
2953 wakaba 1.3 }
2954 wakaba 1.1 $r}
2955     sub get_elements_by_tag_name_ns ($$$) {
2956     my ($self, $namespaceURI, $localName) = @_;
2957    
2958     {
2959    
2960     if
2961     (CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) {
2962 wakaba 1.10 require Message::DOM::DOMMain;
2963 wakaba 1.1
2964 wakaba 1.13 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:1167371291:21034:x54Sv15711+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest';
2965 wakaba 1.1
2966     ;
2967    
2968    
2969    
2970     {
2971    
2972    
2973     $namespaceURI = undef;
2974    
2975    
2976    
2977 wakaba 1.3 }
2978 wakaba 1.1
2979     ;
2980     }
2981    
2982    
2983 wakaba 1.3 }
2984 wakaba 1.1 my $r;
2985    
2986     {
2987    
2988    
2989     $namespaceURI = "$namespaceURI" if defined $namespaceURI;
2990     $localName = "$localName";
2991     my $chk;
2992     if (not defined $namespaceURI) {
2993     if ($localName eq '*') {
2994     $chk = sub {
2995     my $node = shift;
2996     (not defined $node->
2997     namespace_uri
2998     );
2999     };
3000     } else {
3001     $chk = sub {
3002     my $node = shift;
3003     (not defined $node->
3004     namespace_uri and
3005    
3006     $node->
3007     local_name eq
3008     $localName);
3009     };
3010     }
3011     } elsif ($namespaceURI eq '*') {
3012     if ($localName eq '*') {
3013     $chk = sub {
3014     1
3015     };
3016     } else {
3017     $chk = sub {
3018     my $node = shift;
3019     ($node->
3020     local_name eq
3021     $localName);
3022     };
3023     }
3024     } else {
3025     if ($localName eq '*') {
3026     $chk = sub {
3027     my $node = shift;
3028     my $nsuri = $node->
3029     namespace_uri
3030     ;
3031     (defined $nsuri and $nsuri eq $namespaceURI);
3032     };
3033     } else {
3034     $chk = sub {
3035     my $node = shift;
3036     my $nsuri = $node->
3037     namespace_uri
3038     ;
3039     (defined $nsuri and $nsuri eq $namespaceURI and
3040     $node->
3041     local_name eq
3042     $localName);
3043     };
3044     }
3045     }
3046    
3047    
3048     {
3049    
3050    
3051     $r = bless \[$self, $chk],
3052     'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList'
3053     ;
3054    
3055    
3056 wakaba 1.3 }
3057 wakaba 1.1
3058     ;
3059    
3060    
3061 wakaba 1.3 }
3062 wakaba 1.1 $r}
3063     sub import_node ($$;$) {
3064     my ($self, $importedNode, $deep) = @_;
3065     my $r;
3066     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';
3067     $r}
3068     sub normalize_document ($) {
3069     my ($self) = @_;
3070     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';
3071     }
3072     sub rename_node ($$$$) {
3073     my ($self, $n, $namespaceURI, $qualifiedName) = @_;
3074    
3075     {
3076    
3077     if
3078     (CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) {
3079 wakaba 1.10 require Message::DOM::DOMMain;
3080 wakaba 1.1
3081 wakaba 1.13 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:1167371291:21034:x54Sv15711+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest';
3082 wakaba 1.1
3083     ;
3084    
3085    
3086    
3087     {
3088    
3089    
3090     $namespaceURI = undef;
3091    
3092    
3093    
3094 wakaba 1.3 }
3095 wakaba 1.1
3096     ;
3097     }
3098    
3099    
3100 wakaba 1.3 }
3101 wakaba 1.1 my $r;
3102     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';
3103     $r}
3104     sub manakai_entity_base_uri ($;$) {
3105     if (@_ == 1) {my ($self) = @_;
3106 wakaba 1.12 my $r = '';
3107 wakaba 1.1
3108     {
3109    
3110    
3111 wakaba 1.13 $r = $$self->{
3112     'buri'
3113     };
3114 wakaba 1.1 unless (defined $r) {
3115 wakaba 1.13 $r = $$self->{
3116     'duri'
3117     };
3118 wakaba 1.1 }
3119    
3120    
3121 wakaba 1.3 }
3122 wakaba 1.1 $r;
3123     } else {my ($self, $given) = @_;
3124    
3125     {
3126    
3127    
3128     {
3129    
3130     if
3131     ($self->
3132     manakai_read_only
3133     ) {
3134    
3135     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';
3136    
3137     ;
3138     }
3139    
3140    
3141 wakaba 1.3 }
3142 wakaba 1.1
3143     ;
3144 wakaba 1.13 $$self->{
3145     'buri'
3146     } = $given;
3147 wakaba 1.1
3148    
3149 wakaba 1.3 }
3150 wakaba 1.1 }
3151     }
3152     sub all_declarations_processed ($;$) {
3153     if (@_ == 1) {my ($self) = @_;
3154     my $r = 0;
3155    
3156     {
3157    
3158    
3159 wakaba 1.13 $r = $$self->{
3160     'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed'
3161     };
3162 wakaba 1.1
3163    
3164 wakaba 1.3 }
3165 wakaba 1.1 $r;
3166     } else {my ($self, $given) = @_;
3167    
3168     {
3169    
3170    
3171     {
3172    
3173     if
3174     ($self->
3175     manakai_read_only
3176     ) {
3177    
3178     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';
3179    
3180     ;
3181     }
3182    
3183    
3184 wakaba 1.3 }
3185 wakaba 1.1
3186     ;
3187 wakaba 1.13 $$self->{
3188     'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed'
3189     } = $given;
3190 wakaba 1.1
3191    
3192 wakaba 1.3 }
3193 wakaba 1.1 }
3194     }
3195     $Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocument>}->{has_feature} = {'core',
3196     {'',
3197     '1',
3198     '1.0',
3199     '1',
3200     '2.0',
3201     '1',
3202     '3.0',
3203     '1'},
3204     'xml',
3205     {'',
3206     '1',
3207     '1.0',
3208     '1',
3209     '2.0',
3210     '1',
3211     '3.0',
3212     '1'},
3213     'xmlversion',
3214     {'',
3215     '1',
3216     '1.0',
3217     '1',
3218     '1.1',
3219     '1'}};
3220     $Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocument>} = 14.1;
3221 wakaba 1.13 $Message::Util::Grove::ClassProp{q<Message::DOM::Document::ManakaiDOMDocument>} = {};
3222 wakaba 1.1 package Message::DOM::IFLatest::DocumentFragment;
3223 wakaba 1.13 our $VERSION = 20061229.0639;
3224 wakaba 1.1 package Message::DOM::Document::ManakaiDOMDocumentFragment;
3225 wakaba 1.13 our $VERSION = 20061229.0639;
3226 wakaba 1.1 push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode',
3227     'Message::DOM::IF::DocumentFragment',
3228     'Message::DOM::IF::Node',
3229     'Message::DOM::IFLatest::DocumentFragment',
3230     'Message::DOM::IFLatest::Node',
3231     'Message::DOM::IFLevel1::DocumentFragment',
3232     'Message::DOM::IFLevel1::Node',
3233     'Message::DOM::IFLevel2::DocumentFragment',
3234     'Message::DOM::IFLevel2::Node',
3235     'Message::DOM::IFLevel3::DocumentFragment',
3236     'Message::DOM::IFLevel3::Node';
3237     sub node_type ($;$) {
3238     if (@_ == 1) {my ($self) = @_;
3239     my $r;
3240 wakaba 1.7 $r = 11;
3241 wakaba 1.1 $r;
3242     } else {my ($self) = @_;
3243     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';
3244     }
3245     }
3246     sub append_child ($$) {
3247     my ($self, $newChild) = @_;
3248     my $r;
3249    
3250     {
3251    
3252     if
3253     ($self eq $newChild) {
3254    
3255     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';
3256    
3257     ;
3258     }
3259     my $self_od = $self->
3260     owner_document
3261     ;
3262     my $child_od = $newChild->
3263     owner_document
3264     ;
3265     my $child_nt = $newChild->
3266     node_type
3267     ;
3268    
3269    
3270     {
3271    
3272    
3273     {
3274    
3275     local $Error::Depth = $Error::Depth + 1;
3276    
3277     {
3278    
3279    
3280     my
3281     $strict = $self_od->
3282     strict_error_checking
3283     ;
3284    
3285     ## -- Node Type check
3286     my @new_child;
3287     if ({
3288 wakaba 1.7 3 => 1,
3289     5 => 1,
3290     1 => 1,
3291     7 => 1,
3292     4 => 1,
3293     8 => 1,
3294 wakaba 1.1 }->{$child_nt}) {
3295     push @new_child, $newChild;
3296     } elsif ($child_nt ==
3297 wakaba 1.7 11
3298 wakaba 1.1 ) {
3299     for my $cn (@{$newChild->
3300     child_nodes
3301     }) {
3302     unless ({
3303 wakaba 1.7 3 => 1,
3304     5 => 1,
3305     1 => 1,
3306     7 => 1,
3307     4 => 1,
3308     8 => 1,
3309 wakaba 1.1 }->{$cn->
3310     node_type
3311     }) {
3312    
3313    
3314     {
3315    
3316     local $Error::Depth = $Error::Depth - 1;
3317    
3318     {
3319    
3320     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;
3321    
3322    
3323 wakaba 1.3 }
3324 wakaba 1.1
3325    
3326     ;}
3327    
3328     ;
3329     }
3330     push @new_child, $cn;
3331     }
3332     } else {
3333    
3334    
3335     {
3336    
3337     local $Error::Depth = $Error::Depth - 1;
3338    
3339     {
3340    
3341     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;
3342    
3343    
3344 wakaba 1.3 }
3345 wakaba 1.1
3346    
3347     ;}
3348    
3349     ;
3350     }
3351    
3352     my $nc_parent = @new_child ? $new_child[0]->
3353     parent_node
3354     :
3355    
3356     undef
3357     ;
3358     if ($strict) {
3359     ## -- Wrong-document check
3360     unless ($self_od eq $child_od) {
3361    
3362    
3363     {
3364    
3365     local $Error::Depth = $Error::Depth - 1;
3366    
3367     {
3368    
3369     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;
3370    
3371    
3372 wakaba 1.3 }
3373 wakaba 1.1
3374    
3375     ;}
3376    
3377     ;
3378     }
3379    
3380     ## -- Read-onlyness check
3381     if ($self->
3382     manakai_read_only
3383     ) {
3384    
3385    
3386     {
3387    
3388     local $Error::Depth = $Error::Depth - 1;
3389    
3390     {
3391    
3392     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';
3393    
3394    
3395 wakaba 1.3 }
3396 wakaba 1.1
3397    
3398     ;}
3399    
3400     ;
3401     }
3402     if (@new_child) {
3403     if ($nc_parent and
3404     $nc_parent->
3405     manakai_read_only
3406     ) {
3407    
3408    
3409     {
3410    
3411     local $Error::Depth = $Error::Depth - 1;
3412    
3413     {
3414    
3415     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';
3416    
3417    
3418 wakaba 1.3 }
3419 wakaba 1.1
3420    
3421     ;}
3422    
3423     ;
3424     }
3425     }
3426     }
3427    
3428     ## -- Insert at...
3429     my $index = -1; # last
3430    
3431    
3432     ; # FOR !tc:ForAppendChild
3433    
3434     ## -- Removes from parent
3435     if ($nc_parent) {
3436     if ($child_nt ==
3437 wakaba 1.7 11
3438 wakaba 1.1 ) {
3439 wakaba 1.13 $$newChild->{
3440     'child'
3441     } = [];
3442 wakaba 1.1 } else {
3443 wakaba 1.13 my $v = $$nc_parent->{
3444     'child'
3445     };
3446 wakaba 1.1 RP: for my $i (0..$#$v) {
3447 wakaba 1.13 if ($v->[$i] eq $new_child[0]) {
3448 wakaba 1.1 splice @$v, $i, 1, ();
3449     last RP;
3450     }
3451     } # RP
3452     }
3453     }
3454    
3455     ## -- Rewrite the |parentNode| properties
3456     for my $nc (@new_child) {
3457 wakaba 1.13 $$nc->{
3458     'parent'
3459     } = $self;
3460     Scalar::Util::weaken ($$nc->{
3461     'parent'
3462     });
3463     }
3464 wakaba 1.1
3465 wakaba 1.13 my $children = $$self->{
3466     'child'
3467 wakaba 1.1 };
3468    
3469    
3470    
3471     {
3472    
3473    
3474     ## -- Adds to children list
3475 wakaba 1.13 push @$children, @new_child;
3476 wakaba 1.1 $r = $newChild;
3477    
3478    
3479    
3480 wakaba 1.3 }
3481 wakaba 1.1
3482     ;
3483    
3484    
3485    
3486     ;
3487    
3488    
3489    
3490     ;
3491    
3492    
3493    
3494 wakaba 1.3 }
3495 wakaba 1.1
3496    
3497     ;}
3498    
3499     ;
3500    
3501    
3502 wakaba 1.3 }
3503 wakaba 1.1
3504     ;
3505    
3506    
3507 wakaba 1.3 }
3508 wakaba 1.1 $r}
3509     sub insert_before ($$;$) {
3510     my ($self, $newChild, $refChild) = @_;
3511     my $r;
3512    
3513     {
3514    
3515     if
3516     ($self eq $newChild) {
3517    
3518     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';
3519    
3520     ;
3521     }
3522     my $self_od = $self->
3523     owner_document
3524     ;
3525     my $child_od = $newChild->
3526     owner_document
3527     ;
3528     my $child_nt = $newChild->
3529     node_type
3530     ;
3531    
3532    
3533     {
3534    
3535    
3536     {
3537    
3538     local $Error::Depth = $Error::Depth + 1;
3539    
3540     {
3541    
3542    
3543     my
3544     $strict = $self_od->
3545     strict_error_checking
3546     ;
3547    
3548     ## -- Node Type check
3549     my @new_child;
3550     if ({
3551 wakaba 1.7 3 => 1,
3552     5 => 1,
3553     1 => 1,
3554     7 => 1,
3555     4 => 1,
3556     8 => 1,
3557 wakaba 1.1 }->{$child_nt}) {
3558     push @new_child, $newChild;
3559     } elsif ($child_nt ==
3560 wakaba 1.7 11
3561 wakaba 1.1 ) {
3562     for my $cn (@{$newChild->
3563     child_nodes
3564     }) {
3565     unless ({
3566 wakaba 1.7 3 => 1,
3567     5 => 1,
3568     1 => 1,
3569     7 => 1,
3570     4 => 1,
3571     8 => 1,
3572 wakaba 1.1 }->{$cn->
3573     node_type
3574     }) {
3575    
3576    
3577     {
3578    
3579     local $Error::Depth = $Error::Depth - 1;
3580    
3581     {
3582    
3583     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;
3584    
3585    
3586 wakaba 1.3 }
3587 wakaba 1.1
3588    
3589     ;}
3590    
3591     ;
3592     }
3593     push @new_child, $cn;
3594     }
3595     } else {
3596    
3597    
3598     {
3599    
3600     local $Error::Depth = $Error::Depth - 1;
3601    
3602     {
3603    
3604     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;
3605    
3606    
3607 wakaba 1.3 }
3608 wakaba 1.1
3609    
3610     ;}
3611    
3612     ;
3613     }
3614    
3615     my $nc_parent = @new_child ? $new_child[0]->
3616     parent_node
3617     :
3618    
3619     undef
3620     ;
3621     if ($strict) {
3622     ## -- Wrong-document check
3623     unless ($self_od eq $child_od) {
3624    
3625    
3626     {
3627    
3628     local $Error::Depth = $Error::Depth - 1;
3629    
3630     {
3631    
3632     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;
3633    
3634    
3635 wakaba 1.3 }
3636 wakaba 1.1
3637    
3638     ;}
3639    
3640     ;
3641     }
3642    
3643     ## -- Read-onlyness check
3644     if ($self->
3645     manakai_read_only
3646     ) {
3647    
3648    
3649     {
3650    
3651     local $Error::Depth = $Error::Depth - 1;
3652    
3653     {
3654    
3655     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';
3656    
3657    
3658 wakaba 1.3 }
3659 wakaba 1.1
3660    
3661     ;}
3662    
3663     ;
3664     }
3665     if (@new_child) {
3666     if ($nc_parent and
3667     $nc_parent->
3668     manakai_read_only
3669     ) {
3670    
3671    
3672     {
3673    
3674     local $Error::Depth = $Error::Depth - 1;
3675    
3676     {
3677    
3678     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';
3679    
3680    
3681 wakaba 1.3 }
3682 wakaba 1.1
3683    
3684     ;}
3685    
3686     ;
3687     }
3688     }
3689     }
3690    
3691     ## -- Insert at...
3692     my $index = -1; # last
3693    
3694    
3695     {
3696    
3697    
3698     # tc:ForAppendChild & tc:ForReplaceChild
3699     if (defined $refChild) {
3700     if ($refChild eq $newChild) {
3701    
3702    
3703     {
3704    
3705    
3706     {
3707    
3708     local $Error::Depth = $Error::Depth - 1;
3709    
3710     {
3711    
3712     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';
3713    
3714    
3715 wakaba 1.3 }
3716 wakaba 1.1
3717    
3718     ;}
3719    
3720     ;
3721    
3722    
3723    
3724 wakaba 1.3 }
3725 wakaba 1.1
3726     ;
3727    
3728    
3729     ;
3730     }
3731    
3732     my $cns = $self->
3733     child_nodes
3734     ;
3735     my $cnsl = @$cns;
3736     C: {
3737     $index = 0;
3738     for my $i (0..($cnsl-1)) {
3739     my $cn = $cns->[$i];
3740     if ($cn eq $refChild) {
3741     $index += $i;
3742     last C;
3743     } elsif ($cn eq $newChild) {
3744     $index = -1; # offset
3745     }
3746     }
3747    
3748    
3749     {
3750    
3751    
3752     {
3753    
3754     local $Error::Depth = $Error::Depth - 1;
3755    
3756     {
3757    
3758     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;
3759    
3760    
3761 wakaba 1.3 }
3762 wakaba 1.1
3763    
3764     ;}
3765    
3766     ;
3767    
3768    
3769    
3770 wakaba 1.3 }
3771 wakaba 1.1
3772     ;
3773    
3774    
3775     ;
3776     } # C
3777     } else { # |oldChild| is not defined
3778    
3779    
3780     ;
3781     }
3782    
3783    
3784    
3785 wakaba 1.3 }
3786 wakaba 1.1
3787     ; # FOR !tc:ForAppendChild
3788    
3789     ## -- Removes from parent
3790     if ($nc_parent) {
3791     if ($child_nt ==
3792 wakaba 1.7 11
3793 wakaba 1.1 ) {
3794 wakaba 1.13 $$newChild->{
3795     'child'
3796     } = [];
3797 wakaba 1.1 } else {
3798 wakaba 1.13 my $v = $$nc_parent->{
3799     'child'
3800     };
3801 wakaba 1.1 RP: for my $i (0..$#$v) {
3802 wakaba 1.13 if ($v->[$i] eq $new_child[0]) {
3803 wakaba 1.1 splice @$v, $i, 1, ();
3804     last RP;
3805     }
3806     } # RP
3807     }
3808     }
3809    
3810     ## -- Rewrite the |parentNode| properties
3811     for my $nc (@new_child) {
3812 wakaba 1.13 $$nc->{
3813     'parent'
3814     } = $self;
3815     Scalar::Util::weaken ($$nc->{
3816     'parent'
3817     });
3818     }
3819 wakaba 1.1
3820 wakaba 1.13 my $children = $$self->{
3821     'child'
3822 wakaba 1.1 };
3823    
3824    
3825    
3826     ;
3827    
3828    
3829    
3830     {
3831    
3832    
3833     ## -- Adds to children list
3834     if ($index == -1) {
3835 wakaba 1.13 push @$children, @new_child;
3836 wakaba 1.1 } else {
3837 wakaba 1.13 splice @$children, $index, 0, @new_child;
3838 wakaba 1.1 }
3839     $r = $newChild;
3840    
3841    
3842    
3843 wakaba 1.3 }
3844 wakaba 1.1
3845     ;
3846    
3847    
3848    
3849     ;
3850    
3851    
3852    
3853 wakaba 1.3 }
3854 wakaba 1.1
3855    
3856     ;}
3857    
3858     ;
3859    
3860    
3861 wakaba 1.3 }
3862 wakaba 1.1
3863     ;
3864    
3865    
3866 wakaba 1.3 }
3867 wakaba 1.1 $r}
3868     sub replace_child ($$$) {
3869     my ($self, $newChild, $oldChild) = @_;
3870     my $r;
3871    
3872     {
3873    
3874     if
3875     ($self eq $newChild) {
3876    
3877     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';
3878    
3879     ;
3880     }
3881     my $self_od = $self->
3882     owner_document
3883     ;
3884     my $child_od = $newChild->
3885     owner_document
3886     ;
3887     my $child_nt = $newChild->
3888     node_type
3889     ;
3890    
3891    
3892     {
3893    
3894    
3895     {
3896    
3897     local $Error::Depth = $Error::Depth + 1;
3898    
3899     {
3900    
3901    
3902     my
3903     $strict = $self_od->
3904     strict_error_checking
3905     ;
3906    
3907     ## -- Node Type check
3908     my @new_child;
3909     if ({
3910 wakaba 1.7 3 => 1,
3911     5 => 1,
3912     1 => 1,
3913     7 => 1,
3914     4 => 1,
3915     8 => 1,
3916 wakaba 1.1 }->{$child_nt}) {
3917     push @new_child, $newChild;
3918     } elsif ($child_nt ==
3919 wakaba 1.7 11
3920 wakaba 1.1 ) {
3921     for my $cn (@{$newChild->
3922     child_nodes
3923     }) {
3924     unless ({
3925 wakaba 1.7 3 => 1,
3926     5 => 1,
3927     1 => 1,
3928     7 => 1,
3929     4 => 1,
3930     8 => 1,
3931 wakaba 1.1 }->{$cn->
3932     node_type
3933     }) {
3934    
3935    
3936     {
3937    
3938     local $Error::Depth = $Error::Depth - 1;
3939    
3940     {
3941    
3942     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;
3943    
3944    
3945 wakaba 1.3 }
3946 wakaba 1.1
3947    
3948     ;}
3949    
3950     ;
3951     }
3952     push @new_child, $cn;
3953     }
3954     } else {
3955    
3956    
3957     {
3958    
3959     local $Error::Depth = $Error::Depth - 1;
3960    
3961     {
3962    
3963     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;
3964    
3965    
3966 wakaba 1.3 }
3967 wakaba 1.1
3968    
3969     ;}
3970    
3971     ;
3972     }
3973    
3974     my $nc_parent = @new_child ? $new_child[0]->
3975     parent_node
3976     :
3977    
3978     undef
3979     ;
3980     if ($strict) {
3981     ## -- Wrong-document check
3982     unless ($self_od eq $child_od) {
3983    
3984    
3985     {
3986    
3987     local $Error::Depth = $Error::Depth - 1;
3988    
3989     {
3990    
3991     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;
3992    
3993    
3994 wakaba 1.3 }
3995 wakaba 1.1
3996    
3997     ;}
3998    
3999     ;
4000     }
4001    
4002     ## -- Read-onlyness check
4003     if ($self->
4004     manakai_read_only
4005     ) {
4006    
4007    
4008     {
4009    
4010     local $Error::Depth = $Error::Depth - 1;
4011    
4012     {
4013    
4014     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';
4015    
4016    
4017 wakaba 1.3 }
4018 wakaba 1.1
4019    
4020     ;}
4021    
4022     ;
4023     }
4024     if (@new_child) {
4025     if ($nc_parent and
4026     $nc_parent->
4027     manakai_read_only
4028     ) {
4029    
4030    
4031     {
4032    
4033     local $Error::Depth = $Error::Depth - 1;
4034    
4035     {
4036    
4037     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';
4038    
4039    
4040 wakaba 1.3 }
4041 wakaba 1.1
4042    
4043     ;}
4044    
4045     ;
4046     }
4047     }
4048     }
4049    
4050     ## -- Insert at...
4051     my $index = -1; # last
4052    
4053    
4054     {
4055    
4056    
4057     # tc:ForAppendChild & tc:ForReplaceChild
4058     if (defined $oldChild) {
4059     if ($oldChild eq $newChild) {
4060    
4061    
4062     ;
4063    
4064    
4065     {
4066    
4067    
4068     {
4069    
4070     local $Error::Depth = $Error::Depth - 1;
4071    
4072     {
4073    
4074     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';
4075    
4076    
4077 wakaba 1.3 }
4078 wakaba 1.1
4079    
4080     ;}
4081    
4082     ;
4083    
4084    
4085    
4086 wakaba 1.3 }
4087 wakaba 1.1
4088     ;
4089     }
4090    
4091     my $cns = $self->
4092     child_nodes
4093     ;
4094     my $cnsl = @$cns;
4095     C: {
4096     $index = 0;
4097     for my $i (0..($cnsl-1)) {
4098     my $cn = $cns->[$i];
4099     if ($cn eq $oldChild) {
4100     $index += $i;
4101     last C;
4102     } elsif ($cn eq $newChild) {
4103     $index = -1; # offset
4104     }
4105     }
4106    
4107    
4108     ;
4109    
4110    
4111     {
4112    
4113    
4114     {
4115    
4116     local $Error::Depth = $Error::Depth - 1;
4117    
4118     {
4119    
4120     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;
4121    
4122    
4123 wakaba 1.3 }
4124 wakaba 1.1
4125    
4126     ;}
4127    
4128     ;
4129    
4130    
4131    
4132 wakaba 1.3 }
4133 wakaba 1.1
4134     ;
4135     } # C
4136     } else { # |oldChild| is not defined
4137    
4138    
4139     {
4140    
4141    
4142     {
4143    
4144     local $Error::Depth = $Error::Depth - 1;
4145    
4146     {
4147    
4148     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;
4149    
4150    
4151 wakaba 1.3 }
4152 wakaba 1.1
4153    
4154     ;}
4155    
4156     ;
4157    
4158    
4159    
4160 wakaba 1.3 }
4161 wakaba 1.1
4162     ;
4163     }
4164    
4165    
4166    
4167 wakaba 1.3 }
4168 wakaba 1.1
4169     ; # FOR !tc:ForAppendChild
4170    
4171     ## -- Removes from parent
4172     if ($nc_parent) {
4173     if ($child_nt ==
4174 wakaba 1.7 11
4175 wakaba 1.1 ) {
4176 wakaba 1.13 $$newChild->{
4177     'child'
4178     } = [];
4179 wakaba 1.1 } else {
4180 wakaba 1.13 my $v = $$nc_parent->{
4181     'child'
4182     };
4183 wakaba 1.1 RP: for my $i (0..$#$v) {
4184 wakaba 1.13 if ($v->[$i] eq $new_child[0]) {
4185 wakaba 1.1 splice @$v, $i, 1, ();
4186     last RP;
4187     }
4188     } # RP
4189     }
4190     }
4191    
4192     ## -- Rewrite the |parentNode| properties
4193     for my $nc (@new_child) {
4194 wakaba 1.13 $$nc->{
4195     'parent'
4196     } = $self;
4197     Scalar::Util::weaken ($$nc->{
4198     'parent'
4199     });
4200     }
4201 wakaba 1.1
4202 wakaba 1.13 my $children = $$self->{
4203     'child'
4204 wakaba 1.1 };
4205    
4206    
4207    
4208     ;
4209    
4210    
4211    
4212     ;
4213    
4214    
4215    
4216     {
4217    
4218    
4219     ## -- Replaces the node
4220 wakaba 1.13 splice @$children, $index, 1, @new_child;
4221     CORE::delete $$oldChild->{
4222     'parent'
4223     };
4224 wakaba 1.1 $r = $oldChild;
4225    
4226    
4227    
4228 wakaba 1.3 }
4229 wakaba 1.1
4230     ;
4231    
4232    
4233    
4234 wakaba 1.3 }
4235 wakaba 1.1
4236    
4237     ;}
4238    
4239     ;
4240    
4241    
4242 wakaba 1.3 }
4243 wakaba 1.1
4244     ;
4245    
4246    
4247 wakaba 1.3 }
4248 wakaba 1.1 $r}
4249     sub node_name ($;$) {
4250     if (@_ == 1) {my ($self) = @_;
4251 wakaba 1.12 my $r = '';
4252 wakaba 1.1 $r = '#document-fragment';
4253     $r;
4254     } else {my ($self) = @_;
4255     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';
4256     }
4257     }
4258     sub manakai_append_text ($$) {
4259     my ($self, $string) = @_;
4260     my $r;
4261    
4262     {
4263    
4264    
4265     {
4266    
4267     local $Error::Depth = $Error::Depth + 1;
4268    
4269     {
4270    
4271    
4272     my
4273     $lc = $self->
4274     last_child
4275     ;
4276     if (defined $lc and
4277     $lc->
4278     node_type
4279     ==
4280 wakaba 1.7 3
4281 wakaba 1.1 ) {
4282     $lc->
4283     manakai_append_text
4284    
4285     (ref $string eq 'SCALAR' ? $string : \$string);
4286     } else {
4287     my $text = $self->
4288     owner_document
4289    
4290     ->
4291     create_text_node
4292    
4293     (ref $string eq 'SCALAR' ? $$string : $string);
4294     $self->
4295     append_child
4296     ($text);
4297     }
4298     $r = $self;
4299    
4300    
4301    
4302 wakaba 1.3 }
4303 wakaba 1.1
4304    
4305     ;}
4306    
4307     ;
4308    
4309    
4310 wakaba 1.3 }
4311 wakaba 1.1 $r}
4312     sub get_feature ($$$) {
4313     my ($self, $feature, $version) = @_;
4314    
4315     {
4316    
4317    
4318     $feature = lc $feature;
4319    
4320    
4321 wakaba 1.3 }
4322 wakaba 1.1
4323     {
4324    
4325    
4326     $version = '' unless defined $version;
4327    
4328    
4329 wakaba 1.3 }
4330 wakaba 1.1 my $r;
4331    
4332     {
4333    
4334    
4335     $feature =~ s/^\+//;
4336    
4337    
4338     {
4339    
4340     if
4341 wakaba 1.10 ($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) {
4342 wakaba 1.1 $r = $self;
4343     }
4344    
4345    
4346 wakaba 1.3 }
4347 wakaba 1.1
4348     ;
4349     unless (defined $r) {
4350    
4351    
4352     {
4353    
4354     local $Error::Depth = $Error::Depth + 1;
4355    
4356     {
4357    
4358    
4359    
4360     $r = $self->SUPER::get_feature ($feature, $version);
4361    
4362    
4363    
4364 wakaba 1.3 }
4365 wakaba 1.1
4366    
4367     ;}
4368    
4369     ;
4370     }
4371    
4372    
4373 wakaba 1.3 }
4374 wakaba 1.1 $r}
4375     sub base_uri ($;$) {
4376     if (@_ == 1) {my ($self) = @_;
4377 wakaba 1.12 my $r = '';
4378 wakaba 1.1
4379     {
4380    
4381    
4382     {
4383    
4384     local $Error::Depth = $Error::Depth + 1;
4385    
4386     {
4387    
4388    
4389    
4390     $r = $self->
4391     owner_document
4392     ->
4393     base_uri
4394     ;
4395    
4396    
4397    
4398 wakaba 1.3 }
4399 wakaba 1.1
4400    
4401     ;}
4402    
4403     ;
4404    
4405    
4406 wakaba 1.3 }
4407 wakaba 1.1 $r;
4408     } else {my ($self) = @_;
4409     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';
4410     }
4411     }
4412     $Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>}->{has_feature} = {'core',
4413     {'',
4414     '1',
4415     '1.0',
4416     '1',
4417     '2.0',
4418     '1',
4419     '3.0',
4420     '1'},
4421     'xml',
4422     {'',
4423     '1',
4424     '1.0',
4425     '1',
4426     '2.0',
4427     '1',
4428     '3.0',
4429     '1'},
4430     'xmlversion',
4431     {'',
4432     '1',
4433     '1.0',
4434     '1',
4435     '1.1',
4436     '1'}};
4437     $Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = 14.1;
4438 wakaba 1.13 $Message::Util::Grove::ClassProp{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = {};
4439 wakaba 1.1 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::){}
4440     ## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL>
4441     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24