/[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.5 - (hide annotations) (download)
Tue Apr 4 14:30:29 2006 UTC (18 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.4: +7 -7 lines
++ manakai/bin/ChangeLog	4 Apr 2006 14:28:32 -0000
2006-04-04  Wakaba  <wakaba@suika.fam.cx>

	* daf.pl (--dafs-suffix): New option.
	(daf_resolve_db_module_file): The |dp:ModuleNodeStorageFile|
	type support.

++ manakai/lib/Message/Util/ChangeLog	4 Apr 2006 14:29:09 -0000
	* DIS.dis (Require): Requires the |MDOM:TreeStore| module.
	(getNodeFromStorage, setNodeToStorage): New methods.

2006-04-04  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Util/DIS/ChangeLog	4 Apr 2006 14:30:17 -0000
2006-04-04  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plStore): The |mainDatabase| parameter is removed.
	(plStoreNodeStorage): New method.
	(plLoadNodeStorage): New method.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24