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