/[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.1 - (hide annotations) (download)
Sun Apr 2 10:45:23 2006 UTC (18 years, 7 months ago) by wakaba
Branch: MAIN
++ manakai/lib/Message/Util/ChangeLog	2 Apr 2006 10:44:48 -0000
2006-04-02  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: Update to new modules.

++ manakai/lib/Message/DOM/ChangeLog	2 Apr 2006 10:44:11 -0000
	* XMLParser.dis: Updated so that it can be used
	with |TreeCore.pm|, |Document.pm|, |Element.pm|,
	and |XML.pm|.  Set the read-only flag to
	the |DocumentType|, |Entity|, and |EntityReference| noes.

	* Node.dis (textContent): It did not handle descendant
	element and entity reference nodes.

	* Element.dis, XML.dis (manakaiBaseURI.get): Its
	definition has been changed to return only explicit
	base URI specification.

	* DOMLS.dis (LSInput, LSOutput): They no longer
	inherits the |ManakaiDOM:ManakaiDOMObject| class.

	* Tree.dis, DOMXML.dis, ManakaiDOMLS2003.dis: Removed.

	* Tree.pm, DOMXML.pm: Removed.

	* TreeCore.pm, Document.pm, Element.pm: Added
	to the CVS repository since they are necessary to
	build the dis library.

	* Makefile: Sync'ed to new modules disposition.

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

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24