1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
## This file is automatically generated |
3 |
wakaba |
1.2 |
## at 2006-04-02T11:32:03+00:00, |
4 |
wakaba |
1.1 |
## 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 |
wakaba |
1.2 |
our $VERSION = 20060402.1132; |
14 |
wakaba |
1.1 |
package Message::DOM::IFLatest::Element; |
15 |
wakaba |
1.2 |
our $VERSION = 20060402.1132; |
16 |
wakaba |
1.1 |
package Message::DOM::Element::ManakaiDOMElement; |
17 |
wakaba |
1.2 |
our $VERSION = 20060402.1132; |
18 |
wakaba |
1.1 |
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 |
|
|
|
4887 |
wakaba |
1.2 |
$r = $self->{ |
4888 |
|
|
'b' |
4889 |
|
|
}->{${$self->{ |
4890 |
|
|
'id' |
4891 |
|
|
}}} |
4892 |
|
|
->{'buri'}; |
4893 |
wakaba |
1.1 |
|
4894 |
|
|
|
4895 |
|
|
;} |
4896 |
|
|
|
4897 |
|
|
; |
4898 |
|
|
|
4899 |
|
|
|
4900 |
|
|
;} |
4901 |
|
|
$r; |
4902 |
|
|
} else {my ($self, $given) = @_; |
4903 |
|
|
|
4904 |
|
|
{ |
4905 |
|
|
|
4906 |
|
|
|
4907 |
|
|
{ |
4908 |
|
|
|
4909 |
|
|
if |
4910 |
|
|
($self-> |
4911 |
|
|
manakai_read_only |
4912 |
|
|
) { |
4913 |
|
|
|
4914 |
|
|
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'; |
4915 |
|
|
|
4916 |
|
|
; |
4917 |
|
|
} |
4918 |
|
|
|
4919 |
|
|
|
4920 |
|
|
;} |
4921 |
|
|
|
4922 |
|
|
; |
4923 |
|
|
|
4924 |
|
|
|
4925 |
|
|
{ |
4926 |
|
|
|
4927 |
|
|
|
4928 |
|
|
$self->{ |
4929 |
|
|
'b' |
4930 |
|
|
}->{${$self->{ |
4931 |
|
|
'id' |
4932 |
|
|
}}} |
4933 |
|
|
->{'buri'} = $given; |
4934 |
|
|
|
4935 |
|
|
|
4936 |
|
|
;} |
4937 |
|
|
|
4938 |
|
|
; |
4939 |
|
|
|
4940 |
|
|
|
4941 |
|
|
;} |
4942 |
|
|
} |
4943 |
|
|
} |
4944 |
|
|
sub set_id_attribute ($$;$) { |
4945 |
|
|
my ($self, $name, $isId) = @_; |
4946 |
|
|
|
4947 |
|
|
{ |
4948 |
|
|
|
4949 |
|
|
|
4950 |
|
|
{ |
4951 |
|
|
|
4952 |
|
|
if |
4953 |
|
|
($self-> |
4954 |
|
|
manakai_read_only |
4955 |
|
|
) { |
4956 |
|
|
|
4957 |
|
|
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'; |
4958 |
|
|
|
4959 |
|
|
; |
4960 |
|
|
} |
4961 |
|
|
|
4962 |
|
|
|
4963 |
|
|
;} |
4964 |
|
|
|
4965 |
|
|
; |
4966 |
|
|
my $attr = $self-> |
4967 |
|
|
get_attribute_node |
4968 |
|
|
($name); |
4969 |
|
|
if (not defined $attr) { |
4970 |
|
|
|
4971 |
|
|
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; |
4972 |
|
|
|
4973 |
|
|
; |
4974 |
|
|
} elsif ($attr-> |
4975 |
|
|
manakai_read_only |
4976 |
|
|
) { |
4977 |
|
|
|
4978 |
|
|
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; |
4979 |
|
|
|
4980 |
|
|
; |
4981 |
|
|
} else { |
4982 |
|
|
$attr-> |
4983 |
|
|
is_id |
4984 |
|
|
($isId); |
4985 |
|
|
} |
4986 |
|
|
|
4987 |
|
|
|
4988 |
|
|
;} |
4989 |
|
|
} |
4990 |
|
|
sub set_id_attribute_ns ($$$;$) { |
4991 |
|
|
my ($self, $namespaceURI, $localName, $isId) = @_; |
4992 |
|
|
|
4993 |
|
|
{ |
4994 |
|
|
|
4995 |
|
|
if |
4996 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
4997 |
|
|
|
4998 |
|
|
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'; |
4999 |
|
|
|
5000 |
|
|
; |
5001 |
|
|
|
5002 |
|
|
|
5003 |
|
|
|
5004 |
|
|
{ |
5005 |
|
|
|
5006 |
|
|
|
5007 |
|
|
$namespaceURI = undef; |
5008 |
|
|
|
5009 |
|
|
|
5010 |
|
|
|
5011 |
|
|
;} |
5012 |
|
|
|
5013 |
|
|
; |
5014 |
|
|
} |
5015 |
|
|
|
5016 |
|
|
|
5017 |
|
|
;} |
5018 |
|
|
|
5019 |
|
|
{ |
5020 |
|
|
|
5021 |
|
|
|
5022 |
|
|
{ |
5023 |
|
|
|
5024 |
|
|
if |
5025 |
|
|
($self-> |
5026 |
|
|
manakai_read_only |
5027 |
|
|
) { |
5028 |
|
|
|
5029 |
|
|
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'; |
5030 |
|
|
|
5031 |
|
|
; |
5032 |
|
|
} |
5033 |
|
|
|
5034 |
|
|
|
5035 |
|
|
;} |
5036 |
|
|
|
5037 |
|
|
; |
5038 |
|
|
my $attr = $self-> |
5039 |
|
|
get_attribute_node_ns |
5040 |
|
|
|
5041 |
|
|
($namespaceURI, $localName); |
5042 |
|
|
if (not defined $attr) { |
5043 |
|
|
|
5044 |
|
|
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; |
5045 |
|
|
|
5046 |
|
|
; |
5047 |
|
|
} elsif ($attr-> |
5048 |
|
|
manakai_read_only |
5049 |
|
|
) { |
5050 |
|
|
|
5051 |
|
|
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; |
5052 |
|
|
|
5053 |
|
|
; |
5054 |
|
|
} else { |
5055 |
|
|
$attr-> |
5056 |
|
|
is_id |
5057 |
|
|
($isId); |
5058 |
|
|
} |
5059 |
|
|
|
5060 |
|
|
|
5061 |
|
|
;} |
5062 |
|
|
} |
5063 |
|
|
sub set_id_attribute_node ($$;$) { |
5064 |
|
|
my ($self, $idAttr, $isId) = @_; |
5065 |
|
|
|
5066 |
|
|
{ |
5067 |
|
|
|
5068 |
|
|
|
5069 |
|
|
{ |
5070 |
|
|
|
5071 |
|
|
if |
5072 |
|
|
($self-> |
5073 |
|
|
manakai_read_only |
5074 |
|
|
) { |
5075 |
|
|
|
5076 |
|
|
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'; |
5077 |
|
|
|
5078 |
|
|
; |
5079 |
|
|
} |
5080 |
|
|
|
5081 |
|
|
|
5082 |
|
|
;} |
5083 |
|
|
|
5084 |
|
|
; |
5085 |
|
|
|
5086 |
|
|
my $owner = $idAttr-> |
5087 |
|
|
owner_element |
5088 |
|
|
; |
5089 |
|
|
if (not defined $owner or not $owner eq $self) { |
5090 |
|
|
|
5091 |
|
|
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; |
5092 |
|
|
|
5093 |
|
|
; |
5094 |
|
|
} elsif ($idAttr-> |
5095 |
|
|
manakai_read_only |
5096 |
|
|
) { |
5097 |
|
|
|
5098 |
|
|
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; |
5099 |
|
|
|
5100 |
|
|
; |
5101 |
|
|
} else { |
5102 |
|
|
$idAttr-> |
5103 |
|
|
is_id |
5104 |
|
|
($isId); |
5105 |
|
|
} |
5106 |
|
|
|
5107 |
|
|
|
5108 |
|
|
;} |
5109 |
|
|
} |
5110 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMElement>}->{has_feature} = {'core', |
5111 |
|
|
{'', |
5112 |
|
|
'1', |
5113 |
|
|
'1.0', |
5114 |
|
|
'1', |
5115 |
|
|
'2.0', |
5116 |
|
|
'1', |
5117 |
|
|
'3.0', |
5118 |
|
|
'1'}, |
5119 |
|
|
'xml', |
5120 |
|
|
{'', |
5121 |
|
|
'1', |
5122 |
|
|
'1.0', |
5123 |
|
|
'1', |
5124 |
|
|
'2.0', |
5125 |
|
|
'1', |
5126 |
|
|
'3.0', |
5127 |
|
|
'1'}, |
5128 |
|
|
'xmlversion', |
5129 |
|
|
{'', |
5130 |
|
|
'1', |
5131 |
|
|
'1.0', |
5132 |
|
|
'1', |
5133 |
|
|
'1.1', |
5134 |
|
|
'1'}}; |
5135 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Element::ManakaiDOMElement>} = 14.1; |
5136 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMElement>}->{compat_class}->{q<Message::DOM::Element::ManakaiDOMElement>} = 1; |
5137 |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Element::ManakaiDOMElement>} = {'o0', |
5138 |
|
|
['parent'], |
5139 |
|
|
's1a', |
5140 |
|
|
['child'], |
5141 |
|
|
's2hh', |
5142 |
|
|
['attr'], |
5143 |
|
|
'w0', |
5144 |
|
|
['od']}; |
5145 |
|
|
package Message::DOM::IFLatest::Attr; |
5146 |
wakaba |
1.2 |
our $VERSION = 20060402.1132; |
5147 |
wakaba |
1.1 |
package Message::DOM::Element::ManakaiDOMAttr; |
5148 |
wakaba |
1.2 |
our $VERSION = 20060402.1132; |
5149 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
5150 |
|
|
'Message::DOM::IF::Attr', |
5151 |
|
|
'Message::DOM::IF::Node', |
5152 |
|
|
'Message::DOM::IFLatest::Attr', |
5153 |
|
|
'Message::DOM::IFLatest::Node', |
5154 |
|
|
'Message::DOM::IFLevel1::Attr', |
5155 |
|
|
'Message::DOM::IFLevel1::Node', |
5156 |
|
|
'Message::DOM::IFLevel2::Attr', |
5157 |
|
|
'Message::DOM::IFLevel2::Node', |
5158 |
|
|
'Message::DOM::IFLevel3::Attr', |
5159 |
|
|
'Message::DOM::IFLevel3::Node'; |
5160 |
|
|
use Char::Class::XML 'InXMLNameChar10', |
5161 |
|
|
'InXMLNameChar11', |
5162 |
|
|
'InXMLNameStartChar11', |
5163 |
|
|
'InXML_NameStartChar10'; |
5164 |
|
|
sub ___create_node_stem ($$$$) { |
5165 |
|
|
my ($self, $bag, $obj, $opt) = @_; |
5166 |
|
|
my $r = {}; |
5167 |
|
|
|
5168 |
|
|
{ |
5169 |
|
|
|
5170 |
|
|
|
5171 |
|
|
$obj->{ |
5172 |
|
|
'child' |
5173 |
|
|
} = []; |
5174 |
|
|
|
5175 |
|
|
|
5176 |
|
|
{ |
5177 |
|
|
|
5178 |
|
|
if |
5179 |
|
|
(defined ${$opt->{'ns'}}) { |
5180 |
|
|
if (ref ${$opt->{'ns'}} eq 'SCALAR') { |
5181 |
|
|
$obj->{'ns'} = ${$opt->{'ns'}}; |
5182 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}) { |
5183 |
|
|
$obj->{'ns'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}; |
5184 |
|
|
} else { |
5185 |
|
|
require Scalar::Util; |
5186 |
|
|
$obj->{'ns'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}} = \(${$opt->{'ns'}}); |
5187 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'ns'}}}); |
5188 |
|
|
} |
5189 |
|
|
} else { |
5190 |
|
|
CORE::delete $obj->{'ns'}; |
5191 |
|
|
} |
5192 |
|
|
|
5193 |
|
|
|
5194 |
|
|
;} |
5195 |
|
|
|
5196 |
|
|
; |
5197 |
|
|
|
5198 |
|
|
|
5199 |
|
|
{ |
5200 |
|
|
|
5201 |
|
|
if |
5202 |
|
|
(defined ${$opt->{'pfx'}}) { |
5203 |
|
|
if (ref ${$opt->{'pfx'}} eq 'SCALAR') { |
5204 |
|
|
$obj->{'pfx'} = ${$opt->{'pfx'}}; |
5205 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}) { |
5206 |
|
|
$obj->{'pfx'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}; |
5207 |
|
|
} else { |
5208 |
|
|
require Scalar::Util; |
5209 |
|
|
$obj->{'pfx'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}} = \(${$opt->{'pfx'}}); |
5210 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'pfx'}}}); |
5211 |
|
|
} |
5212 |
|
|
} else { |
5213 |
|
|
CORE::delete $obj->{'pfx'}; |
5214 |
|
|
} |
5215 |
|
|
|
5216 |
|
|
|
5217 |
|
|
;} |
5218 |
|
|
|
5219 |
|
|
; |
5220 |
|
|
|
5221 |
|
|
|
5222 |
|
|
{ |
5223 |
|
|
|
5224 |
|
|
if |
5225 |
|
|
(defined ${$opt->{'ln'}}) { |
5226 |
|
|
if (ref ${$opt->{'ln'}} eq 'SCALAR') { |
5227 |
|
|
$obj->{'ln'} = ${$opt->{'ln'}}; |
5228 |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}) { |
5229 |
|
|
$obj->{'ln'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}; |
5230 |
|
|
} else { |
5231 |
|
|
require Scalar::Util; |
5232 |
|
|
$obj->{'ln'} = $Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}} = \(${$opt->{'ln'}}); |
5233 |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{${$opt->{'ln'}}}); |
5234 |
|
|
} |
5235 |
|
|
} else { |
5236 |
|
|
CORE::delete $obj->{'ln'}; |
5237 |
|
|
} |
5238 |
|
|
|
5239 |
|
|
|
5240 |
|
|
;} |
5241 |
|
|
|
5242 |
|
|
; |
5243 |
|
|
$obj->{ |
5244 |
|
|
'specified' |
5245 |
|
|
} = $opt->{ |
5246 |
|
|
'specified' |
5247 |
|
|
}; |
5248 |
|
|
|
5249 |
|
|
|
5250 |
|
|
{ |
5251 |
|
|
|
5252 |
|
|
|
5253 |
|
|
$obj->{'od'} = $opt->{'od'}->{ |
5254 |
|
|
'id' |
5255 |
|
|
}; |
5256 |
|
|
$bag->{${$opt->{'od'}->{ |
5257 |
|
|
'id' |
5258 |
|
|
}}} |
5259 |
|
|
->{'do'}->{${$obj->{ |
5260 |
|
|
'id' |
5261 |
|
|
}}} |
5262 |
|
|
= $obj->{ |
5263 |
|
|
'id' |
5264 |
|
|
}; |
5265 |
|
|
|
5266 |
|
|
|
5267 |
|
|
;} |
5268 |
|
|
|
5269 |
|
|
; |
5270 |
|
|
$r = $obj; |
5271 |
|
|
|
5272 |
|
|
|
5273 |
|
|
;} |
5274 |
|
|
$r} |
5275 |
|
|
sub ___create_node_ref ($$$) { |
5276 |
|
|
my ($self, $obj, $opt) = @_; |
5277 |
|
|
my $r; |
5278 |
|
|
|
5279 |
|
|
{ |
5280 |
|
|
|
5281 |
|
|
my |
5282 |
|
|
$class; |
5283 |
|
|
CLS: { |
5284 |
|
|
if (defined $opt->{ |
5285 |
|
|
'nrcls' |
5286 |
|
|
}) { |
5287 |
|
|
$class = $opt->{ |
5288 |
|
|
'nrcls' |
5289 |
|
|
}; |
5290 |
|
|
IFCHK: { |
5291 |
|
|
for (@{$opt->{ |
5292 |
|
|
'nrifs' |
5293 |
|
|
} or []}) { |
5294 |
|
|
last IFCHK unless $$class->isa ($_); |
5295 |
|
|
} |
5296 |
|
|
last CLS; |
5297 |
|
|
} # IFCHK |
5298 |
|
|
} |
5299 |
|
|
|
5300 |
|
|
|
5301 |
|
|
|
5302 |
|
|
{ |
5303 |
|
|
|
5304 |
|
|
|
5305 |
|
|
$class = $obj->{ |
5306 |
|
|
'b' |
5307 |
|
|
}->{${$obj->{ |
5308 |
|
|
'id' |
5309 |
|
|
}}} |
5310 |
|
|
->{'dnrcls'}; |
5311 |
|
|
|
5312 |
|
|
|
5313 |
|
|
;} |
5314 |
|
|
|
5315 |
|
|
; |
5316 |
|
|
if (defined $class) { |
5317 |
|
|
IFCHK: { |
5318 |
|
|
for (@{$opt->{ |
5319 |
|
|
'nrifs' |
5320 |
|
|
} or []}) { |
5321 |
|
|
last IFCHK unless $$class->isa ($_); |
5322 |
|
|
} |
5323 |
|
|
last CLS; |
5324 |
|
|
} # IFCHK |
5325 |
|
|
} |
5326 |
|
|
|
5327 |
|
|
my $nsuri; |
5328 |
|
|
|
5329 |
|
|
|
5330 |
|
|
{ |
5331 |
|
|
|
5332 |
|
|
|
5333 |
|
|
$nsuri = $obj->{ |
5334 |
|
|
'b' |
5335 |
|
|
}->{${$obj->{ |
5336 |
|
|
'id' |
5337 |
|
|
}}} |
5338 |
|
|
->{'ns'}; |
5339 |
|
|
|
5340 |
|
|
|
5341 |
|
|
;} |
5342 |
|
|
|
5343 |
|
|
; |
5344 |
|
|
$nsuri = \'' unless defined $nsuri; |
5345 |
|
|
my $ln; |
5346 |
|
|
|
5347 |
|
|
|
5348 |
|
|
{ |
5349 |
|
|
|
5350 |
|
|
|
5351 |
|
|
$ln = $obj->{ |
5352 |
|
|
'b' |
5353 |
|
|
}->{${$obj->{ |
5354 |
|
|
'id' |
5355 |
|
|
}}} |
5356 |
|
|
->{'ln'}; |
5357 |
|
|
|
5358 |
|
|
|
5359 |
|
|
;} |
5360 |
|
|
|
5361 |
|
|
; |
5362 |
|
|
my $oeid; |
5363 |
|
|
|
5364 |
|
|
|
5365 |
|
|
{ |
5366 |
|
|
|
5367 |
|
|
|
5368 |
|
|
$oeid = $obj->{ |
5369 |
|
|
'b' |
5370 |
|
|
}->{${$obj->{ |
5371 |
|
|
'id' |
5372 |
|
|
}}} |
5373 |
|
|
->{'owner'}; |
5374 |
|
|
|
5375 |
|
|
|
5376 |
|
|
;} |
5377 |
|
|
|
5378 |
|
|
; |
5379 |
|
|
my $oens; |
5380 |
|
|
my $oeln; |
5381 |
|
|
if (defined $oeid) { |
5382 |
|
|
my $bag = |
5383 |
|
|
$obj->{'b'} |
5384 |
|
|
; |
5385 |
|
|
my $oeh = |
5386 |
|
|
{ |
5387 |
|
|
'id' => $oeid, |
5388 |
|
|
'b' => $bag, |
5389 |
|
|
} |
5390 |
|
|
; |
5391 |
|
|
|
5392 |
|
|
|
5393 |
|
|
{ |
5394 |
|
|
|
5395 |
|
|
|
5396 |
|
|
$oens = $oeh->{ |
5397 |
|
|
'b' |
5398 |
|
|
}->{${$oeh->{ |
5399 |
|
|
'id' |
5400 |
|
|
}}} |
5401 |
|
|
->{'ns'}; |
5402 |
|
|
|
5403 |
|
|
|
5404 |
|
|
;} |
5405 |
|
|
|
5406 |
|
|
; |
5407 |
|
|
$oens = \'' unless defined $oens; |
5408 |
|
|
|
5409 |
|
|
|
5410 |
|
|
{ |
5411 |
|
|
|
5412 |
|
|
|
5413 |
|
|
$oeln = $oeh->{ |
5414 |
|
|
'b' |
5415 |
|
|
}->{${$oeh->{ |
5416 |
|
|
'id' |
5417 |
|
|
}}} |
5418 |
|
|
->{'ln'}; |
5419 |
|
|
|
5420 |
|
|
|
5421 |
|
|
;} |
5422 |
|
|
|
5423 |
|
|
; |
5424 |
|
|
} else { |
5425 |
|
|
$oens = \'*'; |
5426 |
|
|
$oeln = \'*'; |
5427 |
|
|
} |
5428 |
|
|
|
5429 |
|
|
A: { |
5430 |
|
|
## Use cases: |
5431 |
|
|
## - Any element type, |xml:id| attribute |
5432 |
|
|
## - Any element type, |xlink:href| attribute |
5433 |
|
|
## - |xslt:*| element type, any attribute |
5434 |
|
|
## - |xslt:*| element type, NULL namespace attribute |
5435 |
|
|
## - |xhtml1:*| element type, NULL namespace attribute |
5436 |
|
|
|
5437 |
|
|
for my $nm ( |
5438 |
|
|
[$oens, $oeln, $nsuri, $ln], |
5439 |
|
|
[$oens, \'*', $nsuri, $ln], |
5440 |
|
|
[\'*', \'*', $nsuri, $ln], |
5441 |
|
|
[$oens, $oeln, $nsuri, \'*'], |
5442 |
|
|
[$oens, \'*', $nsuri, \'*'], |
5443 |
|
|
[\'*', \'*', $nsuri, \'*'], |
5444 |
|
|
[$oens, $oeln, \'*', \'*'], |
5445 |
|
|
[$oens, \'*', \'*', \'*'], |
5446 |
|
|
) { |
5447 |
|
|
for my $__class (sort { |
5448 |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
5449 |
|
|
} grep { |
5450 |
|
|
$Message::DOM::DOMFeature::ClassInfo |
5451 |
|
|
->{ |
5452 |
|
|
'Message::DOM::Element::ManakaiDOMAttr' |
5453 |
|
|
} |
5454 |
|
|
->{compat_class_by_type} |
5455 |
|
|
->{${$nm->[0]}}->{${$nm->[1]}} |
5456 |
|
|
->{${$nm->[2]}}->{${$nm->[3]}}->{$_} |
5457 |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo |
5458 |
|
|
->{ |
5459 |
|
|
'Message::DOM::Element::ManakaiDOMAttr' |
5460 |
|
|
} |
5461 |
|
|
->{compat_class_by_type} |
5462 |
|
|
->{${$nm->[0]}}->{${$nm->[1]}} |
5463 |
|
|
->{${$nm->[2]}}->{${$nm->[3]}} or {}}) { |
5464 |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
5465 |
|
|
->{has_feature}->{xml}->{'3.0'}) { |
5466 |
|
|
$class = \$__class; |
5467 |
|
|
IFCHK: { |
5468 |
|
|
for (@{$opt->{ |
5469 |
|
|
'nrifs' |
5470 |
|
|
} or []}) { |
5471 |
|
|
last IFCHK unless $$class->isa ($_); |
5472 |
|
|
} |
5473 |
|
|
last A; |
5474 |
|
|
} # IFCHK |
5475 |
|
|
} |
5476 |
|
|
} |
5477 |
|
|
} |
5478 |
|
|
|
5479 |
|
|
## Generic |
5480 |
|
|
CLASS: for my $__class (sort { |
5481 |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
5482 |
|
|
} grep { |
5483 |
|
|
$Message::DOM::DOMFeature::ClassInfo |
5484 |
|
|
->{ |
5485 |
|
|
'Message::DOM::Element::ManakaiDOMAttr' |
5486 |
|
|
} |
5487 |
|
|
->{compat_class}->{$_} |
5488 |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo |
5489 |
|
|
->{ |
5490 |
|
|
'Message::DOM::Element::ManakaiDOMAttr' |
5491 |
|
|
} |
5492 |
|
|
->{compat_class} or {}}) { |
5493 |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
5494 |
|
|
->{has_feature}->{xml}->{'3.0'}) { |
5495 |
|
|
$class = \$__class; |
5496 |
|
|
IFCHK: { |
5497 |
|
|
for (@{$opt->{ |
5498 |
|
|
'nrifs' |
5499 |
|
|
} or []}) { |
5500 |
|
|
last IFCHK unless $$class->isa ($_); |
5501 |
|
|
} |
5502 |
|
|
last A; |
5503 |
|
|
} # IFCHK |
5504 |
|
|
} |
5505 |
|
|
} |
5506 |
|
|
|
5507 |
|
|
## Default |
5508 |
|
|
$class = \$self; |
5509 |
|
|
} # A |
5510 |
|
|
|
5511 |
|
|
if (defined $oeid) { |
5512 |
|
|
|
5513 |
|
|
|
5514 |
|
|
{ |
5515 |
|
|
|
5516 |
|
|
|
5517 |
|
|
$obj->{ |
5518 |
|
|
'b' |
5519 |
|
|
}->{${$obj->{ |
5520 |
|
|
'id' |
5521 |
|
|
}}} |
5522 |
|
|
->{'dnrcls'} = $class; |
5523 |
|
|
|
5524 |
|
|
|
5525 |
|
|
;} |
5526 |
|
|
|
5527 |
|
|
; |
5528 |
|
|
} |
5529 |
|
|
} # CLS |
5530 |
|
|
$r = bless $obj, $$class; |
5531 |
|
|
|
5532 |
|
|
|
5533 |
|
|
;} |
5534 |
|
|
$r} |
5535 |
|
|
sub node_type ($;$) { |
5536 |
|
|
if (@_ == 1) {my ($self) = @_; |
5537 |
|
|
my $r; |
5538 |
|
|
$r = 2; |
5539 |
|
|
$r; |
5540 |
|
|
} else {my ($self) = @_; |
5541 |
|
|
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'; |
5542 |
|
|
} |
5543 |
|
|
} |
5544 |
|
|
sub prefix ($;$) { |
5545 |
|
|
if (@_ == 1) {my ($self) = @_; |
5546 |
|
|
my $r = ''; |
5547 |
|
|
|
5548 |
|
|
{ |
5549 |
|
|
|
5550 |
|
|
my |
5551 |
|
|
$v; |
5552 |
|
|
|
5553 |
|
|
|
5554 |
|
|
{ |
5555 |
|
|
|
5556 |
|
|
|
5557 |
|
|
$v = $self->{ |
5558 |
|
|
'b' |
5559 |
|
|
}->{${$self->{ |
5560 |
|
|
'id' |
5561 |
|
|
}}} |
5562 |
|
|
->{'pfx'}; |
5563 |
|
|
|
5564 |
|
|
|
5565 |
|
|
;} |
5566 |
|
|
|
5567 |
|
|
; |
5568 |
|
|
$r = defined $v ? $$v : |
5569 |
|
|
undef |
5570 |
|
|
; |
5571 |
|
|
|
5572 |
|
|
|
5573 |
|
|
;} |
5574 |
|
|
$r; |
5575 |
|
|
} else {my ($self, $given) = @_; |
5576 |
|
|
|
5577 |
|
|
{ |
5578 |
|
|
|
5579 |
|
|
my |
5580 |
|
|
$od = $self-> |
5581 |
|
|
owner_document |
5582 |
|
|
; |
5583 |
|
|
if ($od-> |
5584 |
|
|
strict_error_checking |
5585 |
|
|
) { |
5586 |
|
|
|
5587 |
|
|
|
5588 |
|
|
{ |
5589 |
|
|
|
5590 |
|
|
if |
5591 |
|
|
($self-> |
5592 |
|
|
manakai_read_only |
5593 |
|
|
) { |
5594 |
|
|
|
5595 |
|
|
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'; |
5596 |
|
|
|
5597 |
|
|
; |
5598 |
|
|
} |
5599 |
|
|
|
5600 |
|
|
|
5601 |
|
|
;} |
5602 |
|
|
|
5603 |
|
|
; |
5604 |
|
|
my $nsuri; |
5605 |
|
|
|
5606 |
|
|
|
5607 |
|
|
{ |
5608 |
|
|
|
5609 |
|
|
|
5610 |
|
|
$nsuri = $self->{ |
5611 |
|
|
'b' |
5612 |
|
|
}->{${$self->{ |
5613 |
|
|
'id' |
5614 |
|
|
}}} |
5615 |
|
|
->{'ns'}; |
5616 |
|
|
|
5617 |
|
|
|
5618 |
|
|
;} |
5619 |
|
|
|
5620 |
|
|
; |
5621 |
|
|
if (not defined $nsuri) { |
5622 |
|
|
|
5623 |
|
|
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'; |
5624 |
|
|
|
5625 |
|
|
; |
5626 |
|
|
} elsif ($$nsuri ne |
5627 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
5628 |
|
|
|
5629 |
|
|
defined $given and $given eq 'xml') { |
5630 |
|
|
|
5631 |
|
|
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'; |
5632 |
|
|
|
5633 |
|
|
; |
5634 |
|
|
} elsif ($$nsuri ne |
5635 |
|
|
'http://www.w3.org/2000/xmlns/' and |
5636 |
|
|
|
5637 |
|
|
defined $given and $given eq 'xmlns') { |
5638 |
|
|
|
5639 |
|
|
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'; |
5640 |
|
|
|
5641 |
|
|
; |
5642 |
|
|
} elsif ($self-> |
5643 |
|
|
node_name eq |
5644 |
|
|
'xmlns') { |
5645 |
|
|
|
5646 |
|
|
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'; |
5647 |
|
|
|
5648 |
|
|
; |
5649 |
|
|
} |
5650 |
|
|
my $version = $od-> |
5651 |
|
|
xml_version |
5652 |
|
|
; |
5653 |
|
|
|
5654 |
|
|
|
5655 |
|
|
{ |
5656 |
|
|
|
5657 |
|
|
if |
5658 |
|
|
(defined $given and $given eq '') { |
5659 |
|
|
|
5660 |
|
|
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'; |
5661 |
|
|
|
5662 |
|
|
; |
5663 |
|
|
undef $given; |
5664 |
|
|
} |
5665 |
|
|
if (defined $given) { |
5666 |
|
|
if (($version eq '1.0' and |
5667 |
|
|
not |
5668 |
|
|
($given =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
5669 |
|
|
) or |
5670 |
|
|
($version eq '1.1' and |
5671 |
|
|
not |
5672 |
|
|
($given =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
5673 |
|
|
)) { |
5674 |
|
|
|
5675 |
|
|
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'; |
5676 |
|
|
|
5677 |
|
|
; |
5678 |
|
|
} elsif (index ($given, ':') > -1) { |
5679 |
|
|
|
5680 |
|
|
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'; |
5681 |
|
|
|
5682 |
|
|
; |
5683 |
|
|
} |
5684 |
|
|
} # has prefix |
5685 |
|
|
|
5686 |
|
|
|
5687 |
|
|
;} |
5688 |
|
|
|
5689 |
|
|
; |
5690 |
|
|
} # strict |
5691 |
|
|
my $v = defined $given ? \$given : |
5692 |
|
|
undef |
5693 |
|
|
; |
5694 |
|
|
|
5695 |
|
|
|
5696 |
|
|
{ |
5697 |
|
|
|
5698 |
|
|
|
5699 |
|
|
$self->{ |
5700 |
|
|
'b' |
5701 |
|
|
}->{${$self->{ |
5702 |
|
|
'id' |
5703 |
|
|
}}} |
5704 |
|
|
->{'pfx'} = $v; |
5705 |
|
|
|
5706 |
|
|
|
5707 |
|
|
;} |
5708 |
|
|
|
5709 |
|
|
; |
5710 |
|
|
|
5711 |
|
|
|
5712 |
|
|
;} |
5713 |
|
|
} |
5714 |
|
|
} |
5715 |
|
|
sub append_child ($$) { |
5716 |
|
|
my ($self, $newChild) = @_; |
5717 |
|
|
my $r; |
5718 |
|
|
|
5719 |
|
|
{ |
5720 |
|
|
|
5721 |
|
|
my |
5722 |
|
|
$self_od = $self-> |
5723 |
|
|
owner_document |
5724 |
|
|
; |
5725 |
|
|
my $child_od = $newChild-> |
5726 |
|
|
owner_document |
5727 |
|
|
; |
5728 |
|
|
my $child_nt = $newChild-> |
5729 |
|
|
node_type |
5730 |
|
|
; |
5731 |
|
|
|
5732 |
|
|
|
5733 |
|
|
{ |
5734 |
|
|
|
5735 |
|
|
|
5736 |
|
|
{ |
5737 |
|
|
|
5738 |
|
|
local $Error::Depth = $Error::Depth + 1; |
5739 |
|
|
|
5740 |
|
|
{ |
5741 |
|
|
|
5742 |
|
|
|
5743 |
|
|
my |
5744 |
|
|
$strict = $self_od-> |
5745 |
|
|
strict_error_checking |
5746 |
|
|
; |
5747 |
|
|
|
5748 |
|
|
## -- Node Type check |
5749 |
|
|
my @new_child; |
5750 |
|
|
if ({ |
5751 |
|
|
3 => 1, |
5752 |
|
|
5 => 1, |
5753 |
|
|
}->{$child_nt}) { |
5754 |
|
|
push @new_child, $newChild; |
5755 |
|
|
} elsif ($child_nt == |
5756 |
|
|
11 |
5757 |
|
|
) { |
5758 |
|
|
for my $cn (@{$newChild-> |
5759 |
|
|
child_nodes |
5760 |
|
|
}) { |
5761 |
|
|
unless ({ |
5762 |
|
|
3 => 1, |
5763 |
|
|
5 => 1, |
5764 |
|
|
}->{$cn-> |
5765 |
|
|
node_type |
5766 |
|
|
}) { |
5767 |
|
|
|
5768 |
|
|
|
5769 |
|
|
{ |
5770 |
|
|
|
5771 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5772 |
|
|
|
5773 |
|
|
{ |
5774 |
|
|
|
5775 |
|
|
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; |
5776 |
|
|
|
5777 |
|
|
|
5778 |
|
|
;} |
5779 |
|
|
|
5780 |
|
|
|
5781 |
|
|
;} |
5782 |
|
|
|
5783 |
|
|
; |
5784 |
|
|
} |
5785 |
|
|
push @new_child, $cn; |
5786 |
|
|
} |
5787 |
|
|
} else { |
5788 |
|
|
|
5789 |
|
|
|
5790 |
|
|
{ |
5791 |
|
|
|
5792 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5793 |
|
|
|
5794 |
|
|
{ |
5795 |
|
|
|
5796 |
|
|
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; |
5797 |
|
|
|
5798 |
|
|
|
5799 |
|
|
;} |
5800 |
|
|
|
5801 |
|
|
|
5802 |
|
|
;} |
5803 |
|
|
|
5804 |
|
|
; |
5805 |
|
|
} |
5806 |
|
|
|
5807 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
5808 |
|
|
parent_node |
5809 |
|
|
: |
5810 |
|
|
|
5811 |
|
|
undef |
5812 |
|
|
; |
5813 |
|
|
if ($strict) { |
5814 |
|
|
## -- Wrong-document check |
5815 |
|
|
unless ($self_od eq $child_od) { |
5816 |
|
|
|
5817 |
|
|
|
5818 |
|
|
{ |
5819 |
|
|
|
5820 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5821 |
|
|
|
5822 |
|
|
{ |
5823 |
|
|
|
5824 |
|
|
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; |
5825 |
|
|
|
5826 |
|
|
|
5827 |
|
|
;} |
5828 |
|
|
|
5829 |
|
|
|
5830 |
|
|
;} |
5831 |
|
|
|
5832 |
|
|
; |
5833 |
|
|
} |
5834 |
|
|
|
5835 |
|
|
## -- Read-onlyness check |
5836 |
|
|
if ($self-> |
5837 |
|
|
manakai_read_only |
5838 |
|
|
) { |
5839 |
|
|
|
5840 |
|
|
|
5841 |
|
|
{ |
5842 |
|
|
|
5843 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5844 |
|
|
|
5845 |
|
|
{ |
5846 |
|
|
|
5847 |
|
|
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'; |
5848 |
|
|
|
5849 |
|
|
|
5850 |
|
|
;} |
5851 |
|
|
|
5852 |
|
|
|
5853 |
|
|
;} |
5854 |
|
|
|
5855 |
|
|
; |
5856 |
|
|
} |
5857 |
|
|
if (@new_child) { |
5858 |
|
|
if ($nc_parent and |
5859 |
|
|
$nc_parent-> |
5860 |
|
|
manakai_read_only |
5861 |
|
|
) { |
5862 |
|
|
|
5863 |
|
|
|
5864 |
|
|
{ |
5865 |
|
|
|
5866 |
|
|
local $Error::Depth = $Error::Depth - 1; |
5867 |
|
|
|
5868 |
|
|
{ |
5869 |
|
|
|
5870 |
|
|
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'; |
5871 |
|
|
|
5872 |
|
|
|
5873 |
|
|
;} |
5874 |
|
|
|
5875 |
|
|
|
5876 |
|
|
;} |
5877 |
|
|
|
5878 |
|
|
; |
5879 |
|
|
} |
5880 |
|
|
} |
5881 |
|
|
} |
5882 |
|
|
|
5883 |
|
|
## -- Insert at... |
5884 |
|
|
my $index = -1; # last |
5885 |
|
|
|
5886 |
|
|
|
5887 |
|
|
; # FOR !tc:ForAppendChild |
5888 |
|
|
|
5889 |
|
|
## -- Removes from parent |
5890 |
|
|
if ($nc_parent) { |
5891 |
|
|
if ($child_nt == |
5892 |
|
|
11 |
5893 |
|
|
) { |
5894 |
|
|
|
5895 |
|
|
|
5896 |
|
|
{ |
5897 |
|
|
|
5898 |
|
|
|
5899 |
|
|
$newChild->{ |
5900 |
|
|
'b' |
5901 |
|
|
}->{${$newChild->{ |
5902 |
|
|
'id' |
5903 |
|
|
}}} |
5904 |
|
|
->{'child'} = []; |
5905 |
|
|
|
5906 |
|
|
|
5907 |
|
|
;} |
5908 |
|
|
|
5909 |
|
|
; |
5910 |
|
|
} else { |
5911 |
|
|
my $v; |
5912 |
|
|
|
5913 |
|
|
|
5914 |
|
|
{ |
5915 |
|
|
|
5916 |
|
|
|
5917 |
|
|
$v = $nc_parent->{ |
5918 |
|
|
'b' |
5919 |
|
|
}->{${$nc_parent->{ |
5920 |
|
|
'id' |
5921 |
|
|
}}} |
5922 |
|
|
->{'child'}; |
5923 |
|
|
|
5924 |
|
|
|
5925 |
|
|
;} |
5926 |
|
|
|
5927 |
|
|
; |
5928 |
|
|
RP: for my $i (0..$#$v) { |
5929 |
|
|
my $nodeid = $v->[$i]; |
5930 |
|
|
if ( |
5931 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
5932 |
|
|
) { |
5933 |
|
|
splice @$v, $i, 1, (); |
5934 |
|
|
last RP; |
5935 |
|
|
} |
5936 |
|
|
} # RP |
5937 |
|
|
} |
5938 |
|
|
} |
5939 |
|
|
|
5940 |
|
|
## -- Rewrite the |parentNode| properties |
5941 |
|
|
for my $nc (@new_child) { |
5942 |
|
|
|
5943 |
|
|
|
5944 |
|
|
{ |
5945 |
|
|
|
5946 |
|
|
|
5947 |
|
|
$nc->{ |
5948 |
|
|
'b' |
5949 |
|
|
}->{${$nc->{ |
5950 |
|
|
'id' |
5951 |
|
|
}}} |
5952 |
|
|
->{'parent'} = $self->{ |
5953 |
|
|
'id' |
5954 |
|
|
}; |
5955 |
|
|
|
5956 |
|
|
|
5957 |
|
|
;} |
5958 |
|
|
|
5959 |
|
|
; |
5960 |
|
|
} |
5961 |
|
|
|
5962 |
|
|
my $children; |
5963 |
|
|
|
5964 |
|
|
|
5965 |
|
|
{ |
5966 |
|
|
|
5967 |
|
|
|
5968 |
|
|
$children = $self->{ |
5969 |
|
|
'b' |
5970 |
|
|
}->{${$self->{ |
5971 |
|
|
'id' |
5972 |
|
|
}}} |
5973 |
|
|
->{'child'}; |
5974 |
|
|
|
5975 |
|
|
|
5976 |
|
|
;} |
5977 |
|
|
|
5978 |
|
|
; |
5979 |
|
|
|
5980 |
|
|
|
5981 |
|
|
|
5982 |
|
|
{ |
5983 |
|
|
|
5984 |
|
|
|
5985 |
|
|
## -- Adds to children list |
5986 |
|
|
push @$children, map { |
5987 |
|
|
|
5988 |
|
|
$_->{'id'} |
5989 |
|
|
|
5990 |
|
|
} @new_child; |
5991 |
|
|
$r = $newChild; |
5992 |
|
|
|
5993 |
|
|
|
5994 |
|
|
|
5995 |
|
|
;} |
5996 |
|
|
|
5997 |
|
|
; |
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 |
|
|
$r} |
6024 |
|
|
sub insert_before ($$;$) { |
6025 |
|
|
my ($self, $newChild, $refChild) = @_; |
6026 |
|
|
my $r; |
6027 |
|
|
|
6028 |
|
|
{ |
6029 |
|
|
|
6030 |
|
|
my |
6031 |
|
|
$self_od = $self-> |
6032 |
|
|
owner_document |
6033 |
|
|
; |
6034 |
|
|
my $child_od = $newChild-> |
6035 |
|
|
owner_document |
6036 |
|
|
; |
6037 |
|
|
my $child_nt = $newChild-> |
6038 |
|
|
node_type |
6039 |
|
|
; |
6040 |
|
|
|
6041 |
|
|
|
6042 |
|
|
{ |
6043 |
|
|
|
6044 |
|
|
|
6045 |
|
|
{ |
6046 |
|
|
|
6047 |
|
|
local $Error::Depth = $Error::Depth + 1; |
6048 |
|
|
|
6049 |
|
|
{ |
6050 |
|
|
|
6051 |
|
|
|
6052 |
|
|
my |
6053 |
|
|
$strict = $self_od-> |
6054 |
|
|
strict_error_checking |
6055 |
|
|
; |
6056 |
|
|
|
6057 |
|
|
## -- Node Type check |
6058 |
|
|
my @new_child; |
6059 |
|
|
if ({ |
6060 |
|
|
3 => 1, |
6061 |
|
|
5 => 1, |
6062 |
|
|
}->{$child_nt}) { |
6063 |
|
|
push @new_child, $newChild; |
6064 |
|
|
} elsif ($child_nt == |
6065 |
|
|
11 |
6066 |
|
|
) { |
6067 |
|
|
for my $cn (@{$newChild-> |
6068 |
|
|
child_nodes |
6069 |
|
|
}) { |
6070 |
|
|
unless ({ |
6071 |
|
|
3 => 1, |
6072 |
|
|
5 => 1, |
6073 |
|
|
}->{$cn-> |
6074 |
|
|
node_type |
6075 |
|
|
}) { |
6076 |
|
|
|
6077 |
|
|
|
6078 |
|
|
{ |
6079 |
|
|
|
6080 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6081 |
|
|
|
6082 |
|
|
{ |
6083 |
|
|
|
6084 |
|
|
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; |
6085 |
|
|
|
6086 |
|
|
|
6087 |
|
|
;} |
6088 |
|
|
|
6089 |
|
|
|
6090 |
|
|
;} |
6091 |
|
|
|
6092 |
|
|
; |
6093 |
|
|
} |
6094 |
|
|
push @new_child, $cn; |
6095 |
|
|
} |
6096 |
|
|
} else { |
6097 |
|
|
|
6098 |
|
|
|
6099 |
|
|
{ |
6100 |
|
|
|
6101 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6102 |
|
|
|
6103 |
|
|
{ |
6104 |
|
|
|
6105 |
|
|
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; |
6106 |
|
|
|
6107 |
|
|
|
6108 |
|
|
;} |
6109 |
|
|
|
6110 |
|
|
|
6111 |
|
|
;} |
6112 |
|
|
|
6113 |
|
|
; |
6114 |
|
|
} |
6115 |
|
|
|
6116 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
6117 |
|
|
parent_node |
6118 |
|
|
: |
6119 |
|
|
|
6120 |
|
|
undef |
6121 |
|
|
; |
6122 |
|
|
if ($strict) { |
6123 |
|
|
## -- Wrong-document check |
6124 |
|
|
unless ($self_od eq $child_od) { |
6125 |
|
|
|
6126 |
|
|
|
6127 |
|
|
{ |
6128 |
|
|
|
6129 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6130 |
|
|
|
6131 |
|
|
{ |
6132 |
|
|
|
6133 |
|
|
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; |
6134 |
|
|
|
6135 |
|
|
|
6136 |
|
|
;} |
6137 |
|
|
|
6138 |
|
|
|
6139 |
|
|
;} |
6140 |
|
|
|
6141 |
|
|
; |
6142 |
|
|
} |
6143 |
|
|
|
6144 |
|
|
## -- Read-onlyness check |
6145 |
|
|
if ($self-> |
6146 |
|
|
manakai_read_only |
6147 |
|
|
) { |
6148 |
|
|
|
6149 |
|
|
|
6150 |
|
|
{ |
6151 |
|
|
|
6152 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6153 |
|
|
|
6154 |
|
|
{ |
6155 |
|
|
|
6156 |
|
|
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'; |
6157 |
|
|
|
6158 |
|
|
|
6159 |
|
|
;} |
6160 |
|
|
|
6161 |
|
|
|
6162 |
|
|
;} |
6163 |
|
|
|
6164 |
|
|
; |
6165 |
|
|
} |
6166 |
|
|
if (@new_child) { |
6167 |
|
|
if ($nc_parent and |
6168 |
|
|
$nc_parent-> |
6169 |
|
|
manakai_read_only |
6170 |
|
|
) { |
6171 |
|
|
|
6172 |
|
|
|
6173 |
|
|
{ |
6174 |
|
|
|
6175 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6176 |
|
|
|
6177 |
|
|
{ |
6178 |
|
|
|
6179 |
|
|
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'; |
6180 |
|
|
|
6181 |
|
|
|
6182 |
|
|
;} |
6183 |
|
|
|
6184 |
|
|
|
6185 |
|
|
;} |
6186 |
|
|
|
6187 |
|
|
; |
6188 |
|
|
} |
6189 |
|
|
} |
6190 |
|
|
} |
6191 |
|
|
|
6192 |
|
|
## -- Insert at... |
6193 |
|
|
my $index = -1; # last |
6194 |
|
|
|
6195 |
|
|
|
6196 |
|
|
{ |
6197 |
|
|
|
6198 |
|
|
|
6199 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
6200 |
|
|
if (defined $refChild) { |
6201 |
|
|
if ($refChild eq $newChild) { |
6202 |
|
|
|
6203 |
|
|
|
6204 |
|
|
{ |
6205 |
|
|
|
6206 |
|
|
|
6207 |
|
|
{ |
6208 |
|
|
|
6209 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6210 |
|
|
|
6211 |
|
|
{ |
6212 |
|
|
|
6213 |
|
|
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'; |
6214 |
|
|
|
6215 |
|
|
|
6216 |
|
|
;} |
6217 |
|
|
|
6218 |
|
|
|
6219 |
|
|
;} |
6220 |
|
|
|
6221 |
|
|
; |
6222 |
|
|
|
6223 |
|
|
|
6224 |
|
|
|
6225 |
|
|
;} |
6226 |
|
|
|
6227 |
|
|
; |
6228 |
|
|
|
6229 |
|
|
|
6230 |
|
|
; |
6231 |
|
|
} |
6232 |
|
|
|
6233 |
|
|
my $cns = $self-> |
6234 |
|
|
child_nodes |
6235 |
|
|
; |
6236 |
|
|
my $cnsl = @$cns; |
6237 |
|
|
C: { |
6238 |
|
|
$index = 0; |
6239 |
|
|
for my $i (0..($cnsl-1)) { |
6240 |
|
|
my $cn = $cns->[$i]; |
6241 |
|
|
if ($cn eq $refChild) { |
6242 |
|
|
$index += $i; |
6243 |
|
|
last C; |
6244 |
|
|
} elsif ($cn eq $newChild) { |
6245 |
|
|
$index = -1; # offset |
6246 |
|
|
} |
6247 |
|
|
} |
6248 |
|
|
|
6249 |
|
|
|
6250 |
|
|
{ |
6251 |
|
|
|
6252 |
|
|
|
6253 |
|
|
{ |
6254 |
|
|
|
6255 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6256 |
|
|
|
6257 |
|
|
{ |
6258 |
|
|
|
6259 |
|
|
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; |
6260 |
|
|
|
6261 |
|
|
|
6262 |
|
|
;} |
6263 |
|
|
|
6264 |
|
|
|
6265 |
|
|
;} |
6266 |
|
|
|
6267 |
|
|
; |
6268 |
|
|
|
6269 |
|
|
|
6270 |
|
|
|
6271 |
|
|
;} |
6272 |
|
|
|
6273 |
|
|
; |
6274 |
|
|
|
6275 |
|
|
|
6276 |
|
|
; |
6277 |
|
|
} # C |
6278 |
|
|
} else { # |oldChild| is not defined |
6279 |
|
|
|
6280 |
|
|
|
6281 |
|
|
; |
6282 |
|
|
} |
6283 |
|
|
|
6284 |
|
|
|
6285 |
|
|
|
6286 |
|
|
;} |
6287 |
|
|
|
6288 |
|
|
; # FOR !tc:ForAppendChild |
6289 |
|
|
|
6290 |
|
|
## -- Removes from parent |
6291 |
|
|
if ($nc_parent) { |
6292 |
|
|
if ($child_nt == |
6293 |
|
|
11 |
6294 |
|
|
) { |
6295 |
|
|
|
6296 |
|
|
|
6297 |
|
|
{ |
6298 |
|
|
|
6299 |
|
|
|
6300 |
|
|
$newChild->{ |
6301 |
|
|
'b' |
6302 |
|
|
}->{${$newChild->{ |
6303 |
|
|
'id' |
6304 |
|
|
}}} |
6305 |
|
|
->{'child'} = []; |
6306 |
|
|
|
6307 |
|
|
|
6308 |
|
|
;} |
6309 |
|
|
|
6310 |
|
|
; |
6311 |
|
|
} else { |
6312 |
|
|
my $v; |
6313 |
|
|
|
6314 |
|
|
|
6315 |
|
|
{ |
6316 |
|
|
|
6317 |
|
|
|
6318 |
|
|
$v = $nc_parent->{ |
6319 |
|
|
'b' |
6320 |
|
|
}->{${$nc_parent->{ |
6321 |
|
|
'id' |
6322 |
|
|
}}} |
6323 |
|
|
->{'child'}; |
6324 |
|
|
|
6325 |
|
|
|
6326 |
|
|
;} |
6327 |
|
|
|
6328 |
|
|
; |
6329 |
|
|
RP: for my $i (0..$#$v) { |
6330 |
|
|
my $nodeid = $v->[$i]; |
6331 |
|
|
if ( |
6332 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
6333 |
|
|
) { |
6334 |
|
|
splice @$v, $i, 1, (); |
6335 |
|
|
last RP; |
6336 |
|
|
} |
6337 |
|
|
} # RP |
6338 |
|
|
} |
6339 |
|
|
} |
6340 |
|
|
|
6341 |
|
|
## -- Rewrite the |parentNode| properties |
6342 |
|
|
for my $nc (@new_child) { |
6343 |
|
|
|
6344 |
|
|
|
6345 |
|
|
{ |
6346 |
|
|
|
6347 |
|
|
|
6348 |
|
|
$nc->{ |
6349 |
|
|
'b' |
6350 |
|
|
}->{${$nc->{ |
6351 |
|
|
'id' |
6352 |
|
|
}}} |
6353 |
|
|
->{'parent'} = $self->{ |
6354 |
|
|
'id' |
6355 |
|
|
}; |
6356 |
|
|
|
6357 |
|
|
|
6358 |
|
|
;} |
6359 |
|
|
|
6360 |
|
|
; |
6361 |
|
|
} |
6362 |
|
|
|
6363 |
|
|
my $children; |
6364 |
|
|
|
6365 |
|
|
|
6366 |
|
|
{ |
6367 |
|
|
|
6368 |
|
|
|
6369 |
|
|
$children = $self->{ |
6370 |
|
|
'b' |
6371 |
|
|
}->{${$self->{ |
6372 |
|
|
'id' |
6373 |
|
|
}}} |
6374 |
|
|
->{'child'}; |
6375 |
|
|
|
6376 |
|
|
|
6377 |
|
|
;} |
6378 |
|
|
|
6379 |
|
|
; |
6380 |
|
|
|
6381 |
|
|
|
6382 |
|
|
|
6383 |
|
|
; |
6384 |
|
|
|
6385 |
|
|
|
6386 |
|
|
|
6387 |
|
|
{ |
6388 |
|
|
|
6389 |
|
|
|
6390 |
|
|
## -- Adds to children list |
6391 |
|
|
if ($index == -1) { |
6392 |
|
|
push @$children, map { |
6393 |
|
|
|
6394 |
|
|
$_->{'id'} |
6395 |
|
|
|
6396 |
|
|
} @new_child; |
6397 |
|
|
} else { |
6398 |
|
|
splice @$children, $index, 0, map { |
6399 |
|
|
|
6400 |
|
|
$_->{'id'} |
6401 |
|
|
|
6402 |
|
|
} @new_child; |
6403 |
|
|
} |
6404 |
|
|
$r = $newChild; |
6405 |
|
|
|
6406 |
|
|
|
6407 |
|
|
|
6408 |
|
|
;} |
6409 |
|
|
|
6410 |
|
|
; |
6411 |
|
|
|
6412 |
|
|
|
6413 |
|
|
|
6414 |
|
|
; |
6415 |
|
|
|
6416 |
|
|
|
6417 |
|
|
|
6418 |
|
|
;} |
6419 |
|
|
|
6420 |
|
|
|
6421 |
|
|
;} |
6422 |
|
|
|
6423 |
|
|
; |
6424 |
|
|
|
6425 |
|
|
|
6426 |
|
|
;} |
6427 |
|
|
|
6428 |
|
|
; |
6429 |
|
|
|
6430 |
|
|
|
6431 |
|
|
;} |
6432 |
|
|
$r} |
6433 |
|
|
sub replace_child ($$$) { |
6434 |
|
|
my ($self, $newChild, $oldChild) = @_; |
6435 |
|
|
my $r; |
6436 |
|
|
|
6437 |
|
|
{ |
6438 |
|
|
|
6439 |
|
|
my |
6440 |
|
|
$self_od = $self-> |
6441 |
|
|
owner_document |
6442 |
|
|
; |
6443 |
|
|
my $child_od = $newChild-> |
6444 |
|
|
owner_document |
6445 |
|
|
; |
6446 |
|
|
my $child_nt = $newChild-> |
6447 |
|
|
node_type |
6448 |
|
|
; |
6449 |
|
|
|
6450 |
|
|
|
6451 |
|
|
{ |
6452 |
|
|
|
6453 |
|
|
|
6454 |
|
|
{ |
6455 |
|
|
|
6456 |
|
|
local $Error::Depth = $Error::Depth + 1; |
6457 |
|
|
|
6458 |
|
|
{ |
6459 |
|
|
|
6460 |
|
|
|
6461 |
|
|
my |
6462 |
|
|
$strict = $self_od-> |
6463 |
|
|
strict_error_checking |
6464 |
|
|
; |
6465 |
|
|
|
6466 |
|
|
## -- Node Type check |
6467 |
|
|
my @new_child; |
6468 |
|
|
if ({ |
6469 |
|
|
3 => 1, |
6470 |
|
|
5 => 1, |
6471 |
|
|
}->{$child_nt}) { |
6472 |
|
|
push @new_child, $newChild; |
6473 |
|
|
} elsif ($child_nt == |
6474 |
|
|
11 |
6475 |
|
|
) { |
6476 |
|
|
for my $cn (@{$newChild-> |
6477 |
|
|
child_nodes |
6478 |
|
|
}) { |
6479 |
|
|
unless ({ |
6480 |
|
|
3 => 1, |
6481 |
|
|
5 => 1, |
6482 |
|
|
}->{$cn-> |
6483 |
|
|
node_type |
6484 |
|
|
}) { |
6485 |
|
|
|
6486 |
|
|
|
6487 |
|
|
{ |
6488 |
|
|
|
6489 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6490 |
|
|
|
6491 |
|
|
{ |
6492 |
|
|
|
6493 |
|
|
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; |
6494 |
|
|
|
6495 |
|
|
|
6496 |
|
|
;} |
6497 |
|
|
|
6498 |
|
|
|
6499 |
|
|
;} |
6500 |
|
|
|
6501 |
|
|
; |
6502 |
|
|
} |
6503 |
|
|
push @new_child, $cn; |
6504 |
|
|
} |
6505 |
|
|
} else { |
6506 |
|
|
|
6507 |
|
|
|
6508 |
|
|
{ |
6509 |
|
|
|
6510 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6511 |
|
|
|
6512 |
|
|
{ |
6513 |
|
|
|
6514 |
|
|
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; |
6515 |
|
|
|
6516 |
|
|
|
6517 |
|
|
;} |
6518 |
|
|
|
6519 |
|
|
|
6520 |
|
|
;} |
6521 |
|
|
|
6522 |
|
|
; |
6523 |
|
|
} |
6524 |
|
|
|
6525 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
6526 |
|
|
parent_node |
6527 |
|
|
: |
6528 |
|
|
|
6529 |
|
|
undef |
6530 |
|
|
; |
6531 |
|
|
if ($strict) { |
6532 |
|
|
## -- Wrong-document check |
6533 |
|
|
unless ($self_od eq $child_od) { |
6534 |
|
|
|
6535 |
|
|
|
6536 |
|
|
{ |
6537 |
|
|
|
6538 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6539 |
|
|
|
6540 |
|
|
{ |
6541 |
|
|
|
6542 |
|
|
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; |
6543 |
|
|
|
6544 |
|
|
|
6545 |
|
|
;} |
6546 |
|
|
|
6547 |
|
|
|
6548 |
|
|
;} |
6549 |
|
|
|
6550 |
|
|
; |
6551 |
|
|
} |
6552 |
|
|
|
6553 |
|
|
## -- Read-onlyness check |
6554 |
|
|
if ($self-> |
6555 |
|
|
manakai_read_only |
6556 |
|
|
) { |
6557 |
|
|
|
6558 |
|
|
|
6559 |
|
|
{ |
6560 |
|
|
|
6561 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6562 |
|
|
|
6563 |
|
|
{ |
6564 |
|
|
|
6565 |
|
|
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'; |
6566 |
|
|
|
6567 |
|
|
|
6568 |
|
|
;} |
6569 |
|
|
|
6570 |
|
|
|
6571 |
|
|
;} |
6572 |
|
|
|
6573 |
|
|
; |
6574 |
|
|
} |
6575 |
|
|
if (@new_child) { |
6576 |
|
|
if ($nc_parent and |
6577 |
|
|
$nc_parent-> |
6578 |
|
|
manakai_read_only |
6579 |
|
|
) { |
6580 |
|
|
|
6581 |
|
|
|
6582 |
|
|
{ |
6583 |
|
|
|
6584 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6585 |
|
|
|
6586 |
|
|
{ |
6587 |
|
|
|
6588 |
|
|
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'; |
6589 |
|
|
|
6590 |
|
|
|
6591 |
|
|
;} |
6592 |
|
|
|
6593 |
|
|
|
6594 |
|
|
;} |
6595 |
|
|
|
6596 |
|
|
; |
6597 |
|
|
} |
6598 |
|
|
} |
6599 |
|
|
} |
6600 |
|
|
|
6601 |
|
|
## -- Insert at... |
6602 |
|
|
my $index = -1; # last |
6603 |
|
|
|
6604 |
|
|
|
6605 |
|
|
{ |
6606 |
|
|
|
6607 |
|
|
|
6608 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
6609 |
|
|
if (defined $oldChild) { |
6610 |
|
|
if ($oldChild eq $newChild) { |
6611 |
|
|
|
6612 |
|
|
|
6613 |
|
|
; |
6614 |
|
|
|
6615 |
|
|
|
6616 |
|
|
{ |
6617 |
|
|
|
6618 |
|
|
|
6619 |
|
|
{ |
6620 |
|
|
|
6621 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6622 |
|
|
|
6623 |
|
|
{ |
6624 |
|
|
|
6625 |
|
|
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'; |
6626 |
|
|
|
6627 |
|
|
|
6628 |
|
|
;} |
6629 |
|
|
|
6630 |
|
|
|
6631 |
|
|
;} |
6632 |
|
|
|
6633 |
|
|
; |
6634 |
|
|
|
6635 |
|
|
|
6636 |
|
|
|
6637 |
|
|
;} |
6638 |
|
|
|
6639 |
|
|
; |
6640 |
|
|
} |
6641 |
|
|
|
6642 |
|
|
my $cns = $self-> |
6643 |
|
|
child_nodes |
6644 |
|
|
; |
6645 |
|
|
my $cnsl = @$cns; |
6646 |
|
|
C: { |
6647 |
|
|
$index = 0; |
6648 |
|
|
for my $i (0..($cnsl-1)) { |
6649 |
|
|
my $cn = $cns->[$i]; |
6650 |
|
|
if ($cn eq $oldChild) { |
6651 |
|
|
$index += $i; |
6652 |
|
|
last C; |
6653 |
|
|
} elsif ($cn eq $newChild) { |
6654 |
|
|
$index = -1; # offset |
6655 |
|
|
} |
6656 |
|
|
} |
6657 |
|
|
|
6658 |
|
|
|
6659 |
|
|
; |
6660 |
|
|
|
6661 |
|
|
|
6662 |
|
|
{ |
6663 |
|
|
|
6664 |
|
|
|
6665 |
|
|
{ |
6666 |
|
|
|
6667 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6668 |
|
|
|
6669 |
|
|
{ |
6670 |
|
|
|
6671 |
|
|
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; |
6672 |
|
|
|
6673 |
|
|
|
6674 |
|
|
;} |
6675 |
|
|
|
6676 |
|
|
|
6677 |
|
|
;} |
6678 |
|
|
|
6679 |
|
|
; |
6680 |
|
|
|
6681 |
|
|
|
6682 |
|
|
|
6683 |
|
|
;} |
6684 |
|
|
|
6685 |
|
|
; |
6686 |
|
|
} # C |
6687 |
|
|
} else { # |oldChild| is not defined |
6688 |
|
|
|
6689 |
|
|
|
6690 |
|
|
{ |
6691 |
|
|
|
6692 |
|
|
|
6693 |
|
|
{ |
6694 |
|
|
|
6695 |
|
|
local $Error::Depth = $Error::Depth - 1; |
6696 |
|
|
|
6697 |
|
|
{ |
6698 |
|
|
|
6699 |
|
|
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; |
6700 |
|
|
|
6701 |
|
|
|
6702 |
|
|
;} |
6703 |
|
|
|
6704 |
|
|
|
6705 |
|
|
;} |
6706 |
|
|
|
6707 |
|
|
; |
6708 |
|
|
|
6709 |
|
|
|
6710 |
|
|
|
6711 |
|
|
;} |
6712 |
|
|
|
6713 |
|
|
; |
6714 |
|
|
} |
6715 |
|
|
|
6716 |
|
|
|
6717 |
|
|
|
6718 |
|
|
;} |
6719 |
|
|
|
6720 |
|
|
; # FOR !tc:ForAppendChild |
6721 |
|
|
|
6722 |
|
|
## -- Removes from parent |
6723 |
|
|
if ($nc_parent) { |
6724 |
|
|
if ($child_nt == |
6725 |
|
|
11 |
6726 |
|
|
) { |
6727 |
|
|
|
6728 |
|
|
|
6729 |
|
|
{ |
6730 |
|
|
|
6731 |
|
|
|
6732 |
|
|
$newChild->{ |
6733 |
|
|
'b' |
6734 |
|
|
}->{${$newChild->{ |
6735 |
|
|
'id' |
6736 |
|
|
}}} |
6737 |
|
|
->{'child'} = []; |
6738 |
|
|
|
6739 |
|
|
|
6740 |
|
|
;} |
6741 |
|
|
|
6742 |
|
|
; |
6743 |
|
|
} else { |
6744 |
|
|
my $v; |
6745 |
|
|
|
6746 |
|
|
|
6747 |
|
|
{ |
6748 |
|
|
|
6749 |
|
|
|
6750 |
|
|
$v = $nc_parent->{ |
6751 |
|
|
'b' |
6752 |
|
|
}->{${$nc_parent->{ |
6753 |
|
|
'id' |
6754 |
|
|
}}} |
6755 |
|
|
->{'child'}; |
6756 |
|
|
|
6757 |
|
|
|
6758 |
|
|
;} |
6759 |
|
|
|
6760 |
|
|
; |
6761 |
|
|
RP: for my $i (0..$#$v) { |
6762 |
|
|
my $nodeid = $v->[$i]; |
6763 |
|
|
if ( |
6764 |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
6765 |
|
|
) { |
6766 |
|
|
splice @$v, $i, 1, (); |
6767 |
|
|
last RP; |
6768 |
|
|
} |
6769 |
|
|
} # RP |
6770 |
|
|
} |
6771 |
|
|
} |
6772 |
|
|
|
6773 |
|
|
## -- Rewrite the |parentNode| properties |
6774 |
|
|
for my $nc (@new_child) { |
6775 |
|
|
|
6776 |
|
|
|
6777 |
|
|
{ |
6778 |
|
|
|
6779 |
|
|
|
6780 |
|
|
$nc->{ |
6781 |
|
|
'b' |
6782 |
|
|
}->{${$nc->{ |
6783 |
|
|
'id' |
6784 |
|
|
}}} |
6785 |
|
|
->{'parent'} = $self->{ |
6786 |
|
|
'id' |
6787 |
|
|
}; |
6788 |
|
|
|
6789 |
|
|
|
6790 |
|
|
;} |
6791 |
|
|
|
6792 |
|
|
; |
6793 |
|
|
} |
6794 |
|
|
|
6795 |
|
|
my $children; |
6796 |
|
|
|
6797 |
|
|
|
6798 |
|
|
{ |
6799 |
|
|
|
6800 |
|
|
|
6801 |
|
|
$children = $self->{ |
6802 |
|
|
'b' |
6803 |
|
|
}->{${$self->{ |
6804 |
|
|
'id' |
6805 |
|
|
}}} |
6806 |
|
|
->{'child'}; |
6807 |
|
|
|
6808 |
|
|
|
6809 |
|
|
;} |
6810 |
|
|
|
6811 |
|
|
; |
6812 |
|
|
|
6813 |
|
|
|
6814 |
|
|
|
6815 |
|
|
; |
6816 |
|
|
|
6817 |
|
|
|
6818 |
|
|
|
6819 |
|
|
; |
6820 |
|
|
|
6821 |
|
|
|
6822 |
|
|
|
6823 |
|
|
{ |
6824 |
|
|
|
6825 |
|
|
|
6826 |
|
|
## -- Replaces the node |
6827 |
|
|
splice @$children, $index, 1, map { |
6828 |
|
|
|
6829 |
|
|
$_->{'id'} |
6830 |
|
|
|
6831 |
|
|
} @new_child; |
6832 |
|
|
|
6833 |
|
|
|
6834 |
|
|
{ |
6835 |
|
|
|
6836 |
|
|
CORE::delete |
6837 |
|
|
$oldChild->{ |
6838 |
|
|
'b' |
6839 |
|
|
}->{${$oldChild->{ |
6840 |
|
|
'id' |
6841 |
|
|
}}} |
6842 |
|
|
->{'parent'}; |
6843 |
|
|
|
6844 |
|
|
|
6845 |
|
|
;} |
6846 |
|
|
|
6847 |
|
|
; |
6848 |
|
|
$r = $oldChild; |
6849 |
|
|
|
6850 |
|
|
|
6851 |
|
|
|
6852 |
|
|
;} |
6853 |
|
|
|
6854 |
|
|
; |
6855 |
|
|
|
6856 |
|
|
|
6857 |
|
|
|
6858 |
|
|
;} |
6859 |
|
|
|
6860 |
|
|
|
6861 |
|
|
;} |
6862 |
|
|
|
6863 |
|
|
; |
6864 |
|
|
|
6865 |
|
|
|
6866 |
|
|
;} |
6867 |
|
|
|
6868 |
|
|
; |
6869 |
|
|
|
6870 |
|
|
|
6871 |
|
|
;} |
6872 |
|
|
$r} |
6873 |
|
|
sub node_name ($;$) { |
6874 |
|
|
if (@_ == 1) {my ($self) = @_; |
6875 |
|
|
my $r = ''; |
6876 |
|
|
|
6877 |
|
|
{ |
6878 |
|
|
|
6879 |
|
|
my |
6880 |
|
|
$prefix; |
6881 |
|
|
|
6882 |
|
|
|
6883 |
|
|
{ |
6884 |
|
|
|
6885 |
|
|
|
6886 |
|
|
$prefix = $self->{ |
6887 |
|
|
'b' |
6888 |
|
|
}->{${$self->{ |
6889 |
|
|
'id' |
6890 |
|
|
}}} |
6891 |
|
|
->{'pfx'}; |
6892 |
|
|
|
6893 |
|
|
|
6894 |
|
|
;} |
6895 |
|
|
|
6896 |
|
|
; |
6897 |
|
|
my $lname; |
6898 |
|
|
|
6899 |
|
|
|
6900 |
|
|
{ |
6901 |
|
|
|
6902 |
|
|
|
6903 |
|
|
$lname = $self->{ |
6904 |
|
|
'b' |
6905 |
|
|
}->{${$self->{ |
6906 |
|
|
'id' |
6907 |
|
|
}}} |
6908 |
|
|
->{'ln'}; |
6909 |
|
|
|
6910 |
|
|
|
6911 |
|
|
;} |
6912 |
|
|
|
6913 |
|
|
; |
6914 |
|
|
$r = defined $prefix ? $$prefix.':'.$$lname : $$lname; |
6915 |
|
|
|
6916 |
|
|
|
6917 |
|
|
;} |
6918 |
|
|
$r; |
6919 |
|
|
} else {my ($self) = @_; |
6920 |
|
|
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'; |
6921 |
|
|
} |
6922 |
|
|
} |
6923 |
|
|
sub name ($;$) { |
6924 |
|
|
if (@_ == 1) {my ($self) = @_; |
6925 |
|
|
my $r = ''; |
6926 |
|
|
|
6927 |
|
|
{ |
6928 |
|
|
|
6929 |
|
|
my |
6930 |
|
|
$prefix; |
6931 |
|
|
|
6932 |
|
|
|
6933 |
|
|
{ |
6934 |
|
|
|
6935 |
|
|
|
6936 |
|
|
$prefix = $self->{ |
6937 |
|
|
'b' |
6938 |
|
|
}->{${$self->{ |
6939 |
|
|
'id' |
6940 |
|
|
}}} |
6941 |
|
|
->{'pfx'}; |
6942 |
|
|
|
6943 |
|
|
|
6944 |
|
|
;} |
6945 |
|
|
|
6946 |
|
|
; |
6947 |
|
|
my $lname; |
6948 |
|
|
|
6949 |
|
|
|
6950 |
|
|
{ |
6951 |
|
|
|
6952 |
|
|
|
6953 |
|
|
$lname = $self->{ |
6954 |
|
|
'b' |
6955 |
|
|
}->{${$self->{ |
6956 |
|
|
'id' |
6957 |
|
|
}}} |
6958 |
|
|
->{'ln'}; |
6959 |
|
|
|
6960 |
|
|
|
6961 |
|
|
;} |
6962 |
|
|
|
6963 |
|
|
; |
6964 |
|
|
$r = defined $prefix ? $$prefix.':'.$$lname : $$lname; |
6965 |
|
|
|
6966 |
|
|
|
6967 |
|
|
;} |
6968 |
|
|
$r; |
6969 |
|
|
} else {my ($self) = @_; |
6970 |
|
|
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'; |
6971 |
|
|
} |
6972 |
|
|
} |
6973 |
|
|
sub node_value ($;$) { |
6974 |
|
|
if (@_ == 1) {my ($self) = @_; |
6975 |
|
|
my $r = ''; |
6976 |
|
|
|
6977 |
|
|
{ |
6978 |
|
|
|
6979 |
|
|
|
6980 |
|
|
{ |
6981 |
|
|
|
6982 |
|
|
local $Error::Depth = $Error::Depth + 1; |
6983 |
|
|
|
6984 |
|
|
{ |
6985 |
|
|
|
6986 |
|
|
|
6987 |
|
|
|
6988 |
|
|
$r = $self-> |
6989 |
|
|
value |
6990 |
|
|
; |
6991 |
|
|
|
6992 |
|
|
|
6993 |
|
|
|
6994 |
|
|
;} |
6995 |
|
|
|
6996 |
|
|
|
6997 |
|
|
;} |
6998 |
|
|
|
6999 |
|
|
; |
7000 |
|
|
|
7001 |
|
|
|
7002 |
|
|
;} |
7003 |
|
|
$r; |
7004 |
|
|
} else {my ($self, $given) = @_; |
7005 |
|
|
|
7006 |
|
|
{ |
7007 |
|
|
|
7008 |
|
|
|
7009 |
|
|
{ |
7010 |
|
|
|
7011 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7012 |
|
|
|
7013 |
|
|
{ |
7014 |
|
|
|
7015 |
|
|
|
7016 |
|
|
|
7017 |
|
|
$self-> |
7018 |
|
|
value |
7019 |
|
|
($given); |
7020 |
|
|
|
7021 |
|
|
|
7022 |
|
|
|
7023 |
|
|
;} |
7024 |
|
|
|
7025 |
|
|
|
7026 |
|
|
;} |
7027 |
|
|
|
7028 |
|
|
; |
7029 |
|
|
|
7030 |
|
|
|
7031 |
|
|
;} |
7032 |
|
|
} |
7033 |
|
|
} |
7034 |
|
|
sub manakai_append_text ($$) { |
7035 |
|
|
my ($self, $string) = @_; |
7036 |
|
|
my $r; |
7037 |
|
|
|
7038 |
|
|
{ |
7039 |
|
|
|
7040 |
|
|
|
7041 |
|
|
{ |
7042 |
|
|
|
7043 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7044 |
|
|
|
7045 |
|
|
{ |
7046 |
|
|
|
7047 |
|
|
|
7048 |
|
|
my |
7049 |
|
|
$lc = $self-> |
7050 |
|
|
last_child |
7051 |
|
|
; |
7052 |
|
|
if (defined $lc and |
7053 |
|
|
$lc-> |
7054 |
|
|
node_type |
7055 |
|
|
== |
7056 |
|
|
3 |
7057 |
|
|
) { |
7058 |
|
|
$lc-> |
7059 |
|
|
manakai_append_text |
7060 |
|
|
|
7061 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
7062 |
|
|
} else { |
7063 |
|
|
my $text = $self-> |
7064 |
|
|
owner_document |
7065 |
|
|
|
7066 |
|
|
-> |
7067 |
|
|
create_text_node |
7068 |
|
|
|
7069 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
7070 |
|
|
$self-> |
7071 |
|
|
append_child |
7072 |
|
|
($text); |
7073 |
|
|
} |
7074 |
|
|
$r = $self; |
7075 |
|
|
|
7076 |
|
|
|
7077 |
|
|
|
7078 |
|
|
;} |
7079 |
|
|
|
7080 |
|
|
|
7081 |
|
|
;} |
7082 |
|
|
|
7083 |
|
|
; |
7084 |
|
|
|
7085 |
|
|
|
7086 |
|
|
;} |
7087 |
|
|
$r} |
7088 |
|
|
sub get_feature ($$$) { |
7089 |
|
|
my ($self, $feature, $version) = @_; |
7090 |
|
|
|
7091 |
|
|
{ |
7092 |
|
|
|
7093 |
|
|
|
7094 |
|
|
$feature = lc $feature; |
7095 |
|
|
|
7096 |
|
|
|
7097 |
|
|
;} |
7098 |
|
|
|
7099 |
|
|
{ |
7100 |
|
|
|
7101 |
|
|
|
7102 |
|
|
$version = '' unless defined $version; |
7103 |
|
|
|
7104 |
|
|
|
7105 |
|
|
;} |
7106 |
|
|
my $r; |
7107 |
|
|
|
7108 |
|
|
{ |
7109 |
|
|
|
7110 |
|
|
|
7111 |
|
|
$feature =~ s/^\+//; |
7112 |
|
|
|
7113 |
|
|
|
7114 |
|
|
{ |
7115 |
|
|
|
7116 |
|
|
if |
7117 |
|
|
($Message::DOM::DOMFeature::ClassInfo->{ref $self} |
7118 |
|
|
->{has_feature}->{$feature}->{$version}) { |
7119 |
|
|
$r = $self; |
7120 |
|
|
} else { |
7121 |
|
|
CLASS: for my $__class (sort { |
7122 |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
7123 |
|
|
} grep { |
7124 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Element::ManakaiDOMAttr'} |
7125 |
|
|
->{compat_class}->{$_} |
7126 |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Element::ManakaiDOMAttr'} |
7127 |
|
|
->{compat_class} or {}}) { |
7128 |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
7129 |
|
|
->{has_feature}->{$feature}->{$version}) { |
7130 |
|
|
|
7131 |
|
|
|
7132 |
|
|
{ |
7133 |
|
|
|
7134 |
|
|
|
7135 |
|
|
$r = ${($self->{'b'})->{${($self->{'id'})}}->{ |
7136 |
|
|
'cls' |
7137 |
|
|
}}->___create_node_ref ({ |
7138 |
|
|
|
7139 |
|
|
'id' |
7140 |
|
|
=> ($self->{'id'}), |
7141 |
|
|
|
7142 |
|
|
'b' |
7143 |
|
|
=> ($self->{'b'}), |
7144 |
|
|
}, { |
7145 |
|
|
'nrcls' => \$__class, |
7146 |
|
|
}); |
7147 |
|
|
($self->{'b'})->{${($self->{'id'})}}->{ |
7148 |
|
|
'rc' |
7149 |
|
|
}++; |
7150 |
|
|
|
7151 |
|
|
|
7152 |
|
|
;} |
7153 |
|
|
|
7154 |
|
|
; |
7155 |
|
|
last CLASS; |
7156 |
|
|
} |
7157 |
|
|
} # CLASS |
7158 |
|
|
} |
7159 |
|
|
|
7160 |
|
|
|
7161 |
|
|
;} |
7162 |
|
|
|
7163 |
|
|
; |
7164 |
|
|
unless (defined $r) { |
7165 |
|
|
|
7166 |
|
|
|
7167 |
|
|
{ |
7168 |
|
|
|
7169 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7170 |
|
|
|
7171 |
|
|
{ |
7172 |
|
|
|
7173 |
|
|
|
7174 |
|
|
|
7175 |
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
7176 |
|
|
|
7177 |
|
|
|
7178 |
|
|
|
7179 |
|
|
;} |
7180 |
|
|
|
7181 |
|
|
|
7182 |
|
|
;} |
7183 |
|
|
|
7184 |
|
|
; |
7185 |
|
|
} |
7186 |
|
|
|
7187 |
|
|
|
7188 |
|
|
;} |
7189 |
|
|
$r} |
7190 |
|
|
sub base_uri ($;$) { |
7191 |
|
|
if (@_ == 1) {my ($self) = @_; |
7192 |
|
|
my $r = ''; |
7193 |
|
|
|
7194 |
|
|
{ |
7195 |
|
|
|
7196 |
|
|
|
7197 |
|
|
{ |
7198 |
|
|
|
7199 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7200 |
|
|
|
7201 |
|
|
{ |
7202 |
|
|
|
7203 |
|
|
|
7204 |
|
|
my |
7205 |
|
|
$oe = $self-> |
7206 |
|
|
owner_element |
7207 |
|
|
; |
7208 |
|
|
if ($oe) { |
7209 |
|
|
$r = $oe-> |
7210 |
|
|
base_uri |
7211 |
|
|
; |
7212 |
|
|
} else { |
7213 |
|
|
my $od = $self-> |
7214 |
|
|
owner_document |
7215 |
|
|
; |
7216 |
|
|
$r = $od-> |
7217 |
|
|
base_uri |
7218 |
|
|
; |
7219 |
|
|
} |
7220 |
|
|
|
7221 |
|
|
|
7222 |
|
|
|
7223 |
|
|
;} |
7224 |
|
|
|
7225 |
|
|
|
7226 |
|
|
;} |
7227 |
|
|
|
7228 |
|
|
; |
7229 |
|
|
|
7230 |
|
|
|
7231 |
|
|
;} |
7232 |
|
|
$r; |
7233 |
|
|
} else {my ($self) = @_; |
7234 |
|
|
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'; |
7235 |
|
|
} |
7236 |
|
|
} |
7237 |
|
|
sub owner_element ($;$) { |
7238 |
|
|
if (@_ == 1) {my ($self) = @_; |
7239 |
|
|
my $r; |
7240 |
|
|
|
7241 |
|
|
{ |
7242 |
|
|
|
7243 |
|
|
|
7244 |
|
|
{ |
7245 |
|
|
|
7246 |
|
|
my |
7247 |
|
|
$__v = $self->{ |
7248 |
|
|
'b' |
7249 |
|
|
}->{${$self->{ |
7250 |
|
|
'id' |
7251 |
|
|
}}} |
7252 |
|
|
->{'owner'}; |
7253 |
|
|
if (defined $__v) { |
7254 |
|
|
|
7255 |
|
|
|
7256 |
|
|
{ |
7257 |
|
|
|
7258 |
|
|
|
7259 |
|
|
$r = ${$self->{'b'}->{${$__v}}->{ |
7260 |
|
|
'cls' |
7261 |
|
|
}}->___create_node_ref ({ |
7262 |
|
|
|
7263 |
|
|
'id' |
7264 |
|
|
=> $__v, |
7265 |
|
|
|
7266 |
|
|
'b' |
7267 |
|
|
=> $self->{'b'}, |
7268 |
|
|
}, { |
7269 |
|
|
'nrifs' => ['Message::DOM::IFLatest::Element'], |
7270 |
|
|
}); |
7271 |
|
|
$self->{'b'}->{${$__v}}->{ |
7272 |
|
|
'rc' |
7273 |
|
|
}++; |
7274 |
|
|
|
7275 |
|
|
|
7276 |
|
|
;} |
7277 |
|
|
|
7278 |
|
|
; |
7279 |
|
|
} |
7280 |
|
|
|
7281 |
|
|
|
7282 |
|
|
;} |
7283 |
|
|
|
7284 |
|
|
; |
7285 |
|
|
|
7286 |
|
|
|
7287 |
|
|
;} |
7288 |
|
|
$r; |
7289 |
|
|
} else {my ($self) = @_; |
7290 |
|
|
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'; |
7291 |
|
|
} |
7292 |
|
|
} |
7293 |
|
|
sub specified ($;$) { |
7294 |
|
|
if (@_ == 1) {my ($self) = @_; |
7295 |
|
|
my $r = 0; |
7296 |
|
|
|
7297 |
|
|
{ |
7298 |
|
|
|
7299 |
|
|
|
7300 |
|
|
{ |
7301 |
|
|
|
7302 |
|
|
|
7303 |
|
|
$r = $self->{ |
7304 |
|
|
'b' |
7305 |
|
|
}->{${$self->{ |
7306 |
|
|
'id' |
7307 |
|
|
}}} |
7308 |
|
|
->{'specified'}; |
7309 |
|
|
|
7310 |
|
|
|
7311 |
|
|
;} |
7312 |
|
|
|
7313 |
|
|
; |
7314 |
|
|
unless ($r) { |
7315 |
|
|
my $oe; |
7316 |
|
|
|
7317 |
|
|
|
7318 |
|
|
{ |
7319 |
|
|
|
7320 |
|
|
|
7321 |
|
|
$oe = $self->{ |
7322 |
|
|
'b' |
7323 |
|
|
}->{${$self->{ |
7324 |
|
|
'id' |
7325 |
|
|
}}} |
7326 |
|
|
->{'owner'}; |
7327 |
|
|
|
7328 |
|
|
|
7329 |
|
|
;} |
7330 |
|
|
|
7331 |
|
|
; |
7332 |
|
|
unless (defined $oe) { |
7333 |
|
|
$r = |
7334 |
|
|
1 |
7335 |
|
|
; |
7336 |
|
|
} |
7337 |
|
|
} |
7338 |
|
|
|
7339 |
|
|
|
7340 |
|
|
;} |
7341 |
|
|
$r; |
7342 |
|
|
} else {my ($self, $given) = @_; |
7343 |
|
|
|
7344 |
|
|
{ |
7345 |
|
|
|
7346 |
|
|
|
7347 |
|
|
{ |
7348 |
|
|
|
7349 |
|
|
if |
7350 |
|
|
($self-> |
7351 |
|
|
manakai_read_only |
7352 |
|
|
) { |
7353 |
|
|
|
7354 |
|
|
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'; |
7355 |
|
|
|
7356 |
|
|
; |
7357 |
|
|
} |
7358 |
|
|
|
7359 |
|
|
|
7360 |
|
|
;} |
7361 |
|
|
|
7362 |
|
|
; |
7363 |
|
|
unless ($given) { |
7364 |
|
|
my $oe; |
7365 |
|
|
|
7366 |
|
|
|
7367 |
|
|
{ |
7368 |
|
|
|
7369 |
|
|
|
7370 |
|
|
$oe = $self->{ |
7371 |
|
|
'b' |
7372 |
|
|
}->{${$self->{ |
7373 |
|
|
'id' |
7374 |
|
|
}}} |
7375 |
|
|
->{'owner'}; |
7376 |
|
|
|
7377 |
|
|
|
7378 |
|
|
;} |
7379 |
|
|
|
7380 |
|
|
; |
7381 |
|
|
$given = |
7382 |
|
|
1 unless |
7383 |
|
|
defined $oe; |
7384 |
|
|
} |
7385 |
|
|
|
7386 |
|
|
|
7387 |
|
|
{ |
7388 |
|
|
|
7389 |
|
|
|
7390 |
|
|
$self->{ |
7391 |
|
|
'b' |
7392 |
|
|
}->{${$self->{ |
7393 |
|
|
'id' |
7394 |
|
|
}}} |
7395 |
|
|
->{'specified'} = $given; |
7396 |
|
|
|
7397 |
|
|
|
7398 |
|
|
;} |
7399 |
|
|
|
7400 |
|
|
; |
7401 |
|
|
|
7402 |
|
|
|
7403 |
|
|
;} |
7404 |
|
|
} |
7405 |
|
|
} |
7406 |
|
|
sub value ($;$) { |
7407 |
|
|
if (@_ == 1) {my ($self) = @_; |
7408 |
|
|
my $r = ''; |
7409 |
|
|
|
7410 |
|
|
{ |
7411 |
|
|
|
7412 |
|
|
|
7413 |
|
|
{ |
7414 |
|
|
|
7415 |
|
|
local $Error::Depth = $Error::Depth + 1; |
7416 |
|
|
|
7417 |
|
|
{ |
7418 |
|
|
|
7419 |
|
|
|
7420 |
|
|
for |
7421 |
|
|
my $child (@{$self-> |
7422 |
|
|
child_nodes |
7423 |
|
|
}) { |
7424 |
|
|
if ($child-> |
7425 |
|
|
node_type |
7426 |
|
|
== |
7427 |
|
|
|
7428 |
|
|
5 |
7429 |
|
|
) { |
7430 |
|
|
my $v = $child-> |
7431 |
|
|
text_content |
7432 |
|
|
; |
7433 |
|
|
$v =~ s/[\x09\x0A\x0D]/ /; |
7434 |
|
|
$r .= $v; |
7435 |
|
|
} else { |
7436 |
|
|
$r .= $child-> |
7437 |
|
|
text_content |
7438 |
|
|
; |
7439 |
|
|
} |
7440 |
|
|
} # childNodes |
7441 |
|
|
my $vt; |
7442 |
|
|
|
7443 |
|
|
|
7444 |
|
|
{ |
7445 |
|
|
|
7446 |
|
|
|
7447 |
|
|
$vt = $self->{ |
7448 |
|
|
'b' |
7449 |
|
|
}->{${$self->{ |
7450 |
|
|
'id' |
7451 |
|
|
}}} |
7452 |
|
|
->{'at'}; |
7453 |
|
|
|
7454 |
|
|
|
7455 |
|
|
;} |
7456 |
|
|
|
7457 |
|
|
; |
7458 |
|
|
unless (not defined $vt or |
7459 |
|
|
$vt == |
7460 |
|
|
0 or |
7461 |
|
|
|
7462 |
|
|
$vt == |
7463 |
|
|
11 or |
7464 |
|
|
|
7465 |
|
|
$vt == |
7466 |
|
|
1 |
7467 |
|
|
) { |
7468 |
|
|
$r =~ s/\A\x20+//; |
7469 |
|
|
$r =~ s/\x20+\z//; |
7470 |
|
|
$r =~ s/\x20+/ /g; |
7471 |
|
|
} |
7472 |
|
|
|
7473 |
|
|
|
7474 |
|
|
|
7475 |
|
|
;} |
7476 |
|
|
|
7477 |
|
|
|
7478 |
|
|
;} |
7479 |
|
|
|
7480 |
|
|
; |
7481 |
|
|
|
7482 |
|
|
|
7483 |
|
|
;} |
7484 |
|
|
$r; |
7485 |
|
|
} else {my ($self, $given) = @_; |
7486 |
|
|
|
7487 |
|
|
{ |
7488 |
|
|
|
7489 |
|
|
|
7490 |
|
|
{ |
7491 |
|
|
|
7492 |
|
|
|
7493 |
|
|
{ |
7494 |
|
|
|
7495 |
|
|
if |
7496 |
|
|
($self-> |
7497 |
|
|
manakai_read_only |
7498 |
|
|
) { |
7499 |
|
|
|
7500 |
|
|
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'; |
7501 |
|
|
|
7502 |
|
|
; |
7503 |
|
|
} |
7504 |
|
|
|
7505 |
|
|
|
7506 |
|
|
;} |
7507 |
|
|
|
7508 |
|
|
; |
7509 |
|
|
|
7510 |
|
|
my @__old_children = @{$self-> |
7511 |
|
|
child_nodes |
7512 |
|
|
}; |
7513 |
|
|
for my $__old_child (@__old_children) { |
7514 |
|
|
|
7515 |
|
|
|
7516 |
|
|
{ |
7517 |
|
|
|
7518 |
|
|
CORE::delete |
7519 |
|
|
$__old_child->{ |
7520 |
|
|
'b' |
7521 |
|
|
}->{${$__old_child->{ |
7522 |
|
|
'id' |
7523 |
|
|
}}} |
7524 |
|
|
->{'parent'}; |
7525 |
|
|
|
7526 |
|
|
|
7527 |
|
|
;} |
7528 |
|
|
|
7529 |
|
|
; |
7530 |
|
|
} |
7531 |
|
|
|
7532 |
|
|
my @__new_children; |
7533 |
|
|
if (defined $given and length $given) { |
7534 |
|
|
my $__text = $self->owner_document-> |
7535 |
|
|
create_text_node |
7536 |
|
|
($given); |
7537 |
|
|
push @__new_children, |
7538 |
|
|
$__text->{'id'} |
7539 |
|
|
; |
7540 |
|
|
|
7541 |
|
|
|
7542 |
|
|
{ |
7543 |
|
|
|
7544 |
|
|
|
7545 |
|
|
$__text->{ |
7546 |
|
|
'b' |
7547 |
|
|
}->{${$__text->{ |
7548 |
|
|
'id' |
7549 |
|
|
}}} |
7550 |
|
|
->{'parent'} = $self->{ |
7551 |
|
|
'id' |
7552 |
|
|
}; |
7553 |
|
|
|
7554 |
|
|
|
7555 |
|
|
;} |
7556 |
|
|
|
7557 |
|
|
; |
7558 |
|
|
} |
7559 |
|
|
|
7560 |
|
|
|
7561 |
|
|
|
7562 |
|
|
{ |
7563 |
|
|
|
7564 |
|
|
|
7565 |
|
|
$self->{ |
7566 |
|
|
'b' |
7567 |
|
|
}->{${$self->{ |
7568 |
|
|
'id' |
7569 |
|
|
}}} |
7570 |
|
|
->{'child'} = \@__new_children; |
7571 |
|
|
|
7572 |
|
|
|
7573 |
|
|
;} |
7574 |
|
|
|
7575 |
|
|
; |
7576 |
|
|
|
7577 |
|
|
|
7578 |
|
|
;} |
7579 |
|
|
|
7580 |
|
|
; |
7581 |
|
|
|
7582 |
|
|
|
7583 |
|
|
;} |
7584 |
|
|
} |
7585 |
|
|
} |
7586 |
|
|
sub schema_type_info ($;$) { |
7587 |
|
|
if (@_ == 1) {my ($self) = @_; |
7588 |
|
|
my $r; |
7589 |
|
|
|
7590 |
|
|
{ |
7591 |
|
|
|
7592 |
|
|
my |
7593 |
|
|
$type; |
7594 |
|
|
|
7595 |
|
|
|
7596 |
|
|
{ |
7597 |
|
|
|
7598 |
|
|
|
7599 |
|
|
$type = $self->{ |
7600 |
|
|
'b' |
7601 |
|
|
}->{${$self->{ |
7602 |
|
|
'id' |
7603 |
|
|
}}} |
7604 |
|
|
->{'at'}; |
7605 |
|
|
|
7606 |
|
|
|
7607 |
|
|
;} |
7608 |
|
|
|
7609 |
|
|
; |
7610 |
|
|
|
7611 |
|
|
|
7612 |
|
|
{ |
7613 |
|
|
|
7614 |
|
|
my |
7615 |
|
|
$v = $type || 0; |
7616 |
|
|
$r = bless \$v, |
7617 |
|
|
'Message::DOM::DOMCore::ManakaiDOMDTDTypeInfo' |
7618 |
|
|
; |
7619 |
|
|
|
7620 |
|
|
|
7621 |
|
|
;} |
7622 |
|
|
|
7623 |
|
|
; |
7624 |
|
|
|
7625 |
|
|
|
7626 |
|
|
;} |
7627 |
|
|
$r; |
7628 |
|
|
} else {my ($self) = @_; |
7629 |
|
|
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'; |
7630 |
|
|
} |
7631 |
|
|
} |
7632 |
|
|
sub is_id ($;$) { |
7633 |
|
|
if (@_ == 1) {my ($self) = @_; |
7634 |
|
|
my $r = 0; |
7635 |
|
|
|
7636 |
|
|
{ |
7637 |
|
|
|
7638 |
|
|
T: |
7639 |
|
|
{ |
7640 |
|
|
## DTD Attribute Type |
7641 |
|
|
my $type; |
7642 |
|
|
|
7643 |
|
|
|
7644 |
|
|
{ |
7645 |
|
|
|
7646 |
|
|
|
7647 |
|
|
$type = $self->{ |
7648 |
|
|
'b' |
7649 |
|
|
}->{${$self->{ |
7650 |
|
|
'id' |
7651 |
|
|
}}} |
7652 |
|
|
->{'at'}; |
7653 |
|
|
|
7654 |
|
|
|
7655 |
|
|
;} |
7656 |
|
|
|
7657 |
|
|
; |
7658 |
|
|
if (defined $type and $type == |
7659 |
|
|
2 |
7660 |
|
|
) { |
7661 |
|
|
$r = |
7662 |
|
|
1 |
7663 |
|
|
; |
7664 |
|
|
last T; |
7665 |
|
|
} |
7666 |
|
|
|
7667 |
|
|
## User-determined ID |
7668 |
|
|
my $udid; |
7669 |
|
|
|
7670 |
|
|
|
7671 |
|
|
{ |
7672 |
|
|
|
7673 |
|
|
|
7674 |
|
|
$udid = $self->{ |
7675 |
|
|
'b' |
7676 |
|
|
}->{${$self->{ |
7677 |
|
|
'id' |
7678 |
|
|
}}} |
7679 |
|
|
->{'isudid'}; |
7680 |
|
|
|
7681 |
|
|
|
7682 |
|
|
;} |
7683 |
|
|
|
7684 |
|
|
; |
7685 |
|
|
if ($udid) { |
7686 |
|
|
$r = |
7687 |
|
|
1 |
7688 |
|
|
; |
7689 |
|
|
last T; |
7690 |
|
|
} |
7691 |
|
|
|
7692 |
|
|
## Application-determined ID |
7693 |
|
|
my $nsuri = $self-> |
7694 |
|
|
namespace_uri |
7695 |
|
|
; |
7696 |
|
|
my $ln = $self-> |
7697 |
|
|
local_name |
7698 |
|
|
; |
7699 |
|
|
if (defined $nsuri and $nsuri eq |
7700 |
|
|
'http://www.w3.org/XML/1998/namespace' and |
7701 |
|
|
|
7702 |
|
|
$ln eq 'id') { |
7703 |
|
|
$r = |
7704 |
|
|
1 |
7705 |
|
|
; |
7706 |
|
|
last T; |
7707 |
|
|
} elsif (not defined $nsuri and $ln eq 'xml:id') { |
7708 |
|
|
$r = |
7709 |
|
|
1 |
7710 |
|
|
; |
7711 |
|
|
last T; |
7712 |
|
|
} |
7713 |
|
|
} # T |
7714 |
|
|
|
7715 |
|
|
|
7716 |
|
|
;} |
7717 |
|
|
$r; |
7718 |
|
|
} else {my ($self, $given) = @_; |
7719 |
|
|
|
7720 |
|
|
{ |
7721 |
|
|
|
7722 |
|
|
|
7723 |
|
|
{ |
7724 |
|
|
|
7725 |
|
|
if |
7726 |
|
|
($self-> |
7727 |
|
|
manakai_read_only |
7728 |
|
|
) { |
7729 |
|
|
|
7730 |
|
|
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'; |
7731 |
|
|
|
7732 |
|
|
; |
7733 |
|
|
} |
7734 |
|
|
|
7735 |
|
|
|
7736 |
|
|
;} |
7737 |
|
|
|
7738 |
|
|
; |
7739 |
|
|
|
7740 |
|
|
|
7741 |
|
|
{ |
7742 |
|
|
|
7743 |
|
|
|
7744 |
|
|
$self->{ |
7745 |
|
|
'b' |
7746 |
|
|
}->{${$self->{ |
7747 |
|
|
'id' |
7748 |
|
|
}}} |
7749 |
|
|
->{'isudid'} = $given; |
7750 |
|
|
|
7751 |
|
|
|
7752 |
|
|
;} |
7753 |
|
|
|
7754 |
|
|
; |
7755 |
|
|
|
7756 |
|
|
|
7757 |
|
|
;} |
7758 |
|
|
} |
7759 |
|
|
} |
7760 |
|
|
sub manakai_attribute_type ($;$) { |
7761 |
|
|
if (@_ == 1) {my ($self) = @_; |
7762 |
|
|
my $r = 0; |
7763 |
|
|
|
7764 |
|
|
{ |
7765 |
|
|
|
7766 |
|
|
|
7767 |
|
|
{ |
7768 |
|
|
|
7769 |
|
|
|
7770 |
|
|
$r = $self->{ |
7771 |
|
|
'b' |
7772 |
|
|
}->{${$self->{ |
7773 |
|
|
'id' |
7774 |
|
|
}}} |
7775 |
|
|
->{'at'}; |
7776 |
|
|
|
7777 |
|
|
|
7778 |
|
|
;} |
7779 |
|
|
|
7780 |
|
|
; |
7781 |
|
|
$r = |
7782 |
|
|
0 unless |
7783 |
|
|
defined $r; |
7784 |
|
|
|
7785 |
|
|
|
7786 |
|
|
;} |
7787 |
|
|
$r; |
7788 |
|
|
} else {my ($self, $given) = @_; |
7789 |
|
|
|
7790 |
|
|
{ |
7791 |
|
|
|
7792 |
|
|
|
7793 |
|
|
{ |
7794 |
|
|
|
7795 |
|
|
if |
7796 |
|
|
($self-> |
7797 |
|
|
manakai_read_only |
7798 |
|
|
) { |
7799 |
|
|
|
7800 |
|
|
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'; |
7801 |
|
|
|
7802 |
|
|
; |
7803 |
|
|
} |
7804 |
|
|
|
7805 |
|
|
|
7806 |
|
|
;} |
7807 |
|
|
|
7808 |
|
|
; |
7809 |
|
|
|
7810 |
|
|
|
7811 |
|
|
{ |
7812 |
|
|
|
7813 |
|
|
|
7814 |
|
|
$self->{ |
7815 |
|
|
'b' |
7816 |
|
|
}->{${$self->{ |
7817 |
|
|
'id' |
7818 |
|
|
}}} |
7819 |
|
|
->{'at'} = $given; |
7820 |
|
|
|
7821 |
|
|
|
7822 |
|
|
;} |
7823 |
|
|
|
7824 |
|
|
; |
7825 |
|
|
|
7826 |
|
|
|
7827 |
|
|
;} |
7828 |
|
|
} |
7829 |
|
|
} |
7830 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMAttr>}->{has_feature} = {'core', |
7831 |
|
|
{'', |
7832 |
|
|
'1', |
7833 |
|
|
'1.0', |
7834 |
|
|
'1', |
7835 |
|
|
'2.0', |
7836 |
|
|
'1', |
7837 |
|
|
'3.0', |
7838 |
|
|
'1'}, |
7839 |
|
|
'xml', |
7840 |
|
|
{'', |
7841 |
|
|
'1', |
7842 |
|
|
'1.0', |
7843 |
|
|
'1', |
7844 |
|
|
'2.0', |
7845 |
|
|
'1', |
7846 |
|
|
'3.0', |
7847 |
|
|
'1'}, |
7848 |
|
|
'xmlversion', |
7849 |
|
|
{'', |
7850 |
|
|
'1', |
7851 |
|
|
'1.0', |
7852 |
|
|
'1', |
7853 |
|
|
'1.1', |
7854 |
|
|
'1'}}; |
7855 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Element::ManakaiDOMAttr>} = 14.1; |
7856 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Element::ManakaiDOMAttr>}->{compat_class}->{q<Message::DOM::Element::ManakaiDOMAttr>} = 1; |
7857 |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Element::ManakaiDOMAttr>} = {'o0', |
7858 |
|
|
['owner'], |
7859 |
|
|
's1a', |
7860 |
|
|
['child'], |
7861 |
|
|
'w0', |
7862 |
|
|
['od']}; |
7863 |
|
|
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::){} |
7864 |
|
|
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
7865 |
|
|
1; |