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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (hide annotations) (download)
Sun Dec 31 00:55:05 2006 UTC (17 years, 10 months ago) by wakaba
Branch: MAIN
Changes since 1.16: +62 -22 lines
++ manakai/lib/Message/Util/ChangeLog	31 Dec 2006 00:49:10 -0000
2006-12-31  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (forMatch, readProperties): Support for the |For|
	property is removed.

++ manakai/lib/Message/Util/DIS/ChangeLog	31 Dec 2006 00:50:06 -0000
2006-12-31  Wakaba  <wakaba@suika.fam.cx>

	* DNLite.dis (forMatch, convert...): Support for the |For|
	property is removed.

++ manakai/lib/manakai/ChangeLog	31 Dec 2006 00:53:00 -0000
2006-12-31  Wakaba  <wakaba@suika.fam.cx>

	* DISCore.dis (for): Removed.

	* DISSource.dis (For): Removed.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24