1 |
#!/usr/bin/perl |
## NOTE: This module will be renamed as Document.pm. |
|
## This file is automatically generated |
|
|
## at 2006-04-04T09:22:34+00:00, |
|
|
## from file "Document.dis", |
|
|
## module <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.Document>, |
|
|
## for <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOMLatest>. |
|
|
## Don't edit by hand! |
|
|
use strict; |
|
|
require Message::DOM::DOMCore; |
|
|
require Message::DOM::Element; |
|
|
require Message::DOM::TreeCore; |
|
|
require Message::Util::Error::DOMException; |
|
|
package Message::DOM::Document; |
|
|
our $VERSION = 20060404.0922; |
|
|
package Message::DOM::IFLatest::Document; |
|
|
our $VERSION = 20060404.0922; |
|
|
package Message::DOM::Document::ManakaiDOMDocument; |
|
|
our $VERSION = 20060404.0922; |
|
|
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
|
|
'Message::DOM::IF::Document', |
|
|
'Message::DOM::IF::Node', |
|
|
'Message::DOM::IFLatest::Document', |
|
|
'Message::DOM::IFLatest::Node', |
|
|
'Message::DOM::IFLevel1::Document', |
|
|
'Message::DOM::IFLevel1::Node', |
|
|
'Message::DOM::IFLevel2::Document', |
|
|
'Message::DOM::IFLevel2::Node', |
|
|
'Message::DOM::IFLevel3::Document', |
|
|
'Message::DOM::IFLevel3::Node'; |
|
|
use Char::Class::XML 'InXMLNCNameChar10', |
|
|
'InXMLNCNameChar11', |
|
|
'InXMLNCNameStartChar11', |
|
|
'InXMLNameChar10', |
|
|
'InXMLNameChar11', |
|
|
'InXMLNameStartChar11', |
|
|
'InXML_NCNameStartChar10', |
|
|
'InXML_NameStartChar10'; |
|
|
sub ___create_node_stem ($$$$) { |
|
|
my ($self, $bag, $obj, $opt) = @_; |
|
|
my $r = {}; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$obj->{ |
|
|
'child' |
|
|
} = []; |
|
|
$obj->{ |
|
|
'do' |
|
|
} = {}; |
|
|
$obj->{ |
|
|
'http://www.w3.org/2001/04/infoset#version' |
|
|
} = '1.0'; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$obj->{'impl'} = $opt->{'impl'}->{ |
|
|
'id' |
|
|
}; |
|
|
$bag->{${$opt->{'impl'}->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'lpmi'}->{${$obj->{ |
|
|
'id' |
|
|
}}} |
|
|
= $obj->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$r = $obj; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub ___create_node_ref ($$$) { |
|
|
my ($self, $obj, $opt) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$class; |
|
|
CLS: { |
|
|
if (defined $opt->{ |
|
|
'nrcls' |
|
|
}) { |
|
|
$class = $opt->{ |
|
|
'nrcls' |
|
|
}; |
|
|
IFCHK: { |
|
|
for (@{$opt->{ |
|
|
'nrifs' |
|
|
} or []}) { |
|
|
last IFCHK unless $$class->isa ($_); |
|
|
} |
|
|
last CLS; |
|
|
} # IFCHK |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
2 |
|
|
3 |
|
package Message::DOM::Document; |
4 |
|
use strict; |
5 |
|
our $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
6 |
|
push our @ISA, 'Message::DOM::Node', 'Message::IF::Document', |
7 |
|
'Message::IF::DocumentTraversal', 'Message::IF::DocumentXDoctype', |
8 |
|
'Message::IF::DocumentSelector', # MUST in Selectors API spec |
9 |
|
'Message::IF::HTMLDocument'; |
10 |
|
require Message::DOM::Node; |
11 |
|
use Char::Class::XML |
12 |
|
qw/ |
13 |
|
InXML_NameStartChar10 InXMLNameStartChar11 |
14 |
|
InXMLNameChar10 InXMLNameChar11 |
15 |
|
InXML_NCNameStartChar10 InXMLNCNameStartChar11 |
16 |
|
InXMLNCNameChar10 InXMLNCNameChar11 |
17 |
|
/; |
18 |
|
|
19 |
|
sub ____new ($$) { |
20 |
|
my $self = shift->SUPER::____new (undef); |
21 |
|
$$self->{implementation} = $_[0]; |
22 |
|
$$self->{strict_error_checking} = 1; |
23 |
|
$$self->{child_nodes} = []; |
24 |
|
$$self->{'http://suika.fam.cx/www/2006/dom-config/strict-document-children'} = 1; |
25 |
|
$$self->{'http://suika.fam.cx/www/2006/dom-config/dtd-default-attribute'} = 1; |
26 |
|
$$self->{'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree'} = 1; |
27 |
|
$$self->{'error-handler'} = sub ($) { |
28 |
|
## NOTE: Same as one set by |setParameter| with |undef| value. |
29 |
|
warn $_[0]; |
30 |
|
return $_[0]->severity != 3; # SEVERITY_FATAL_ERROR |
31 |
|
}; |
32 |
|
return $self; |
33 |
|
} # ____new |
34 |
|
|
35 |
|
sub AUTOLOAD { |
36 |
|
my $method_name = our $AUTOLOAD; |
37 |
|
$method_name =~ s/.*:://; |
38 |
|
return if $method_name eq 'DESTROY'; |
39 |
|
|
40 |
$class = $obj->{ |
if ({ |
41 |
'b' |
## Read-only attributes (trivial accessors) |
42 |
}->{${$obj->{ |
default_view => 1, |
43 |
'id' |
implementation => 1, |
44 |
}}} |
}->{$method_name}) { |
45 |
->{'dnrcls'}; |
no strict 'refs'; |
46 |
|
eval qq{ |
47 |
|
sub $method_name (\$) { |
48 |
} |
return \${\$_[0]}->{$method_name}; |
49 |
|
} |
50 |
; |
}; |
51 |
if (defined $class) { |
goto &{ $AUTOLOAD }; |
52 |
IFCHK: { |
} elsif ({ |
53 |
for (@{$opt->{ |
## Read-write attributes (DOMString, trivial accessors) |
54 |
'nrifs' |
manakai_charset => 1, |
55 |
} or []}) { |
document_uri => 1, |
56 |
last IFCHK unless $$class->isa ($_); |
input_encoding => 1, |
57 |
|
}->{$method_name}) { |
58 |
|
no strict 'refs'; |
59 |
|
eval qq{ |
60 |
|
sub $method_name (\$;\$) { |
61 |
|
if (\@_ > 1) { |
62 |
|
if (\${\$_[0]}->{strict_error_checking} and |
63 |
|
\${\$_[0]}->{manakai_read_only}) { |
64 |
|
report Message::DOM::DOMException |
65 |
|
-object => \$_[0], |
66 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
67 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
68 |
|
} |
69 |
|
if (defined \$_[1]) { |
70 |
|
\${\$_[0]}->{$method_name} = ''.\$_[1]; |
71 |
|
} else { |
72 |
|
delete \${\$_[0]}->{$method_name}; |
73 |
|
} |
74 |
|
} |
75 |
|
return \${\$_[0]}->{$method_name}; |
76 |
} |
} |
77 |
last CLS; |
}; |
78 |
} # IFCHK |
goto &{ $AUTOLOAD }; |
79 |
|
} elsif ({ |
80 |
|
## Read-write attributes (boolean, trivial accessors) |
81 |
|
all_declarations_processed => 1, |
82 |
|
manakai_has_bom => 1, |
83 |
|
}->{$method_name}) { |
84 |
|
no strict 'refs'; |
85 |
|
eval qq{ |
86 |
|
sub $method_name (\$;\$) { |
87 |
|
if (\@_ > 1) { |
88 |
|
if (\${\$_[0]}->{manakai_strict_error_checking} and |
89 |
|
\${\$_[0]}->{manakai_read_only}) { |
90 |
|
report Message::DOM::DOMException |
91 |
|
-object => \$_[0], |
92 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
93 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
94 |
|
} |
95 |
|
if (\$_[1]) { |
96 |
|
\${\$_[0]}->{$method_name} = 1; |
97 |
|
} else { |
98 |
|
delete \${\$_[0]}->{$method_name}; |
99 |
|
} |
100 |
|
} |
101 |
|
return \${\$_[0]}->{$method_name}; |
102 |
|
} |
103 |
|
}; |
104 |
|
goto &{ $AUTOLOAD }; |
105 |
|
} elsif (my $module_name = { |
106 |
|
can_dispatch => 'Message::DOM::EventTargetNode', |
107 |
|
create_attribute => 'Message::DOM::Attr', |
108 |
|
create_attribute_ns => 'Message::DOM::Attr', |
109 |
|
create_attribute_definition => 'Message::DOM::AttributeDefinition', |
110 |
|
create_cdata_section => 'Message::DOM::Text', |
111 |
|
create_comment => 'Message::DOM::CharacterData', |
112 |
|
create_document_fragment => 'Message::DOM::DocumentFragment', |
113 |
|
create_document_type_definition => 'Message::DOM::DocumentType', |
114 |
|
create_element => 'Message::DOM::Element', |
115 |
|
create_element_ns => 'Message::DOM::Element', |
116 |
|
create_element_type_definition => 'Message::DOM::ElementTypeDefinition', |
117 |
|
create_entity_reference => 'Message::DOM::EntityReference', |
118 |
|
create_event => 'Message::DOM::EventTargetNode', |
119 |
|
create_general_entity => 'Message::DOM::Entity', |
120 |
|
create_notation => 'Message::DOM::Notation', |
121 |
|
create_processing_instruction => 'Message::DOM::ProcessingInstruction', |
122 |
|
manakai_create_serial_walker => 'Message::DOM::SerialWalker', |
123 |
|
create_text_node => 'Message::DOM::Text', |
124 |
|
create_tree_walker => 'Message::DOM::TreeWalker', |
125 |
|
query_selector => 'Message::DOM::SelectorsAPI', |
126 |
|
query_selector_all => 'Message::DOM::SelectorsAPI', |
127 |
|
___query_selector_all => 'Message::DOM::SelectorsAPI', |
128 |
|
}->{$method_name}) { |
129 |
|
eval qq{ require $module_name } or die $@; |
130 |
|
goto &{ $AUTOLOAD }; |
131 |
|
} else { |
132 |
|
require Carp; |
133 |
|
Carp::croak (qq<Can't locate method "$AUTOLOAD">); |
134 |
|
} |
135 |
|
} # AUTOLOAD |
136 |
|
sub implementation ($); |
137 |
|
sub create_attribute ($$); |
138 |
|
sub create_attribute_ns ($$$); |
139 |
|
sub create_attribute_definition ($$); |
140 |
|
sub create_cdata_section ($$); |
141 |
|
sub create_comment ($$); |
142 |
|
sub create_document_fragment ($); |
143 |
|
sub create_document_type_definition ($$); |
144 |
|
sub create_element ($$); |
145 |
|
sub create_element_ns ($$$); |
146 |
|
sub create_element_type_definition ($$); |
147 |
|
sub create_entity_reference ($$); |
148 |
|
sub create_general_entity ($$); |
149 |
|
sub create_notation ($$); |
150 |
|
sub create_processing_instruction ($$$); |
151 |
|
sub create_text_node ($$); |
152 |
|
|
153 |
|
## |Node| attributes |
154 |
|
|
155 |
|
sub base_uri ($) { |
156 |
|
my $v = ${$_[0]}->{manakai_entity_base_uri}; |
157 |
|
if (defined $v) { |
158 |
|
return $v; |
159 |
|
} else { |
160 |
|
return ${$_[0]}->{document_uri}; |
161 |
} |
} |
162 |
|
## TODO: HTML5 <base> |
163 |
|
} # base_uri |
164 |
|
|
165 |
my $cns; |
sub node_name () { '#document' } |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$cns = $obj->{ |
|
|
'b' |
|
|
}->{${$obj->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
my $bag = |
|
|
$obj->{'b'} |
|
|
; |
|
|
my $deh; |
|
|
DC: for my $cnid (@$cns) { |
|
|
my $cnh = |
|
|
{ |
|
|
'id' => $cnid, |
|
|
'b' => $bag, |
|
|
} |
|
|
; |
|
|
my $cncls; |
|
|
|
|
|
|
|
|
{ |
|
166 |
|
|
167 |
|
sub node_type () { 9 } # DOCUMENT_NODE |
168 |
|
|
169 |
$cncls = $cnh->{ |
sub text_content ($;$) { |
170 |
'b' |
my $self = shift; |
171 |
}->{${$cnh->{ |
if ($$self->{'http://suika.fam.cx/www/2006/dom-config/strict-document-children'}) { |
172 |
'id' |
return undef; |
173 |
}}} |
} else { |
174 |
->{'cls'}; |
local $Error::Depth = $Error::Depth + 1; |
175 |
|
return $self->SUPER::text_content (@_); |
176 |
|
} |
177 |
} |
} # text_content |
|
|
|
|
; |
|
|
if ($$cncls eq |
|
|
'Message::DOM::Element::ManakaiDOMElement' |
|
|
) { |
|
|
$deh = $cnh; |
|
|
last DC; |
|
|
} |
|
|
} # DC |
|
|
my $dens; |
|
|
my $deln; |
|
|
if (defined $deh) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
178 |
|
|
179 |
$dens = $deh->{ |
## |Node| methods |
|
'b' |
|
|
}->{${$deh->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'ns'}; |
|
180 |
|
|
181 |
|
sub adopt_node ($$) { |
182 |
|
my ($self, $source) = @_; |
183 |
|
## TODO: Should we apply |copy-asis| configuration parameter to this method? |
184 |
|
|
185 |
} |
return undef unless UNIVERSAL::isa ($source, 'Message::DOM::Node'); |
186 |
|
|
187 |
; |
my $strict = $self->strict_error_checking; |
188 |
$dens = \'' unless defined $dens; |
if ($strict and $$self->{manakai_read_only}) { |
189 |
|
report Message::DOM::DOMException |
190 |
|
-object => $self, |
191 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
192 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
193 |
|
} |
194 |
|
|
195 |
{ |
my $parent = $source->parent_node; |
196 |
|
if ($strict and defined $parent and $$parent->{manakai_read_only}) { |
197 |
|
report Message::DOM::DOMException |
198 |
|
-object => $self, |
199 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
200 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
201 |
|
} |
202 |
|
|
203 |
|
my $nt = $source->node_type; |
204 |
|
my $oe; |
205 |
|
if ($nt == 2) { # ATTRIBUTE_NODE |
206 |
|
$oe = $source->owner_element; |
207 |
|
if ($strict and defined $oe and $$oe->{manakai_read_only}) { |
208 |
|
report Message::DOM::DOMException |
209 |
|
-object => $self, |
210 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
211 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
212 |
|
} |
213 |
|
} elsif ($nt == 9 or $nt == 10 or $nt == 6 or $nt == 12 or |
214 |
|
$nt == 81001 or $nt == 81002) { |
215 |
|
# DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ENTITY_NODE, NOTATION_NODE, |
216 |
|
# ELEMENT_TYPE_DEFINITION_NODE, ATTRIBUTE_DEFINITION_NODE |
217 |
|
report Message::DOM::DOMException |
218 |
|
-object => $self, |
219 |
|
-type => 'NOT_SUPPORTED_ERR', |
220 |
|
-subtype => 'ADOPT_NODE_TYPE_NOT_SUPPORTED_ERR'; |
221 |
|
} |
222 |
|
|
223 |
$deln = $deh->{ |
my @change_od; |
224 |
'b' |
my @nodes = ($source); |
225 |
}->{${$deh->{ |
while (@nodes) { |
226 |
'id' |
my $node = shift @nodes; |
227 |
}}} |
my $nt = $node->node_type; |
228 |
->{'ln'}; |
if ($strict and $$node->{manakai_read_only}) { |
229 |
|
report Message::DOM::DOMException |
230 |
|
-object => $self, |
231 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
232 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
233 |
|
} |
234 |
|
|
235 |
|
push @change_od, $node; |
236 |
|
push @nodes, @{$node->child_nodes}, @{$node->attributes or []}; |
237 |
|
} # @nodes |
238 |
|
|
239 |
} |
local $Error::Depth = $Error::Depth + 1; |
240 |
|
|
241 |
; |
if (defined $parent) { |
242 |
} else { |
$parent->remove_child ($source); |
243 |
$dens = \'*'; |
} elsif (defined $oe) { |
244 |
$deln = \'*'; |
$oe->remove_attribute_node ($source); |
245 |
} |
} |
246 |
|
|
247 |
A: { |
return $source if $self eq $change_od[0]->owner_document; |
248 |
## Use cases: |
## NOTE: The array must have more than zero |
249 |
## - Document element is |html5:html| |
## nodes by definition. In addition, |
250 |
## - Document element is |NULL:rfc| |
## it cannot contain document or document |
251 |
|
## type nodes in current implementation. |
252 |
for my $nm ( |
|
253 |
[$dens, $deln], |
my @ud_node; |
254 |
[$dens, \'*'], |
for my $n (@change_od) { |
255 |
) { |
$$n->{owner_document} = $self; |
256 |
for my $__class (sort { |
Scalar::Util::weaken ($$n->{owner_document}); |
257 |
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
if ($$n->{user_data}) { |
258 |
} grep { |
push @ud_node, $n; |
|
$Message::DOM::DOMFeature::ClassInfo |
|
|
->{ |
|
|
'Message::DOM::Document::ManakaiDOMDocument' |
|
|
} |
|
|
->{compat_class_by_type} |
|
|
->{${$nm->[0]}}->{${$nm->[1]}}->{$_} |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo |
|
|
->{ |
|
|
'Message::DOM::Document::ManakaiDOMDocument' |
|
|
} |
|
|
->{compat_class_by_type} |
|
|
->{${$nm->[0]}}->{${$nm->[1]}} or {}}) { |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
|
|
->{has_feature}->{xml}->{'3.0'}) { |
|
|
$class = \$__class; |
|
|
IFCHK: { |
|
|
for (@{$opt->{ |
|
|
'nrifs' |
|
|
} or []}) { |
|
|
last IFCHK unless $$class->isa ($_); |
|
|
} |
|
|
last A; |
|
|
} # IFCHK |
|
|
} |
|
|
} |
|
259 |
} |
} |
260 |
|
} |
261 |
|
|
262 |
## Generic |
for my $src (@ud_node) { |
263 |
CLASS: for my $__class (sort { |
my $src_ud = $$src->{user_data}; |
264 |
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
for my $key (keys %{$src_ud}) { |
265 |
} grep { |
my $dh = $src_ud->{$key}->[1]; |
266 |
$Message::DOM::DOMFeature::ClassInfo |
if ($dh) { |
267 |
->{ |
$dh->(5, $key, $src_ud->{$key}->[0], $src, undef); # NODE_ADOPTED |
|
'Message::DOM::Document::ManakaiDOMDocument' |
|
|
} |
|
|
->{compat_class}->{$_} |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo |
|
|
->{ |
|
|
'Message::DOM::Document::ManakaiDOMDocument' |
|
|
} |
|
|
->{compat_class} or {}}) { |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
|
|
->{has_feature}->{xml}->{'3.0'}) { |
|
|
$class = \$__class; |
|
|
IFCHK: { |
|
|
for (@{$opt->{ |
|
|
'nrifs' |
|
|
} or []}) { |
|
|
last IFCHK unless $$class->isa ($_); |
|
|
} |
|
|
last A; |
|
|
} # IFCHK |
|
268 |
} |
} |
269 |
} |
} |
|
|
|
|
## Default |
|
|
$class = \$self; |
|
|
} # A |
|
|
|
|
|
if (defined $deh) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$obj->{ |
|
|
'b' |
|
|
}->{${$obj->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'dnrcls'} = $class; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
270 |
} |
} |
|
} # CLS |
|
|
$r = bless $obj, $$class; |
|
271 |
|
|
272 |
|
return $source; |
273 |
|
} # adopt_node |
274 |
|
|
|
} |
|
|
$r} |
|
|
sub node_type ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
|
$r = '9'; |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
|
|
} |
|
|
} |
|
275 |
sub append_child ($$) { |
sub append_child ($$) { |
276 |
my ($self, $newChild) = @_; |
## NOTE: Overrides |Node|'s implementation. |
277 |
my $r; |
my $self = $_[0]; |
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$strictc = $self-> |
|
|
dom_config |
|
|
|
|
|
-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
|
|
); |
|
|
my $child_od = $newChild-> |
|
|
owner_document |
|
|
|| $self; |
|
|
my $child_nt = $newChild-> |
|
|
node_type |
|
|
; |
|
|
if ($strictc and $self-> |
|
|
strict_error_checking |
|
|
) { |
|
278 |
|
|
279 |
|
## NOTE: |$self_od| code here in some $self->node_type. |
280 |
|
|
281 |
{ |
## -- Node Type check |
282 |
|
my @new_child; |
283 |
local $Error::Depth = $Error::Depth + 1; |
my $new_child_parent; |
284 |
|
if ($_[1]->node_type == 11) { # DOCUMENT_FRAGMENT_NODE |
285 |
{ |
push @new_child, @{$_[1]->child_nodes}; |
286 |
|
$new_child_parent = $_[1]; |
287 |
|
} else { |
288 |
my |
@new_child = ($_[1]); |
289 |
$has_el; |
$new_child_parent = $_[1]->parent_node; |
290 |
my $has_dt; |
} |
291 |
if ($child_nt == |
|
292 |
'1' |
## NOTE: Depends on $self->node_type: |
293 |
) { |
if ($$self->{strict_error_checking}) { |
294 |
$has_el = |
my $child_od = $_[1]->owner_document || $_[1]; # might be DocumentType |
295 |
1 |
if ($self ne $child_od and $child_od->node_type != 10) { |
296 |
; |
report Message::DOM::DOMException # DOCUMENT_TYPE_NODE |
297 |
} elsif ($child_nt == |
-object => $self, |
298 |
'10' |
-type => 'WRONG_DOCUMENT_ERR', |
299 |
) { |
-subtype => 'EXTERNAL_OBJECT_ERR'; |
300 |
$has_dt = |
} |
301 |
1 |
|
302 |
; |
if ($$self->{manakai_read_only} or |
303 |
} elsif ($child_nt == |
(@new_child and defined $new_child_parent and |
304 |
'11' |
$$new_child_parent->{manakai_read_only})) { |
305 |
) { |
report Message::DOM::DOMException |
306 |
for my $cn (@{$newChild-> |
-object => $self, |
307 |
child_nodes |
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
308 |
}) { |
-subtype => 'READ_ONLY_NODE_ERR'; |
309 |
my $cnt = $cn-> |
} |
310 |
node_type |
|
311 |
; |
## NOTE: Only in |Document|: |
312 |
if ($cnt == |
my $strict_children = $self->dom_config->get_parameter |
313 |
'1' |
(q<http://suika.fam.cx/www/2006/dom-config/strict-document-children>); |
314 |
) { |
if ($strict_children) { |
315 |
if ($has_el) { |
my $has_el; |
316 |
|
my $has_dt; |
317 |
|
my $child_nt = $_[1]->node_type; |
318 |
{ |
if ($child_nt == 1) { # ELEMENT_NODE |
319 |
|
$has_el = 1; |
320 |
local $Error::Depth = $Error::Depth - 1; |
} elsif ($child_nt == 10) { # DOCUMENT_TYPE_NODE |
321 |
|
$has_dt = 1; |
322 |
{ |
} elsif ($child_nt == 11) { # DOCUMENT_FRAGMENT_NODE |
323 |
|
for my $cn (@{$_[1]->child_nodes}) { |
324 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
my $cnt = $cn->node_type; |
325 |
|
if ($cnt == 1) { # ELEMENT_NODE |
326 |
|
if ($has_el) { |
327 |
} |
report Message::DOM::DOMException |
328 |
|
-object => $self, |
329 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
330 |
;} |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
331 |
|
} |
332 |
; |
$has_el = 1; |
333 |
|
} elsif ($cnt == 10) { # DOCUMENT_TYPE_NODE |
334 |
|
## NOTE: |DocumentType| node cannot be contained in |
335 |
|
## |DocumentFragment| in strict mode. |
336 |
|
if ($has_dt) { |
337 |
|
report Message::DOM::DOMException |
338 |
|
-object => $self, |
339 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
340 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
341 |
|
} |
342 |
|
$has_dt = 1; |
343 |
} |
} |
|
$has_el = |
|
|
1 |
|
|
; |
|
344 |
} |
} |
|
# DocumentType node cannot be contained in DocumentFragments |
|
345 |
} |
} |
346 |
} |
|
347 |
|
if ($has_el) { |
348 |
if ($has_el) { |
my $anode = $self->last_child; |
349 |
my $anode = $self-> |
while (defined $anode) { |
350 |
last_child |
if ($anode->node_type == 1) { # ELEMENT_NODE |
351 |
; |
report Message::DOM::DOMException |
352 |
while (defined $anode) { |
-object => $self, |
353 |
if ($anode-> |
-type => 'HIERARCHY_REQUEST_ERR', |
354 |
node_type |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
355 |
== |
} |
356 |
'1' |
$anode = $anode->previous_sibling; |
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
357 |
} |
} |
358 |
$anode = $anode-> |
} # has_el |
359 |
previous_sibling |
if ($has_dt) { |
360 |
; |
my $anode = $self->last_child; |
361 |
} |
while (defined $anode) { |
362 |
} # has_el |
my $ant = $anode->node_type; |
363 |
if ($has_dt) { |
if ($ant == 1 or $ant == 10) { # ELEMENT_NODE or DOCUMENT_TYPE_NODE |
364 |
my $anode = $self-> |
report Message::DOM::DOMException |
365 |
last_child |
-object => $self, |
366 |
; |
-type => 'HIERARCHY_REQUEST_ERR', |
367 |
while (defined $anode) { |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
368 |
my $ant = $anode-> |
} |
369 |
node_type |
$anode = $anode->previous_sibling; |
|
; |
|
|
if ($ant == |
|
|
'1' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} elsif ($ant == |
|
|
'10' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
370 |
} |
} |
371 |
$anode = $anode-> |
} # has_dt |
372 |
previous_sibling |
} |
|
; |
|
|
} |
|
|
} # has_dt |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$strict = $self-> |
|
|
strict_error_checking |
|
|
; |
|
373 |
|
|
374 |
## -- Node Type check |
for my $cn (@new_child) { |
|
my @new_child; |
|
|
if ({ |
|
|
'3' => (not $strictc), |
|
|
'5' => (not $strictc), |
|
|
'1' => 1, |
|
|
'4' => (not $strictc), |
|
|
'7' => 1, |
|
|
'8' => 1, |
|
|
'10' => 1, |
|
|
}->{$child_nt}) { |
|
|
push @new_child, $newChild; |
|
|
} elsif ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
for my $cn (@{$newChild-> |
|
|
child_nodes |
|
|
}) { |
|
375 |
unless ({ |
unless ({ |
376 |
'3' => (not $strictc), |
3, (not $strict_children), # TEXT_NODE |
377 |
'5' => (not $strictc), |
5, (not $strict_children), # ENTITY_REFERENCE_NODE |
378 |
'1' => 1, |
1, 1, # ELEMENT_NODE |
379 |
'4' => (not $strictc), |
4, (not $strict_children), # CDATA_SECTION_NODE |
380 |
'7' => 1, |
7, 1, # PROCESSING_INSTRUCTION_NODE |
381 |
'8' => 1, |
8, 1, # COMMENT_NODE |
382 |
'10' => 1, |
10, 1, # DOCUMENT_TYPE_NODE |
383 |
}->{$cn-> |
}->{$cn->node_type}) { |
384 |
node_type |
report Message::DOM::DOMException |
385 |
}) { |
-object => $self, |
386 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
387 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
388 |
} |
} |
|
push @new_child, $cn; |
|
|
} |
|
|
} else { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
|
|
parent_node |
|
|
: |
|
|
|
|
|
undef |
|
|
; |
|
|
if ($strict) { |
|
|
## -- Wrong-document check |
|
|
unless ($self eq $child_od) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
389 |
} |
} |
390 |
|
|
391 |
## -- Read-onlyness check |
## NOTE: Ancestor check here in |Node|. |
|
if ($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
if (@new_child) { |
|
|
if ($nc_parent and |
|
|
$nc_parent-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
} |
|
392 |
} |
} |
393 |
|
|
394 |
## -- Insert at... |
## NOTE: "Insert at" code only in insert_before and replace_child |
|
my $index = -1; # last |
|
|
|
|
|
|
|
|
; # FOR !tc:ForAppendChild |
|
395 |
|
|
396 |
## -- Removes from parent |
## -- Removes from parent |
397 |
if ($nc_parent) { |
if ($new_child_parent) { |
398 |
if ($child_nt == |
if (@new_child == 1) { |
399 |
'11' |
my $v = $$new_child_parent->{child_nodes}; |
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$newChild->{ |
|
|
'b' |
|
|
}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'} = []; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} else { |
|
|
my $v; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$v = $nc_parent->{ |
|
|
'b' |
|
|
}->{${$nc_parent->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
400 |
RP: for my $i (0..$#$v) { |
RP: for my $i (0..$#$v) { |
401 |
my $nodeid = $v->[$i]; |
if ($v->[$i] eq $new_child[0]) { |
|
if ( |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
|
|
) { |
|
402 |
splice @$v, $i, 1, (); |
splice @$v, $i, 1, (); |
403 |
last RP; |
last RP; |
404 |
} |
} |
405 |
} # RP |
} # RP |
406 |
|
} else { |
407 |
|
@{$$new_child_parent->{child_nodes}} = (); |
408 |
} |
} |
409 |
} |
} |
410 |
|
|
411 |
## -- Rewrite the |parentNode| properties |
## -- Rewrite the |parentNode| properties |
412 |
for my $nc (@new_child) { |
for my $nc (@new_child) { |
413 |
|
$$nc->{parent_node} = $self; |
414 |
|
Scalar::Util::weaken ($$nc->{parent_node}); |
|
{ |
|
|
|
|
|
|
|
|
$nc->{ |
|
|
'b' |
|
|
}->{${$nc->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'} = $self->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
415 |
} |
} |
416 |
|
|
417 |
my $children; |
## NOTE: Depends on method: |
418 |
|
push @{$$self->{child_nodes}}, @new_child; |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$children = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
## -- Adds to children list |
|
|
push @$children, map { |
|
|
|
|
|
$_->{'id'} |
|
|
|
|
|
} @new_child; |
|
|
$r = $newChild; |
|
|
|
|
|
|
|
419 |
|
|
420 |
} |
## NOTE: Only in |Document|. |
421 |
|
for (@new_child) { |
422 |
; |
delete $$_->{implementation}; |
423 |
|
$$_->{owner_document} = $self; |
424 |
|
Scalar::Util::weaken ($$_->{owner_document}); |
425 |
|
} |
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
if ($child_nt == |
|
|
'10' and |
|
|
|
|
|
not defined $newChild-> |
|
|
owner_document |
|
|
) { |
|
|
my $bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
CORE::delete |
|
|
$bag->{${$bag->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'impl'} or \''}} |
|
|
->{'lpmi'}; |
|
|
$bag->{ |
|
|
'm' |
|
|
}++; |
|
|
CORE::delete $bag->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'impl'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$bag->{${$newChild->{ |
|
|
'id' |
|
|
}}}->{'od'} |
|
|
= $self->{ |
|
|
'id' |
|
|
}; |
|
|
$bag->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'do'}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
= $newChild->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub insert_before ($$;$) { |
|
|
my ($self, $newChild, $refChild) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$strictc = $self-> |
|
|
dom_config |
|
|
|
|
|
-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
|
|
); |
|
|
my $child_od = $newChild-> |
|
|
owner_document |
|
|
|| $self; |
|
|
my $child_nt = $newChild-> |
|
|
node_type |
|
|
; |
|
|
if ($strictc and $self-> |
|
|
strict_error_checking |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$has_el; |
|
|
my $has_dt; |
|
|
if ($child_nt == |
|
|
'1' |
|
|
) { |
|
|
$has_el = |
|
|
1 |
|
|
; |
|
|
} elsif ($child_nt == |
|
|
'10' |
|
|
) { |
|
|
$has_dt = |
|
|
1 |
|
|
; |
|
|
} elsif ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
for my $cn (@{$newChild-> |
|
|
child_nodes |
|
|
}) { |
|
|
my $cnt = $cn-> |
|
|
node_type |
|
|
; |
|
|
if ($cnt == |
|
|
'1' |
|
|
) { |
|
|
if ($has_el) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
426 |
|
|
427 |
|
return $_[1]; |
428 |
|
} # apepnd_child |
429 |
|
|
430 |
} |
sub manakai_append_text ($$) { |
431 |
|
my $self = shift; |
432 |
|
if ($$self->{'http://suika.fam.cx/www/2006/dom-config/strict-document-children'}) { |
433 |
|
# |
434 |
|
} else { |
435 |
|
local $Error::Depth = $Error::Depth + 1; |
436 |
|
return $self->SUPER::manakai_append_text (@_); |
437 |
|
} |
438 |
|
} # manakai_append_text |
439 |
|
|
440 |
|
sub insert_before ($$) { |
441 |
|
## NOTE: Overrides |Node|'s implementation. |
442 |
|
my $self = $_[0]; |
443 |
|
|
444 |
;} |
## NOTE: |$self_od| code here depending on $self->node_type. |
445 |
|
|
446 |
; |
## -- Node Type check |
447 |
|
my @new_child; |
448 |
|
my $new_child_parent; |
449 |
|
if ($_[1]->node_type == 11) { # DOCUMENT_FRAGMENT_NODE |
450 |
|
push @new_child, @{$_[1]->child_nodes}; |
451 |
|
$new_child_parent = $_[1]; |
452 |
|
} else { |
453 |
|
@new_child = ($_[1]); |
454 |
|
$new_child_parent = $_[1]->parent_node; |
455 |
|
} |
456 |
|
|
457 |
|
## NOTE: Depends on $self->node_type: |
458 |
|
if ($$self->{strict_error_checking}) { |
459 |
|
my $child_od = $_[1]->owner_document || $_[1]; # might be DocumentType |
460 |
|
if ($self ne $child_od and $child_od->node_type != 10) { |
461 |
|
report Message::DOM::DOMException # DOCUMENT_TYPE_NODE |
462 |
|
-object => $self, |
463 |
|
-type => 'WRONG_DOCUMENT_ERR', |
464 |
|
-subtype => 'EXTERNAL_OBJECT_ERR'; |
465 |
|
} |
466 |
|
|
467 |
|
if ($$self->{manakai_read_only} or |
468 |
|
(@new_child and defined $new_child_parent and |
469 |
|
$$new_child_parent->{manakai_read_only})) { |
470 |
|
report Message::DOM::DOMException |
471 |
|
-object => $self, |
472 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
473 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
474 |
|
} |
475 |
|
|
476 |
|
## NOTE: Only in |Document|: |
477 |
|
my $strict_children = $self->dom_config->get_parameter |
478 |
|
(q<http://suika.fam.cx/www/2006/dom-config/strict-document-children>); |
479 |
|
if ($strict_children) { |
480 |
|
my $has_el; |
481 |
|
my $has_dt; |
482 |
|
my $child_nt = $_[1]->node_type; |
483 |
|
if ($child_nt == 1) { # ELEMENT_NODE |
484 |
|
$has_el = 1; |
485 |
|
} elsif ($child_nt == 10) { # DOCUMENT_TYPE_NODE |
486 |
|
$has_dt = 1; |
487 |
|
} elsif ($child_nt == 11) { # DOCUMENT_FRAGMENT_NODE |
488 |
|
for my $cn (@{$_[1]->child_nodes}) { |
489 |
|
my $cnt = $cn->node_type; |
490 |
|
if ($cnt == 1) { # ELEMENT_NODE |
491 |
|
if ($has_el) { |
492 |
|
report Message::DOM::DOMException |
493 |
|
-object => $self, |
494 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
495 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
496 |
|
} |
497 |
|
$has_el = 1; |
498 |
|
} elsif ($cnt == 10) { # DOCUMENT_TYPE_NODE |
499 |
|
## NOTE: |DocumentType| node cannot be contained in |
500 |
|
## |DocumentFragment| in strict mode. |
501 |
|
if ($has_dt) { |
502 |
|
report Message::DOM::DOMException |
503 |
|
-object => $self, |
504 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
505 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
506 |
|
} |
507 |
|
$has_dt = 1; |
508 |
} |
} |
|
$has_el = |
|
|
1 |
|
|
; |
|
|
} |
|
|
# DocumentType node cannot be contained in DocumentFragments |
|
|
} |
|
|
} |
|
|
|
|
|
if ($has_el) { |
|
|
my $anode = $refChild ? $refChild-> |
|
|
previous_sibling |
|
|
: |
|
|
$self-> |
|
|
last_child |
|
|
; |
|
|
while (defined $anode) { |
|
|
if ($anode-> |
|
|
node_type |
|
|
== |
|
|
'1' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
$anode = $anode-> |
|
|
previous_sibling |
|
|
; |
|
|
} |
|
|
$anode = $refChild; |
|
|
while (defined $anode) { |
|
|
my $ant = $anode-> |
|
|
node_type |
|
|
; |
|
|
if ($ant == |
|
|
'1' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} elsif ($ant == |
|
|
'10' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
509 |
} |
} |
|
$anode = $anode-> |
|
|
next_sibling |
|
|
; |
|
510 |
} |
} |
|
} # has_el |
|
|
if ($has_dt) { |
|
|
my $anode = $refChild ? $refChild-> |
|
|
previous_sibling |
|
|
: |
|
|
$self-> |
|
|
last_child |
|
|
; |
|
|
while (defined $anode) { |
|
|
my $ant = $anode-> |
|
|
node_type |
|
|
; |
|
|
if ($ant == |
|
|
'1' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
511 |
|
|
512 |
{ |
## ISSUE: This code is wrong. Old manakai's implementation |
513 |
|
## is better, but it is also wrong in some edge cases. |
514 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
## Maybe we should remove these code entirely. DOM3Core |
515 |
|
## conformance is not important for this bit. It only makes |
516 |
|
## things too complex. Same for replace_child's code. |
517 |
} |
if ($has_el) { |
518 |
|
my $anode = $self->last_child; |
519 |
|
while (defined $anode) { |
520 |
;} |
if ($anode->node_type == 1) { # ELEMENT_NODE |
521 |
|
report Message::DOM::DOMException |
522 |
; |
-object => $self, |
523 |
} elsif ($ant == |
-type => 'HIERARCHY_REQUEST_ERR', |
524 |
'10' |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
525 |
) { |
} |
526 |
|
$anode = $anode->previous_sibling; |
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
527 |
} |
} |
528 |
$anode = $anode-> |
} # has_el |
529 |
previous_sibling |
if ($has_dt) { |
530 |
; |
my $anode = $self->last_child; |
531 |
} |
while (defined $anode) { |
532 |
$anode = $refChild; |
my $ant = $anode->node_type; |
533 |
while (defined $anode) { |
if ($ant == 1 or $ant == 10) { # ELEMENT_NODE or DOCUMENT_TYPE_NODE |
534 |
if ($anode-> |
report Message::DOM::DOMException |
535 |
node_type |
-object => $self, |
536 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
537 |
== |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
538 |
'10' |
} |
539 |
) { |
$anode = $anode->previous_sibling; |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
540 |
} |
} |
541 |
$anode = $anode-> |
} # has_dt |
542 |
next_sibling |
} |
|
; |
|
|
} |
|
|
} # has_dt |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$strict = $self-> |
|
|
strict_error_checking |
|
|
; |
|
543 |
|
|
544 |
## -- Node Type check |
for my $cn (@new_child) { |
|
my @new_child; |
|
|
if ({ |
|
|
'3' => (not $strictc), |
|
|
'5' => (not $strictc), |
|
|
'1' => 1, |
|
|
'4' => (not $strictc), |
|
|
'7' => 1, |
|
|
'8' => 1, |
|
|
'10' => 1, |
|
|
}->{$child_nt}) { |
|
|
push @new_child, $newChild; |
|
|
} elsif ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
for my $cn (@{$newChild-> |
|
|
child_nodes |
|
|
}) { |
|
545 |
unless ({ |
unless ({ |
546 |
'3' => (not $strictc), |
3, (not $strict_children), # TEXT_NODE |
547 |
'5' => (not $strictc), |
5, (not $strict_children), # ENTITY_REFERENCE_NODE |
548 |
'1' => 1, |
1, 1, # ELEMENT_NODE |
549 |
'4' => (not $strictc), |
4, (not $strict_children), # CDATA_SECTION_NODE |
550 |
'7' => 1, |
7, 1, # PROCESSING_INSTRUCTION_NODE |
551 |
'8' => 1, |
8, 1, # COMMENT_NODE |
552 |
'10' => 1, |
10, 1, # DOCUMENT_TYPE_NODE |
553 |
}->{$cn-> |
}->{$cn->node_type}) { |
554 |
node_type |
report Message::DOM::DOMException |
555 |
}) { |
-object => $self, |
556 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
557 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
558 |
} |
} |
|
push @new_child, $cn; |
|
|
} |
|
|
} else { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
|
|
parent_node |
|
|
: |
|
|
|
|
|
undef |
|
|
; |
|
|
if ($strict) { |
|
|
## -- Wrong-document check |
|
|
unless ($self eq $child_od) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
## -- Read-onlyness check |
|
|
if ($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
559 |
} |
} |
|
if (@new_child) { |
|
|
if ($nc_parent and |
|
|
$nc_parent-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
560 |
|
|
561 |
|
## NOTE: Ancestor check here in |Node|. |
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
} |
|
562 |
} |
} |
|
|
|
|
## -- Insert at... |
|
|
my $index = -1; # last |
|
563 |
|
|
564 |
|
## -- Insert at... ## NOTE: Only in insert_before and replace_child |
565 |
{ |
my $index = -1; # last |
566 |
|
if (defined $_[2]) { |
567 |
|
## error if $_[1] eq $_[2]; |
568 |
# tc:ForAppendChild & tc:ForReplaceChild |
|
569 |
if (defined $refChild) { |
my $cns = $self->child_nodes; |
570 |
if ($refChild eq $newChild) { |
my $cnsl = @$cns; |
571 |
|
C: { |
572 |
|
$index = 0; |
573 |
{ |
for my $i (0..($cnsl-1)) { |
574 |
|
my $cn = $cns->[$i]; |
575 |
|
if ($cn eq $_[2]) { |
576 |
{ |
$index += $i; |
577 |
|
last C; |
578 |
local $Error::Depth = $Error::Depth - 1; |
} elsif ($cn eq $_[1]) { |
579 |
|
$index = -1; # offset |
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $cns = $self-> |
|
|
child_nodes |
|
|
; |
|
|
my $cnsl = @$cns; |
|
|
C: { |
|
|
$index = 0; |
|
|
for my $i (0..($cnsl-1)) { |
|
|
my $cn = $cns->[$i]; |
|
|
if ($cn eq $refChild) { |
|
|
$index += $i; |
|
|
last C; |
|
|
} elsif ($cn eq $newChild) { |
|
|
$index = -1; # offset |
|
|
} |
|
580 |
} |
} |
581 |
|
} |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
; |
|
|
} # C |
|
|
} else { # |oldChild| is not defined |
|
582 |
|
|
583 |
|
report Message::DOM::DOMException |
584 |
; |
-object => $self, |
585 |
} |
-type => 'NOT_FOUND_ERR', |
586 |
|
-subtype => 'NOT_CHILD_ERR'; |
587 |
|
} # C |
588 |
|
} |
589 |
} |
## NOTE: "else" only in replace_child |
|
|
|
|
; # FOR !tc:ForAppendChild |
|
590 |
|
|
591 |
## -- Removes from parent |
## -- Removes from parent |
592 |
if ($nc_parent) { |
if ($new_child_parent) { |
593 |
if ($child_nt == |
if (@new_child == 1) { |
594 |
'11' |
my $v = $$new_child_parent->{child_nodes}; |
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$newChild->{ |
|
|
'b' |
|
|
}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'} = []; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} else { |
|
|
my $v; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$v = $nc_parent->{ |
|
|
'b' |
|
|
}->{${$nc_parent->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
595 |
RP: for my $i (0..$#$v) { |
RP: for my $i (0..$#$v) { |
596 |
my $nodeid = $v->[$i]; |
if ($v->[$i] eq $new_child[0]) { |
|
if ( |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
|
|
) { |
|
597 |
splice @$v, $i, 1, (); |
splice @$v, $i, 1, (); |
598 |
last RP; |
last RP; |
599 |
} |
} |
600 |
} # RP |
} # RP |
601 |
|
} else { |
602 |
|
@{$$new_child_parent->{child_nodes}} = (); |
603 |
} |
} |
604 |
} |
} |
605 |
|
|
606 |
## -- Rewrite the |parentNode| properties |
## -- Rewrite the |parentNode| properties |
607 |
for my $nc (@new_child) { |
for my $nc (@new_child) { |
608 |
|
$$nc->{parent_node} = $self; |
609 |
|
Scalar::Util::weaken ($$nc->{parent_node}); |
|
{ |
|
|
|
|
|
|
|
|
$nc->{ |
|
|
'b' |
|
|
}->{${$nc->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'} = $self->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
610 |
} |
} |
611 |
|
|
612 |
my $children; |
## NOTE: Depends on method: |
613 |
|
if ($index == -1) { |
614 |
|
push @{$$self->{child_nodes}}, @new_child; |
615 |
{ |
} else { |
616 |
|
splice @{$$self->{child_nodes}}, $index, 0, @new_child; |
617 |
|
} |
|
$children = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
## -- Adds to children list |
|
|
if ($index == -1) { |
|
|
push @$children, map { |
|
|
|
|
|
$_->{'id'} |
|
|
|
|
|
} @new_child; |
|
|
} else { |
|
|
splice @$children, $index, 0, map { |
|
|
|
|
|
$_->{'id'} |
|
|
|
|
|
} @new_child; |
|
|
} |
|
|
$r = $newChild; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
if ($child_nt == |
|
|
'10' and |
|
|
|
|
|
not defined $newChild-> |
|
|
owner_document |
|
|
) { |
|
|
my $bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
CORE::delete |
|
|
$bag->{${$bag->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'impl'} or \''}} |
|
|
->{'lpmi'}; |
|
|
$bag->{ |
|
|
'm' |
|
|
}++; |
|
|
CORE::delete $bag->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'impl'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$bag->{${$newChild->{ |
|
|
'id' |
|
|
}}}->{'od'} |
|
|
= $self->{ |
|
|
'id' |
|
|
}; |
|
|
$bag->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'do'}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
= $newChild->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub replace_child ($$$) { |
|
|
my ($self, $newChild, $oldChild) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$strictc = $self-> |
|
|
dom_config |
|
|
|
|
|
-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
|
|
); |
|
|
my $child_od = $newChild-> |
|
|
owner_document |
|
|
|| $self; |
|
|
my $child_nt = $newChild-> |
|
|
node_type |
|
|
; |
|
|
if ($strictc and $self-> |
|
|
strict_error_checking |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$has_el; |
|
|
my $has_dt; |
|
|
if ($child_nt == |
|
|
'1' |
|
|
) { |
|
|
$has_el = |
|
|
1 |
|
|
; |
|
|
} elsif ($child_nt == |
|
|
'10' |
|
|
) { |
|
|
$has_dt = |
|
|
1 |
|
|
; |
|
|
} elsif ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
for my $cn (@{$newChild-> |
|
|
child_nodes |
|
|
}) { |
|
|
my $cnt = $cn-> |
|
|
node_type |
|
|
; |
|
|
if ($cnt == |
|
|
'1' |
|
|
) { |
|
|
if ($has_el) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
618 |
|
|
619 |
|
## NOTE: Only in |Document|. |
620 |
|
for (@new_child) { |
621 |
|
delete $$_->{implementation}; |
622 |
|
$$_->{owner_document} = $self; |
623 |
|
Scalar::Util::weaken ($$_->{owner_document}); |
624 |
|
} |
625 |
|
|
626 |
} |
return $_[1]; |
627 |
|
} # insert_before |
628 |
|
|
629 |
|
sub replace_child ($$) { |
630 |
|
## NOTE: Overrides |Node|'s implementation. |
631 |
|
my $self = $_[0]; |
632 |
|
|
633 |
;} |
## NOTE: |$self_od| code here depending on $self->node_type. |
634 |
|
|
635 |
; |
## -- Node Type check |
636 |
|
my @new_child; |
637 |
|
my $new_child_parent; |
638 |
|
if ($_[1]->node_type == 11) { # DOCUMENT_FRAGMENT_NODE |
639 |
|
push @new_child, @{$_[1]->child_nodes}; |
640 |
|
$new_child_parent = $_[1]; |
641 |
|
} else { |
642 |
|
@new_child = ($_[1]); |
643 |
|
$new_child_parent = $_[1]->parent_node; |
644 |
|
} |
645 |
|
|
646 |
|
## NOTE: Depends on $self->node_type: |
647 |
|
if ($$self->{strict_error_checking}) { |
648 |
|
my $child_od = $_[1]->owner_document || $_[1]; # might be DocumentType |
649 |
|
if ($self ne $child_od and $child_od->node_type != 10) { |
650 |
|
report Message::DOM::DOMException # DOCUMENT_TYPE_NODE |
651 |
|
-object => $self, |
652 |
|
-type => 'WRONG_DOCUMENT_ERR', |
653 |
|
-subtype => 'EXTERNAL_OBJECT_ERR'; |
654 |
|
} |
655 |
|
|
656 |
|
if ($$self->{manakai_read_only} or |
657 |
|
(@new_child and defined $new_child_parent and |
658 |
|
$$new_child_parent->{manakai_read_only})) { |
659 |
|
report Message::DOM::DOMException |
660 |
|
-object => $self, |
661 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
662 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
663 |
|
} |
664 |
|
|
665 |
|
## NOTE: Only in |Document|: |
666 |
|
my $strict_children = $self->dom_config->get_parameter |
667 |
|
(q<http://suika.fam.cx/www/2006/dom-config/strict-document-children>); |
668 |
|
if ($strict_children) { |
669 |
|
my $has_el; |
670 |
|
my $has_dt; |
671 |
|
my $child_nt = $_[1]->node_type; |
672 |
|
if ($child_nt == 1) { # ELEMENT_NODE |
673 |
|
$has_el = 1; |
674 |
|
} elsif ($child_nt == 10) { # DOCUMENT_TYPE_NODE |
675 |
|
$has_dt = 1; |
676 |
|
} elsif ($child_nt == 11) { # DOCUMENT_FRAGMENT_NODE |
677 |
|
for my $cn (@{$_[1]->child_nodes}) { |
678 |
|
my $cnt = $cn->node_type; |
679 |
|
if ($cnt == 1) { # ELEMENT_NODE |
680 |
|
if ($has_el) { |
681 |
|
report Message::DOM::DOMException |
682 |
|
-object => $self, |
683 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
684 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
685 |
|
} |
686 |
|
$has_el = 1; |
687 |
|
} elsif ($cnt == 10) { # DOCUMENT_TYPE_NODE |
688 |
|
## NOTE: |DocumentType| node cannot be contained in |
689 |
|
## |DocumentFragment| in strict mode. |
690 |
|
if ($has_dt) { |
691 |
|
report Message::DOM::DOMException |
692 |
|
-object => $self, |
693 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
694 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
695 |
|
} |
696 |
|
$has_dt = 1; |
697 |
} |
} |
|
$has_el = |
|
|
1 |
|
|
; |
|
|
} |
|
|
# DocumentType node cannot be contained in DocumentFragments |
|
|
} |
|
|
} |
|
|
|
|
|
if ($has_el) { |
|
|
my $anode = $oldChild-> |
|
|
previous_sibling |
|
|
; |
|
|
while (defined $anode) { |
|
|
if ($anode-> |
|
|
node_type |
|
|
== |
|
|
'1' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
$anode = $anode-> |
|
|
previous_sibling |
|
|
; |
|
|
} |
|
|
$anode = $oldChild-> |
|
|
next_sibling |
|
|
; |
|
|
while (defined $anode) { |
|
|
my $ant = $anode-> |
|
|
node_type |
|
|
; |
|
|
if ($ant == |
|
|
'1' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} elsif ($ant == |
|
|
'10' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
698 |
} |
} |
|
$anode = $anode-> |
|
|
next_sibling |
|
|
; |
|
699 |
} |
} |
700 |
} # has_el |
|
701 |
if ($has_dt) { |
if ($has_el) { |
702 |
my $anode = $oldChild-> |
my $anode = $self->last_child; |
703 |
previous_sibling |
while (defined $anode) { |
704 |
; |
if ($anode->node_type == 1) { # ELEMENT_NODE |
705 |
while (defined $anode) { |
report Message::DOM::DOMException |
706 |
my $ant = $anode-> |
-object => $self, |
707 |
node_type |
-type => 'HIERARCHY_REQUEST_ERR', |
708 |
; |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
709 |
if ($ant == |
} |
710 |
'1' |
$anode = $anode->previous_sibling; |
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} elsif ($ant == |
|
|
'10' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
711 |
} |
} |
712 |
$anode = $anode-> |
} # has_el |
713 |
previous_sibling |
if ($has_dt) { |
714 |
; |
my $anode = $self->last_child; |
715 |
} |
while (defined $anode) { |
716 |
$anode = $oldChild-> |
my $ant = $anode->node_type; |
717 |
next_sibling |
if ($ant == 1 or $ant == 10) { # ELEMENT_NODE or DOCUMENT_TYPE_NODE |
718 |
; |
report Message::DOM::DOMException |
719 |
while (defined $anode) { |
-object => $self, |
720 |
if ($anode-> |
-type => 'HIERARCHY_REQUEST_ERR', |
721 |
node_type |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
722 |
|
} |
723 |
== |
$anode = $anode->previous_sibling; |
|
'10' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
724 |
} |
} |
725 |
$anode = $anode-> |
} # has_dt |
726 |
next_sibling |
} |
|
; |
|
|
} |
|
|
} # has_dt |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$strict = $self-> |
|
|
strict_error_checking |
|
|
; |
|
727 |
|
|
728 |
## -- Node Type check |
for my $cn (@new_child) { |
|
my @new_child; |
|
|
if ({ |
|
|
'3' => (not $strictc), |
|
|
'5' => (not $strictc), |
|
|
'1' => 1, |
|
|
'4' => (not $strictc), |
|
|
'7' => 1, |
|
|
'8' => 1, |
|
|
'10' => 1, |
|
|
}->{$child_nt}) { |
|
|
push @new_child, $newChild; |
|
|
} elsif ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
for my $cn (@{$newChild-> |
|
|
child_nodes |
|
|
}) { |
|
729 |
unless ({ |
unless ({ |
730 |
'3' => (not $strictc), |
3, (not $strict_children), # TEXT_NODE |
731 |
'5' => (not $strictc), |
5, (not $strict_children), # ENTITY_REFERENCE_NODE |
732 |
'1' => 1, |
1, 1, # ELEMENT_NODE |
733 |
'4' => (not $strictc), |
4, (not $strict_children), # CDATA_SECTION_NODE |
734 |
'7' => 1, |
7, 1, # PROCESSING_INSTRUCTION_NODE |
735 |
'8' => 1, |
8, 1, # COMMENT_NODE |
736 |
'10' => 1, |
10, 1, # DOCUMENT_TYPE_NODE |
737 |
}->{$cn-> |
}->{$cn->node_type}) { |
738 |
node_type |
report Message::DOM::DOMException |
739 |
}) { |
-object => $self, |
740 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
741 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
742 |
} |
} |
|
push @new_child, $cn; |
|
743 |
} |
} |
|
} else { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
744 |
|
|
745 |
|
## NOTE: Ancestor check here in |Node|. |
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
746 |
} |
} |
|
|
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
|
|
parent_node |
|
|
: |
|
|
|
|
|
undef |
|
|
; |
|
|
if ($strict) { |
|
|
## -- Wrong-document check |
|
|
unless ($self eq $child_od) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
## -- Read-onlyness check |
|
|
if ($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
if (@new_child) { |
|
|
if ($nc_parent and |
|
|
$nc_parent-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
## -- Insert at... |
|
|
my $index = -1; # last |
|
747 |
|
|
748 |
|
## -- Insert at... ## NOTE: Only in insertBefore and replaceChild |
749 |
{ |
my $index = -1; # last |
750 |
|
if (defined $_[2]) { |
751 |
|
## error if $_[1] eq $_[2]; |
752 |
# tc:ForAppendChild & tc:ForReplaceChild |
|
753 |
if (defined $oldChild) { |
my $cns = $self->child_nodes; |
754 |
if ($oldChild eq $newChild) { |
my $cnsl = @$cns; |
755 |
|
C: { |
756 |
|
$index = 0; |
757 |
; |
for my $i (0..($cnsl-1)) { |
758 |
|
my $cn = $cns->[$i]; |
759 |
|
if ($cn eq $_[2]) { |
760 |
{ |
$index += $i; |
761 |
|
last C; |
762 |
|
} elsif ($cn eq $_[1]) { |
763 |
{ |
$index = -1; # offset |
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $cns = $self-> |
|
|
child_nodes |
|
|
; |
|
|
my $cnsl = @$cns; |
|
|
C: { |
|
|
$index = 0; |
|
|
for my $i (0..($cnsl-1)) { |
|
|
my $cn = $cns->[$i]; |
|
|
if ($cn eq $oldChild) { |
|
|
$index += $i; |
|
|
last C; |
|
|
} elsif ($cn eq $newChild) { |
|
|
$index = -1; # offset |
|
|
} |
|
764 |
} |
} |
765 |
|
} |
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} # C |
|
|
} else { # |oldChild| is not defined |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
766 |
|
|
767 |
|
report Message::DOM::DOMException |
768 |
|
-object => $self, |
769 |
} |
-type => 'NOT_FOUND_ERR', |
770 |
|
-subtype => 'NOT_CHILD_ERR'; |
771 |
; |
} # C |
772 |
} |
} else { |
773 |
|
## NOTE: Only in replaceChild |
774 |
|
report Message::DOM::DOMException |
775 |
|
-object => $self, |
776 |
} |
-type => 'NOT_FOUND_ERR', |
777 |
|
-subtype => 'NOT_CHILD_ERR'; |
778 |
; # FOR !tc:ForAppendChild |
} |
779 |
|
|
780 |
## -- Removes from parent |
## -- Removes from parent |
781 |
if ($nc_parent) { |
if ($new_child_parent) { |
782 |
if ($child_nt == |
if (@new_child == 1) { |
783 |
'11' |
my $v = $$new_child_parent->{child_nodes}; |
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$newChild->{ |
|
|
'b' |
|
|
}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'} = []; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} else { |
|
|
my $v; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$v = $nc_parent->{ |
|
|
'b' |
|
|
}->{${$nc_parent->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
784 |
RP: for my $i (0..$#$v) { |
RP: for my $i (0..$#$v) { |
785 |
my $nodeid = $v->[$i]; |
if ($v->[$i] eq $new_child[0]) { |
|
if ( |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
|
|
) { |
|
786 |
splice @$v, $i, 1, (); |
splice @$v, $i, 1, (); |
787 |
last RP; |
last RP; |
788 |
} |
} |
789 |
} # RP |
} # RP |
790 |
|
} else { |
791 |
|
@{$$new_child_parent->{child_nodes}} = (); |
792 |
} |
} |
793 |
} |
} |
794 |
|
|
795 |
## -- Rewrite the |parentNode| properties |
## -- Rewrite the |parentNode| properties |
796 |
for my $nc (@new_child) { |
for my $nc (@new_child) { |
797 |
|
$$nc->{parent_node} = $self; |
798 |
|
Scalar::Util::weaken ($$nc->{parent_node}); |
|
{ |
|
|
|
|
|
|
|
|
$nc->{ |
|
|
'b' |
|
|
}->{${$nc->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'} = $self->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
799 |
} |
} |
800 |
|
|
801 |
my $children; |
## NOTE: Depends on method: |
802 |
|
splice @{$$self->{child_nodes}}, $index, 1, @new_child; |
803 |
|
delete ${$_[2]}->{parent_node}; |
|
{ |
|
|
|
|
804 |
|
|
805 |
$children = $self->{ |
## NOTE: Only in |Document|. |
806 |
'b' |
for (@new_child) { |
807 |
}->{${$self->{ |
delete $$_->{implementation}; |
808 |
'id' |
$$_->{owner_document} = $self; |
809 |
}}} |
Scalar::Util::weaken ($$_->{owner_document}); |
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
## -- Replaces the node |
|
|
splice @$children, $index, 1, map { |
|
|
|
|
|
$_->{'id'} |
|
|
|
|
|
} @new_child; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
CORE::delete |
|
|
$oldChild->{ |
|
|
'b' |
|
|
}->{${$oldChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$r = $oldChild; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
if ($child_nt == |
|
|
'10' and |
|
|
|
|
|
not defined $newChild-> |
|
|
owner_document |
|
|
) { |
|
|
my $bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
CORE::delete |
|
|
$bag->{${$bag->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'impl'} or \''}} |
|
|
->{'lpmi'}; |
|
|
$bag->{ |
|
|
'm' |
|
|
}++; |
|
|
CORE::delete $bag->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'impl'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$bag->{${$newChild->{ |
|
|
'id' |
|
|
}}}->{'od'} |
|
|
= $self->{ |
|
|
'id' |
|
|
}; |
|
|
$bag->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'do'}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
= $newChild->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub manakai_append_text ($$) { |
|
|
my ($self, $string) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
unless |
|
|
($self-> |
|
|
dom_config |
|
|
|
|
|
-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
|
|
)) { |
|
|
my $lc = $self-> |
|
|
last_child |
|
|
; |
|
|
if (defined $lc and |
|
|
$lc-> |
|
|
node_type |
|
|
== |
|
|
'3' |
|
|
) { |
|
|
$lc-> |
|
|
manakai_append_text |
|
|
|
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
|
|
} else { |
|
|
my $text = $self-> |
|
|
create_text_node |
|
|
|
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
|
|
$self-> |
|
|
append_child |
|
|
($text); |
|
|
} |
|
810 |
} |
} |
|
$r = $self; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
811 |
|
|
812 |
;} |
return $_[2]; |
813 |
|
} # replace_child |
814 |
|
|
815 |
; |
## |Document| attributes |
816 |
|
|
817 |
|
## NOTE: A manakai extension. |
818 |
|
sub all_declarations_processed ($;$); |
819 |
|
|
820 |
} |
## TODO: documentation |
821 |
$r} |
sub manakai_charset ($;$); |
|
sub remove_child ($$) { |
|
|
my ($self, $oldChild) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
strict_error_checking and |
|
|
|
|
|
$self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'remove_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
F: |
|
|
{ |
|
|
my $i = -1; |
|
|
for my $cld (@{$self-> |
|
|
child_nodes |
|
|
}) { |
|
|
$i++; |
|
|
if ($cld eq $oldChild) { |
|
|
my $v; |
|
|
|
|
822 |
|
|
823 |
{ |
sub doctype ($) { |
824 |
|
my $self = $_[0]; |
825 |
|
for (@{$self->child_nodes}) { |
826 |
$v = $self->{ |
if ($_->node_type == 10) { # DOCUMENT_TYPE_NODE |
827 |
'b' |
return $_; |
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
splice @$v, $i, 1, (); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
CORE::delete |
|
|
$oldChild->{ |
|
|
'b' |
|
|
}->{${$oldChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$r = $oldChild; |
|
|
last F; |
|
828 |
} |
} |
829 |
} |
} |
830 |
|
return undef; |
831 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/removeChildImpl+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
} # doctype |
|
|
|
|
; |
|
|
} # F |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub node_name ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
$r = '#document'; |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
|
|
} |
|
|
} |
|
|
sub text_content ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
832 |
|
|
833 |
local $Error::Depth = $Error::Depth + 1; |
sub document_element ($) { |
834 |
|
my $self = shift; |
835 |
{ |
for (@{$self->child_nodes}) { |
836 |
|
if ($_->node_type == 1) { # ELEMENT_NODE |
837 |
|
return $_; |
|
if |
|
|
($self-> |
|
|
dom_config |
|
|
|
|
|
-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
|
|
)) { |
|
|
$r = |
|
|
undef |
|
|
; |
|
|
} else { |
|
|
$r = ''; |
|
|
my @target = @{$self-> |
|
|
child_nodes |
|
|
}; |
|
|
C: for my $node (@target) { |
|
|
my $nt = $node-> |
|
|
node_type |
|
|
; |
|
|
if ($nt == |
|
|
'3' or |
|
|
|
|
|
$nt == |
|
|
'4' |
|
|
) { |
|
|
$r .= $node-> |
|
|
data |
|
|
unless |
|
|
$node-> |
|
|
is_element_content_whitespace |
|
|
; |
|
|
} elsif ($nt == |
|
|
'1' or |
|
|
|
|
|
$nt == |
|
|
'5' |
|
|
) { |
|
|
unshift @target, @{$node-> |
|
|
child_nodes |
|
|
}; |
|
|
} |
|
838 |
} |
} |
839 |
} |
} |
840 |
|
return undef; |
841 |
|
} # document_element |
842 |
|
|
843 |
|
sub document_uri ($;$); |
844 |
|
|
845 |
|
sub dom_config ($) { |
846 |
|
require Message::DOM::DOMConfiguration; |
847 |
|
return bless \\($_[0]), 'Message::DOM::DOMConfiguration'; |
848 |
|
} # dom_config |
849 |
|
|
850 |
} |
sub manakai_entity_base_uri ($;$) { |
851 |
|
my $self = $_[0]; |
852 |
|
if (@_ > 1) { |
853 |
;} |
if ($$self->{strict_error_checking}) { |
854 |
|
if ($$self->{manakai_read_only}) { |
855 |
; |
report Message::DOM::DOMException |
856 |
|
-object => $self, |
857 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
858 |
} |
-subtype => 'READ_ONLY_NODE_ERR'; |
859 |
$r; |
} |
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
dom_config |
|
|
|
|
|
-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
|
|
)) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#setting-node-value-no-effect', 'rdata' => $self, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'text_content'; |
|
|
|
|
|
; |
|
|
} else { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
my @__old_children = @{$self-> |
|
|
child_nodes |
|
|
}; |
|
|
for my $__old_child (@__old_children) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
CORE::delete |
|
|
$__old_child->{ |
|
|
'b' |
|
|
}->{${$__old_child->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my @__new_children; |
|
|
if (defined $given and length $given) { |
|
|
my $__text = $self-> |
|
|
create_text_node |
|
|
($given); |
|
|
push @__new_children, |
|
|
$__text->{'id'} |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$__text->{ |
|
|
'b' |
|
|
}->{${$__text->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'} = $self->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'} = \@__new_children; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub get_feature ($$$) { |
|
|
my ($self, $feature, $version) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$feature = lc $feature; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$version = '' unless defined $version; |
|
|
|
|
|
|
|
|
} |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$feature =~ s/^\+//; |
|
|
|
|
|
## TODO: Remove this code and implement autoload |
|
|
if ($feature eq |
|
|
'http://suika.fam.cx/www/2006/feature/xdoctype' |
|
|
) { |
|
|
require Message::DOM::XDoctype; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($Message::DOM::DOMFeature::ClassInfo->{ref $self} |
|
|
->{has_feature}->{$feature}->{$version}) { |
|
|
$r = $self; |
|
|
} else { |
|
|
CLASS: for my $__class (sort { |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
|
|
} grep { |
|
|
$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Document::ManakaiDOMDocument'} |
|
|
->{compat_class}->{$_} |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Document::ManakaiDOMDocument'} |
|
|
->{compat_class} or {}}) { |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
|
|
->{has_feature}->{$feature}->{$version}) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${($self->{'b'})->{${($self->{'id'})}}->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> ($self->{'id'}), |
|
|
|
|
|
'b' |
|
|
=> ($self->{'b'}), |
|
|
}, { |
|
|
'nrcls' => \$__class, |
|
|
}); |
|
|
($self->{'b'})->{${($self->{'id'})}}->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
last CLASS; |
|
|
} |
|
|
} # CLASS |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
unless (defined $r) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub base_uri ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'buri'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
unless (defined $r) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'duri'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
|
|
} |
|
|
} |
|
|
sub create_element ($$) { |
|
|
my ($self, $tagName) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$strict = $self-> |
|
|
strict_error_checking |
|
|
; |
|
|
if ($strict) { |
|
|
my $version = $self-> |
|
|
xml_version |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined $tagName) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(((not defined $version or $version eq '1.0') and |
|
|
not |
|
|
($tagName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
|
|
) or |
|
|
(defined $version and $version eq '1.1' and |
|
|
not |
|
|
($tagName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
|
|
)) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $tagName, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$self-> |
|
|
strict_error_checking |
|
|
( |
|
|
0 |
|
|
); |
|
|
$r = $self-> |
|
|
create_element_ns |
|
|
( |
|
|
undef |
|
|
, [ |
|
|
undef |
|
|
, $tagName]); |
|
|
$self-> |
|
|
strict_error_checking |
|
|
($strict); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_element_ns ($$$) { |
|
|
my ($self, $namespaceURI, $qualifiedName) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1144080824:30455:ZO0D78781+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$namespaceURI = undef; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
require |
|
|
Message::DOM::Element; |
|
|
|
|
|
my ($prefix, $lname) = ref $qualifiedName eq 'ARRAY' |
|
|
? @$qualifiedName |
|
|
: split /:/, $qualifiedName, 2; |
|
|
($prefix, $lname) = ( |
|
|
undef |
|
|
, $prefix) unless defined $lname; |
|
|
$qualifiedName = defined $prefix ? $prefix.':'.$lname : $lname; |
|
|
|
|
|
if ($self-> |
|
|
strict_error_checking |
|
|
) { |
|
|
my $version = $self-> |
|
|
xml_version |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined $version and $version eq '1.1') { |
|
|
unless ( |
|
|
($qualifiedName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
unless ( |
|
|
($qualifiedName =~ /\A\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*(?::\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*)?\z/) |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
} else { |
|
|
unless ( |
|
|
($qualifiedName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
860 |
} |
} |
861 |
unless ( |
if (defined $_[1]) { |
862 |
($qualifiedName =~ /\A\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*(?::\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*)?\z/) |
$$self->{manakai_entity_base_uri} = ''.$_[1]; |
863 |
) { |
} else { |
864 |
|
delete $$self->{manakai_entity_base_uri}; |
|
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'; |
|
|
|
|
|
; |
|
865 |
} |
} |
866 |
} |
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined $prefix) { |
|
|
if (not defined $namespaceURI) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} elsif ($prefix eq 'xml' and $namespaceURI ne |
|
|
'http://www.w3.org/XML/1998/namespace' |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} elsif ($prefix eq 'xmlns' and $namespaceURI ne |
|
|
'http://www.w3.org/2000/xmlns/' |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} elsif ($namespaceURI eq |
|
|
'http://www.w3.org/XML/1998/namespace' and |
|
|
$prefix ne 'xml') { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} elsif ($namespaceURI eq |
|
|
'http://www.w3.org/2000/xmlns/' and |
|
|
$prefix ne 'xmlns') { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
} else { ## No prefix |
|
|
if (not defined $namespaceURI) { |
|
|
# |
|
|
} elsif ($namespaceURI eq |
|
|
'http://www.w3.org/2000/xmlns/' and |
|
|
$lname ne 'xmlns') { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
if (defined $namespaceURI and $namespaceURI eq |
|
|
'http://www.w3.org/2000/xmlns/' and |
|
|
|
|
|
($qualifiedName eq 'xmlns' or |
|
|
(defined $prefix and $prefix eq 'xmlns'))) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'create_element_ns', 'http://www.w3.org/2001/04/infoset#prefix' => $prefix, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'qualifiedName', 'http://www.w3.org/2001/04/infoset#localName' => $lname, 'http://www.w3.org/2001/04/infoset#namespaceName' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_OTHER_WITH_XMLNS_URI'; |
|
|
|
|
|
; |
|
|
} |
|
|
} |
|
|
|
|
|
my $bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
my $stem; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$stem = 'Message::DOM::Element::ManakaiDOMElement'->___create_node_stem ($bag, { |
|
867 |
|
|
868 |
'rc' |
if (defined $$self->{manakai_entity_base_uri}) { |
869 |
=> 0, |
return $$self->{manakai_entity_base_uri}; |
|
|
|
|
'id' |
|
|
=> \ |
|
|
( |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
|
|
) |
|
|
, |
|
|
}, { |
|
|
'od' => $self, |
|
|
'ns' => \$namespaceURI, |
|
|
'pfx' => \$prefix, |
|
|
'ln' => \$lname, |
|
|
}); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined 'Message::DOM::Element::ManakaiDOMElement') { |
|
|
if (ref 'Message::DOM::Element::ManakaiDOMElement' eq 'SCALAR') { |
|
|
$stem->{'cls'} = 'Message::DOM::Element::ManakaiDOMElement'; |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}) { |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}; |
|
870 |
} else { |
} else { |
871 |
require Scalar::Util; |
return $$self->{document_uri}; |
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'} = \('Message::DOM::Element::ManakaiDOMElement'); |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMElement'}); |
|
872 |
} |
} |
873 |
} else { |
} # manakai_entity_base_uri |
|
CORE::delete $stem->{'cls'}; |
|
|
} |
|
|
|
|
874 |
|
|
875 |
} |
## TODO: documentation |
876 |
|
sub manakai_has_bom ($;$); |
877 |
|
|
878 |
; |
sub input_encoding ($;$); |
|
$bag->{${$stem->{ |
|
|
'id' |
|
|
}}} = $stem; |
|
879 |
|
|
880 |
|
sub strict_error_checking ($;$) { |
881 |
} |
## NOTE: Same as trivial boolean accessor, except no read-only checking. |
882 |
|
if (@_ > 1) { |
883 |
; |
if ($_[1]) { |
884 |
|
${$_[0]}->{strict_error_checking} = 1; |
885 |
|
} else { |
886 |
{ |
delete ${$_[0]}->{strict_error_checking}; |
|
|
|
|
|
|
|
$r = ${$stem->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> $stem->{ |
|
|
'id' |
|
|
}, |
|
|
|
|
|
'b' |
|
|
=> $bag, |
|
|
}, { |
|
|
}); |
|
|
$stem->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
## Default attributes |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
XDA: |
|
|
{ |
|
|
my $__cfg = $self-> |
|
|
dom_config |
|
|
; |
|
|
last XDA unless $__cfg-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/dtd-default-attribute' |
|
|
); |
|
|
my $__doctype = $self-> |
|
|
doctype |
|
|
; |
|
|
last XDA unless defined $__doctype; |
|
|
$__doctype = $__doctype-> |
|
|
get_feature |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/feature/XDoctype' |
|
|
=> '3.0'); |
|
|
last XDA unless defined $__doctype; |
|
|
my $__et = $__doctype-> |
|
|
get_element_type_definition_node |
|
|
|
|
|
($qualifiedName); |
|
|
if ($__et) { |
|
|
my $__orig_strict = $self-> |
|
|
strict_error_checking |
|
|
; |
|
|
$self-> |
|
|
strict_error_checking |
|
|
( |
|
|
0 |
|
|
); |
|
|
my %__gattr; |
|
|
my %__has_attr; |
|
|
my %__pfx_to_uri; |
|
|
my $__copy_asis = $__cfg-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
|
|
); |
|
|
$__cfg-> |
|
|
set_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
|
|
=> |
|
|
1 |
|
|
); |
|
|
for my $__at (@{$__et-> |
|
|
attribute_definitions |
|
|
}) { |
|
|
my $__at_default = $__at-> |
|
|
default_type |
|
|
; |
|
|
if ($__at_default == |
|
|
'4' or |
|
|
|
|
|
$__at_default == |
|
|
'1' |
|
|
) { |
|
|
my ($__nn1, $__nn2) = split /:/, $__at-> |
|
|
node_name |
|
|
; |
|
|
if (defined $__nn2) { # prefixed |
|
|
if ($__nn1 eq 'xmlns') { |
|
|
## TODO: NCName check, prefix check and NSURI check |
|
|
my $__attr = $self-> |
|
|
create_attribute_ns |
|
|
|
|
|
( |
|
|
'http://www.w3.org/2000/xmlns/' |
|
|
, [$__nn1, $__nn2]); |
|
|
for my $__at_child (@{$__at-> |
|
|
child_nodes |
|
|
}) { |
|
|
$__attr-> |
|
|
append_child |
|
|
|
|
|
($__at_child-> |
|
|
clone_node |
|
|
( |
|
|
1 |
|
|
)); |
|
|
} |
|
|
$__attr-> |
|
|
manakai_attribute_type |
|
|
|
|
|
($__at-> |
|
|
declared_type |
|
|
); |
|
|
my $__nsuri = $__attr-> |
|
|
value |
|
|
; |
|
|
## TODO: Namespace well-formedness check (NSURI), v1.1 chk |
|
|
$__pfx_to_uri{$__nn2} = $__nsuri; |
|
|
$r-> |
|
|
set_attribute_node_ns |
|
|
($__attr); |
|
|
## This method changes |specified| flag |
|
|
$__attr-> |
|
|
specified |
|
|
( |
|
|
0 |
|
|
); |
|
|
$__has_attr{ |
|
|
'http://www.w3.org/2000/xmlns/' |
|
|
}->{$__nn2} = |
|
|
1 |
|
|
; |
|
|
} else { |
|
|
## TODO: NCName check |
|
|
$__gattr{$__nn1}->{$__nn2} = $__at; |
|
|
} |
|
|
} else { # no prefixed |
|
|
my $__attr; |
|
|
if ($__nn1 eq 'xmlns') { |
|
|
$__attr = $self-> |
|
|
create_attribute_ns |
|
|
|
|
|
( |
|
|
'http://www.w3.org/2000/xmlns/' |
|
|
, 'xmlns'); |
|
|
$__has_attr{ |
|
|
'http://www.w3.org/2000/xmlns/' |
|
|
}->{xmlns} = |
|
|
1 |
|
|
; |
|
|
} else { |
|
|
$__attr = $self-> |
|
|
create_attribute_ns |
|
|
|
|
|
( |
|
|
undef |
|
|
, $__nn1); |
|
|
## TODO: NCName check |
|
|
} |
|
|
for my $__at_child (@{$__at-> |
|
|
child_nodes |
|
|
}) { |
|
|
$__attr-> |
|
|
append_child |
|
|
|
|
|
($__at_child-> |
|
|
clone_node |
|
|
( |
|
|
1 |
|
|
)); |
|
|
} |
|
|
$__attr-> |
|
|
manakai_attribute_type |
|
|
|
|
|
($__at-> |
|
|
declared_type |
|
|
); |
|
|
## TODO: Namespace well-formedness check (NSURI) |
|
|
$r-> |
|
|
set_attribute_node_ns |
|
|
($__attr); |
|
|
## This method changes |specified| flag |
|
|
$__attr-> |
|
|
specified |
|
|
( |
|
|
0 |
|
|
); |
|
|
} |
|
|
} |
|
|
} # attrdefs |
|
|
for my $__pfx (keys %__gattr) { |
|
|
my $__nsuri = $__pfx_to_uri{$__pfx}; |
|
|
unless (defined $__nsuri) { |
|
|
## TODO: Namespace well-formedness error |
|
|
} |
|
|
LN: for my $__ln (keys %{$__gattr{$__pfx}}) { |
|
|
if ($__has_attr{defined $__nsuri ? $__nsuri : ''}->{$__ln}) { |
|
|
## TODO: Namespace well-formedness error |
|
|
next LN; |
|
|
} |
|
|
## TODO: NCName check, prefix check and NSURI check |
|
|
my $__at = $__gattr{$__pfx}->{$__ln}; |
|
|
my $__attr = $self-> |
|
|
create_attribute_ns |
|
|
|
|
|
($__nsuri, [$__pfx, $__ln]); |
|
|
for my $__at_child (@{$__at-> |
|
|
child_nodes |
|
|
}) { |
|
|
$__attr-> |
|
|
append_child |
|
|
|
|
|
($__at_child-> |
|
|
clone_node |
|
|
( |
|
|
1 |
|
|
)); |
|
|
} |
|
|
$__attr-> |
|
|
manakai_attribute_type |
|
|
|
|
|
($__at-> |
|
|
declared_type |
|
|
); |
|
|
$r-> |
|
|
set_attribute_node_ns |
|
|
($__attr); |
|
|
## This method changes |specified| flag |
|
|
$__attr-> |
|
|
specified |
|
|
( |
|
|
0 |
|
|
); |
|
|
$__has_attr{defined $__nsuri ? $__nsuri : ''}->{$__ln} = |
|
|
1 |
|
|
; |
|
|
} # LN |
|
|
} # pfx |
|
|
$__cfg-> |
|
|
set_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree' |
|
|
=> $__copy_asis); |
|
|
$self-> |
|
|
strict_error_checking |
|
|
($__orig_strict); |
|
|
} |
|
|
} # XDA |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_attribute ($$) { |
|
|
my ($self, $name) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$strict = $self-> |
|
|
strict_error_checking |
|
|
; |
|
|
if ($strict) { |
|
|
my $version = $self-> |
|
|
xml_version |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined $name) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(((not defined $version or $version eq '1.0') and |
|
|
not |
|
|
($name =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
|
|
) or |
|
|
(defined $version and $version eq '1.1' and |
|
|
not |
|
|
($name =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
|
|
)) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$self-> |
|
|
strict_error_checking |
|
|
( |
|
|
0 |
|
|
); |
|
|
$r = $self-> |
|
|
create_attribute_ns |
|
|
( |
|
|
undef |
|
|
, [ |
|
|
undef |
|
|
, $name]); |
|
|
$self-> |
|
|
strict_error_checking |
|
|
($strict); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_attribute_ns ($$$) { |
|
|
my ($self, $namespaceURI, $qualifiedName) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1144080824:30455:ZO0D78781+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$namespaceURI = undef; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
require |
|
|
Message::DOM::Element; |
|
|
|
|
|
my ($prefix, $lname) = ref $qualifiedName eq 'ARRAY' |
|
|
? @$qualifiedName |
|
|
: split /:/, $qualifiedName, 2; |
|
|
($prefix, $lname) = ( |
|
|
undef |
|
|
, $prefix) unless defined $lname; |
|
|
|
|
|
## TODO: autoload |
|
|
if ((defined $namespaceURI and $namespaceURI eq |
|
|
'http://www.w3.org/XML/1998/namespace' |
|
|
) or |
|
|
($lname =~ /^xml:/)) { |
|
|
require Message::DOM::XML; |
|
|
} |
|
|
|
|
|
if ($self-> |
|
|
strict_error_checking |
|
|
) { |
|
|
my $version = $self-> |
|
|
xml_version |
|
|
; |
|
|
$qualifiedName = defined $prefix ? $prefix.':'.$lname |
|
|
: $lname; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined $version and $version eq '1.1') { |
|
|
unless ( |
|
|
($qualifiedName =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
887 |
} |
} |
888 |
unless ( |
} |
889 |
($qualifiedName =~ /\A\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*(?::\p{InXMLNCNameStartChar11}\p{InXMLNCNameChar11}*)?\z/) |
return ${$_[0]}->{strict_error_checking}; |
890 |
) { |
} # strict_error_checking |
|
|
|
|
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'; |
|
891 |
|
|
892 |
; |
## ISSUE: Setting manakai_is_html true shadows |
893 |
} |
## xml_* properties. Is this desired? |
|
} else { |
|
|
unless ( |
|
|
($qualifiedName =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
|
|
) { |
|
|
|
|
|
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'; |
|
894 |
|
|
895 |
; |
sub xml_encoding ($;$) { |
896 |
|
my $self = $_[0]; |
897 |
|
if (@_ > 1) { |
898 |
|
## NOTE: A manakai extension. |
899 |
|
if ($$self->{strict_error_checking}) { |
900 |
|
if ($$self->{manakai_is_html}) { |
901 |
|
report Message::DOM::DOMException |
902 |
|
-object => $self, |
903 |
|
-type => 'NOT_SUPPORTED_ERR', |
904 |
|
-subtype => 'NON_HTML_OPERATION_ERR'; |
905 |
|
} |
906 |
|
if ($$self->{manakai_read_only}) { |
907 |
|
report Message::DOM::DOMException |
908 |
|
-object => $self, |
909 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
910 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
911 |
|
} |
912 |
} |
} |
913 |
unless ( |
if (defined $_[1]) { |
914 |
($qualifiedName =~ /\A\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*(?::\p{InXML_NCNameStartChar10}\p{InXMLNCNameChar10}*)?\z/) |
$$self->{xml_encoding} = ''.$_[1]; |
915 |
) { |
} else { |
916 |
|
delete $$self->{xml_encoding}; |
|
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'; |
|
|
|
|
|
; |
|
917 |
} |
} |
918 |
} |
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined $prefix) { |
|
|
if (not defined $namespaceURI) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} elsif ($prefix eq 'xml' and $namespaceURI ne |
|
|
'http://www.w3.org/XML/1998/namespace' |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} elsif ($prefix eq 'xmlns' and $namespaceURI ne |
|
|
'http://www.w3.org/2000/xmlns/' |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} elsif ($namespaceURI eq |
|
|
'http://www.w3.org/XML/1998/namespace' and |
|
|
$prefix ne 'xml') { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} elsif ($namespaceURI eq |
|
|
'http://www.w3.org/2000/xmlns/' and |
|
|
$prefix ne 'xmlns') { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
} else { ## No prefix |
|
|
if (not defined $namespaceURI) { |
|
|
# |
|
|
} elsif ($namespaceURI eq |
|
|
'http://www.w3.org/2000/xmlns/' and |
|
|
$lname ne 'xmlns') { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
my $stem; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$stem = 'Message::DOM::Element::ManakaiDOMAttr'->___create_node_stem ($bag, { |
|
|
|
|
|
'rc' |
|
|
=> 0, |
|
919 |
|
|
920 |
'id' |
if ($$self->{manakai_is_html}) { |
921 |
=> \ |
return undef; |
|
( |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
|
|
) |
|
|
, |
|
|
}, { |
|
|
'od' => $self, |
|
|
'ns' => \$namespaceURI, |
|
|
'pfx' => \$prefix, |
|
|
'ln' => \$lname, |
|
|
'specified' => 1, |
|
|
}); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined 'Message::DOM::Element::ManakaiDOMAttr') { |
|
|
if (ref 'Message::DOM::Element::ManakaiDOMAttr' eq 'SCALAR') { |
|
|
$stem->{'cls'} = 'Message::DOM::Element::ManakaiDOMAttr'; |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}) { |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}; |
|
922 |
} else { |
} else { |
923 |
require Scalar::Util; |
return $$self->{xml_encoding}; |
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'} = \('Message::DOM::Element::ManakaiDOMAttr'); |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Element::ManakaiDOMAttr'}); |
|
924 |
} |
} |
925 |
} else { |
} # xml_encoding |
|
CORE::delete $stem->{'cls'}; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$bag->{${$stem->{ |
|
|
'id' |
|
|
}}} = $stem; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
926 |
|
|
927 |
|
sub xml_standalone ($;$) { |
928 |
{ |
my $self = $_[0]; |
929 |
|
if (@_ > 1) { |
930 |
|
if ($$self->{strict_error_checking}) { |
931 |
$r = ${$stem->{ |
if ($$self->{manakai_is_html}) { |
932 |
'cls' |
report Message::DOM::DOMException |
933 |
}}->___create_node_ref ({ |
-object => $self, |
934 |
|
-type => 'NOT_SUPPORTED_ERR', |
935 |
'id' |
-subtype => 'NON_HTML_OPERATION_ERR'; |
936 |
=> $stem->{ |
} |
937 |
'id' |
## NOTE: Not in DOM3. |
938 |
}, |
if ($$self->{manakai_read_only}) { |
939 |
|
report Message::DOM::DOMException |
940 |
'b' |
-object => $self, |
941 |
=> $bag, |
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
942 |
}, { |
-subtype => 'READ_ONLY_NODE_ERR'; |
943 |
}); |
} |
|
$stem->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
## Attribute type information |
|
|
if ((defined $namespaceURI and $namespaceURI eq |
|
|
'http://www.w3.org/XML/1998/namespace' and |
|
|
|
|
|
$lname eq 'id') or |
|
|
(not defined $namespaceURI and $lname eq 'xml:id')) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if |
|
|
($self-> |
|
|
dom_config |
|
|
|
|
|
-> |
|
|
get_parameter |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/dom-config/xml-id' |
|
|
)) { |
|
|
$r-> |
|
|
manakai_attribute_type |
|
|
( |
|
|
'2' |
|
|
); |
|
944 |
} |
} |
945 |
|
if ($_[1]) { |
946 |
|
$$self->{xml_standalone} = 1; |
947 |
|
} else { |
948 |
} |
delete $$self->{xml_standalone}; |
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_text_node ($$) { |
|
|
my ($self, $data) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
my $stem; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$stem = 'Message::DOM::TreeCore::ManakaiDOMText'->___create_node_stem ($bag, { |
|
|
|
|
|
'rc' |
|
|
=> 0, |
|
|
|
|
|
'id' |
|
|
=> \ |
|
|
( |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
|
|
) |
|
|
, |
|
|
}, { |
|
|
'od' => $self, |
|
|
'con' => \$data, |
|
|
}); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined 'Message::DOM::TreeCore::ManakaiDOMText') { |
|
|
if (ref 'Message::DOM::TreeCore::ManakaiDOMText' eq 'SCALAR') { |
|
|
$stem->{'cls'} = 'Message::DOM::TreeCore::ManakaiDOMText'; |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMText'}) { |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMText'}; |
|
|
} else { |
|
|
require Scalar::Util; |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMText'} = \('Message::DOM::TreeCore::ManakaiDOMText'); |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMText'}); |
|
|
} |
|
|
} else { |
|
|
CORE::delete $stem->{'cls'}; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$bag->{${$stem->{ |
|
|
'id' |
|
|
}}} = $stem; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$stem->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> $stem->{ |
|
|
'id' |
|
|
}, |
|
|
|
|
|
'b' |
|
|
=> $bag, |
|
|
}, { |
|
|
}); |
|
|
$stem->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_cdata_section ($$) { |
|
|
my ($self, $data) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
require |
|
|
Message::DOM::XML; |
|
|
my $bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
my $stem; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$stem = 'Message::DOM::XML::ManakaiDOMCDATASection'->___create_node_stem ($bag, { |
|
|
|
|
|
'rc' |
|
|
=> 0, |
|
|
|
|
|
'id' |
|
|
=> \ |
|
|
( |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
|
|
) |
|
|
, |
|
|
}, { |
|
|
'od' => $self, |
|
|
'con' => \$data, |
|
|
}); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined 'Message::DOM::XML::ManakaiDOMCDATASection') { |
|
|
if (ref 'Message::DOM::XML::ManakaiDOMCDATASection' eq 'SCALAR') { |
|
|
$stem->{'cls'} = 'Message::DOM::XML::ManakaiDOMCDATASection'; |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMCDATASection'}) { |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMCDATASection'}; |
|
|
} else { |
|
|
require Scalar::Util; |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMCDATASection'} = \('Message::DOM::XML::ManakaiDOMCDATASection'); |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMCDATASection'}); |
|
|
} |
|
|
} else { |
|
|
CORE::delete $stem->{'cls'}; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$bag->{${$stem->{ |
|
|
'id' |
|
|
}}} = $stem; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$stem->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> $stem->{ |
|
|
'id' |
|
|
}, |
|
|
|
|
|
'b' |
|
|
=> $bag, |
|
|
}, { |
|
|
}); |
|
|
$stem->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_comment ($$) { |
|
|
my ($self, $data) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
my $stem; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$stem = 'Message::DOM::TreeCore::ManakaiDOMComment'->___create_node_stem ($bag, { |
|
|
|
|
|
'rc' |
|
|
=> 0, |
|
|
|
|
|
'id' |
|
|
=> \ |
|
|
( |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
|
|
) |
|
|
, |
|
|
}, { |
|
|
'od' => $self, |
|
|
'con' => \$data, |
|
|
}); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined 'Message::DOM::TreeCore::ManakaiDOMComment') { |
|
|
if (ref 'Message::DOM::TreeCore::ManakaiDOMComment' eq 'SCALAR') { |
|
|
$stem->{'cls'} = 'Message::DOM::TreeCore::ManakaiDOMComment'; |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMComment'}) { |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMComment'}; |
|
|
} else { |
|
|
require Scalar::Util; |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMComment'} = \('Message::DOM::TreeCore::ManakaiDOMComment'); |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::TreeCore::ManakaiDOMComment'}); |
|
|
} |
|
|
} else { |
|
|
CORE::delete $stem->{'cls'}; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$bag->{${$stem->{ |
|
|
'id' |
|
|
}}} = $stem; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$stem->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> $stem->{ |
|
|
'id' |
|
|
}, |
|
|
|
|
|
'b' |
|
|
=> $bag, |
|
|
}, { |
|
|
}); |
|
|
$stem->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_document_fragment ($) { |
|
|
my ($self) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
my $stem; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$stem = 'Message::DOM::Document::ManakaiDOMDocumentFragment'->___create_node_stem ($bag, { |
|
|
|
|
|
'rc' |
|
|
=> 0, |
|
|
|
|
|
'id' |
|
|
=> \ |
|
|
( |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
|
|
) |
|
|
, |
|
|
}, { |
|
|
'od' => $self, |
|
|
}); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined 'Message::DOM::Document::ManakaiDOMDocumentFragment') { |
|
|
if (ref 'Message::DOM::Document::ManakaiDOMDocumentFragment' eq 'SCALAR') { |
|
|
$stem->{'cls'} = 'Message::DOM::Document::ManakaiDOMDocumentFragment'; |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}) { |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}; |
|
|
} else { |
|
|
require Scalar::Util; |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'} = \('Message::DOM::Document::ManakaiDOMDocumentFragment'); |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::Document::ManakaiDOMDocumentFragment'}); |
|
|
} |
|
|
} else { |
|
|
CORE::delete $stem->{'cls'}; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$bag->{${$stem->{ |
|
|
'id' |
|
|
}}} = $stem; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$stem->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> $stem->{ |
|
|
'id' |
|
|
}, |
|
|
|
|
|
'b' |
|
|
=> $bag, |
|
|
}, { |
|
|
}); |
|
|
$stem->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_entity_reference ($$) { |
|
|
my ($self, $name) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
require |
|
|
Message::DOM::XML; |
|
|
our $CreateEntityReference_OpenEntity; |
|
|
## NOTE: Multithread unsafe |
|
|
|
|
|
my $orig_strict = $self-> |
|
|
strict_error_checking |
|
|
; |
|
|
if ($orig_strict) { |
|
|
my $version = $self-> |
|
|
xml_version |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined $name) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(((not defined $version or $version eq '1.0') and |
|
|
not |
|
|
($name =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
|
|
) or |
|
|
(defined $version and $version eq '1.1' and |
|
|
not |
|
|
($name =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
|
|
)) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
949 |
} |
} |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
my $stem; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$stem = 'Message::DOM::XML::ManakaiDOMEntityReference'->___create_node_stem ($bag, { |
|
|
|
|
|
'rc' |
|
|
=> 0, |
|
|
|
|
|
'id' |
|
|
=> \ |
|
|
( |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
|
|
) |
|
|
, |
|
|
}, { |
|
|
'xname' => \$name, |
|
|
'od' => $self, |
|
|
}); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined 'Message::DOM::XML::ManakaiDOMEntityReference') { |
|
|
if (ref 'Message::DOM::XML::ManakaiDOMEntityReference' eq 'SCALAR') { |
|
|
$stem->{'cls'} = 'Message::DOM::XML::ManakaiDOMEntityReference'; |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMEntityReference'}) { |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMEntityReference'}; |
|
|
} else { |
|
|
require Scalar::Util; |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMEntityReference'} = \('Message::DOM::XML::ManakaiDOMEntityReference'); |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMEntityReference'}); |
|
|
} |
|
|
} else { |
|
|
CORE::delete $stem->{'cls'}; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$bag->{${$stem->{ |
|
|
'id' |
|
|
}}} = $stem; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$stem->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> $stem->{ |
|
|
'id' |
|
|
}, |
|
|
|
|
|
'b' |
|
|
=> $bag, |
|
|
}, { |
|
|
}); |
|
|
$stem->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
## Expansion |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
unless |
|
|
($CreateEntityReference_OpenEntity->{$name}) { |
|
|
local $CreateEntityReference_OpenEntity->{$name} = |
|
|
1 |
|
|
; |
|
|
my $__doctype = $self-> |
|
|
doctype |
|
|
; |
|
|
$__doctype = $__doctype-> |
|
|
get_feature |
|
|
|
|
|
( |
|
|
'http://suika.fam.cx/www/2006/feature/XDoctype' |
|
|
=> '3.0') |
|
|
if $__doctype; |
|
|
if ($__doctype) { |
|
|
my $__et = $__doctype-> |
|
|
get_general_entity_node |
|
|
($name); |
|
|
if ($__et) { |
|
|
$self-> |
|
|
strict_error_checking |
|
|
( |
|
|
0 |
|
|
); |
|
|
my @node; |
|
|
for my $c (@{$__et-> |
|
|
child_nodes |
|
|
}) { |
|
|
my $clone = $c-> |
|
|
clone_node |
|
|
( |
|
|
1 |
|
|
); |
|
|
$r-> |
|
|
append_child |
|
|
($clone); |
|
|
push @node, $clone; |
|
|
} |
|
|
$r-> |
|
|
manakai_expanded |
|
|
|
|
|
($__et-> |
|
|
has_replacement_tree |
|
|
); |
|
|
$self-> |
|
|
strict_error_checking |
|
|
($orig_strict); |
|
|
} # entity |
|
|
} # doctype |
|
950 |
} |
} |
|
$r-> |
|
|
manakai_set_read_only |
|
|
( |
|
|
1 |
|
|
, |
|
|
1 |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_processing_instruction ($$$) { |
|
|
my ($self, $target, $data) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
require |
|
|
Message::DOM::XML; |
|
|
|
|
|
if ($self-> |
|
|
strict_error_checking |
|
|
) { |
|
|
my $version = $self-> |
|
|
xml_version |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined $target) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(((not defined $version or $version eq '1.0') and |
|
|
not |
|
|
($target =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) |
|
|
) or |
|
|
(defined $version and $version eq '1.1' and |
|
|
not |
|
|
($target =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) |
|
|
)) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INVALID_CHARACTER_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_BAD_NAME', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#name' => $target, 'http://www.w3.org/2001/04/infoset#version' => $version, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2004/dom/main%23ensureXMLName+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => '$INPUT_PARAM_NAME'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
951 |
|
|
952 |
|
if ($$self->{manakai_is_html}) { |
953 |
; |
return 0; |
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $bag = |
|
|
$self->{'b'} |
|
|
; |
|
|
$data = '' unless defined $data; |
|
|
my $stem; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$stem = 'Message::DOM::XML::ManakaiDOMProcessingInstruction'->___create_node_stem ($bag, { |
|
|
|
|
|
'rc' |
|
|
=> 0, |
|
|
|
|
|
'id' |
|
|
=> \ |
|
|
( |
|
|
'tag:suika.fam.cx,2005-09:' . time . ':' . $$ . ':' . |
|
|
($Message::Util::ManakaiNode::UniqueIDR ||= |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62] . |
|
|
[qw/A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|
a b c d e f g h i j k l m n o p q r s t u v w x y z |
|
|
0 1 2 3 4 5 6 7 8 9/]->[rand 62]) . |
|
|
(++$Message::Util::ManakaiNode::UniqueIDN) |
|
|
) |
|
|
, |
|
|
}, { |
|
|
'target' => \$target, |
|
|
'con' => \$data, |
|
|
'od' => $self, |
|
|
}); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(defined 'Message::DOM::XML::ManakaiDOMProcessingInstruction') { |
|
|
if (ref 'Message::DOM::XML::ManakaiDOMProcessingInstruction' eq 'SCALAR') { |
|
|
$stem->{'cls'} = 'Message::DOM::XML::ManakaiDOMProcessingInstruction'; |
|
|
} elsif (defined $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMProcessingInstruction'}) { |
|
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMProcessingInstruction'}; |
|
954 |
} else { |
} else { |
955 |
require Scalar::Util; |
return $$self->{xml_standalone}; |
|
$stem->{'cls'} = $Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMProcessingInstruction'} = \('Message::DOM::XML::ManakaiDOMProcessingInstruction'); |
|
|
Scalar::Util::weaken ($Message::Util::ManakaiStringRef::Value{'Message::DOM::XML::ManakaiDOMProcessingInstruction'}); |
|
956 |
} |
} |
957 |
} else { |
} # xml_standalone |
|
CORE::delete $stem->{'cls'}; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$bag->{${$stem->{ |
|
|
'id' |
|
|
}}} = $stem; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$stem->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> $stem->{ |
|
|
'id' |
|
|
}, |
|
|
|
|
|
'b' |
|
|
=> $bag, |
|
|
}, { |
|
|
}); |
|
|
$stem->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub strict_error_checking ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = 0; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'chk'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$r = |
|
|
1 unless |
|
|
defined $r; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'chk'} = $given ? 1 : 0; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub dom_config ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = bless [$self, ($self->{'b'}->{${$self->{'id'}}}), 'Message::DOM::IFLatest::Document'], |
|
|
|
|
|
'Message::DOM::DOMCore::ManakaiDOMConfiguration' |
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'dom_config'; |
|
|
} |
|
|
} |
|
|
sub document_element ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
958 |
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
F: |
|
|
for my $child (@{$self-> |
|
|
child_nodes |
|
|
}) { |
|
|
if ($child-> |
|
|
node_type |
|
|
== |
|
|
'1' |
|
|
) { |
|
|
$r = $child; |
|
|
last F; |
|
|
} |
|
|
} # F |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'document_element'; |
|
|
} |
|
|
} |
|
|
sub implementation ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$__v = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'impl'}; |
|
|
if (defined $__v) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$self->{'b'}->{${$__v}}->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> $__v, |
|
|
|
|
|
'b' |
|
|
=> $self->{'b'}, |
|
|
}, { |
|
|
'nrifs' => ['Message::DOM::IFLatest::DOMImplementation'], |
|
|
}); |
|
|
$self->{'b'}->{${$__v}}->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'implementation'; |
|
|
} |
|
|
} |
|
959 |
sub xml_version ($;$) { |
sub xml_version ($;$) { |
960 |
if (@_ == 1) {my ($self) = @_; |
my $self = $_[0]; |
961 |
my $r = ''; |
if (@_ > 1) { |
962 |
|
my $v = ''.$_[1]; |
963 |
{ |
if ($$self->{strict_error_checking}) { |
964 |
|
if ($$self->{manakai_is_html}) { |
965 |
|
report Message::DOM::DOMException |
966 |
{ |
-object => $self, |
967 |
|
-type => 'NOT_SUPPORTED_ERR', |
968 |
|
-subtype => 'NON_HTML_OPERATION_ERR'; |
969 |
$r = $self->{ |
} |
970 |
'b' |
if ($v ne '1.0' and $v ne '1.1') { |
971 |
}->{${$self->{ |
report Message::DOM::DOMException |
972 |
'id' |
-object => $self, |
973 |
}}} |
-type => 'NOT_SUPPORTED_ERR', |
974 |
->{'http://www.w3.org/2001/04/infoset#version'}; |
-subtype => 'UNKNOWN_XML_VERSION_ERR'; |
975 |
|
} |
976 |
|
if ($$self->{manakai_read_only}) { |
977 |
} |
## ISSUE: Not in DOM3. |
978 |
|
report Message::DOM::DOMException |
979 |
; |
-object => $self, |
980 |
$r = '1.0' unless defined $r; |
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
981 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
982 |
|
} |
983 |
} |
} |
984 |
$r; |
$$self->{xml_version} = $v; |
985 |
} else {my ($self, $given) = @_; |
} |
986 |
|
|
987 |
{ |
if (defined wantarray) { |
988 |
|
if ($$self->{manakai_is_html}) { |
989 |
|
return undef; |
990 |
{ |
} elsif (defined $$self->{xml_version}) { |
991 |
|
return $$self->{xml_version}; |
|
if |
|
|
($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
if (defined $given and |
|
|
($given eq '1.0' or $given eq '1.1' or |
|
|
not $self-> |
|
|
strict_error_checking |
|
|
)) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'http://www.w3.org/2001/04/infoset#version'} = $given; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} else { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_NOSUPPORT_XMLVER', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'xml_version', 'http://www.w3.org/2001/04/infoset#version' => $given; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub doctype ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
F: |
|
|
for my $child (@{$self-> |
|
|
child_nodes |
|
|
}) { |
|
|
my $nt = $child-> |
|
|
node_type |
|
|
; |
|
|
if ($nt == |
|
|
'10' |
|
|
) { |
|
|
$r = $child; |
|
|
last F; |
|
|
} elsif ($nt == |
|
|
'1' |
|
|
) { # document element |
|
|
last F; |
|
|
} |
|
|
} # F |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'doctype'; |
|
|
} |
|
|
} |
|
|
sub document_uri ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'duri'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'duri'} = $given; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub input_encoding ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'ces'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'ces'} = $given; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub xml_encoding ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'xcs'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'xcs'} = $given; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub xml_standalone ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = 0; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'http://www.w3.org/2001/04/infoset#standalone'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'http://www.w3.org/2001/04/infoset#standalone'} = $given; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub adopt_node ($$) { |
|
|
my ($self, $source) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
ADOPT: |
|
|
{ |
|
|
last ADOPT |
|
|
unless $source->isa ( |
|
|
'Message::DOM::TreeCore::ManakaiDOMNode' |
|
|
) and |
|
|
|
|
|
$self->{'b'} |
|
|
eq |
|
|
|
|
|
$source->{'b'} |
|
|
; |
|
|
|
|
|
my $strict = $self-> |
|
|
strict_error_checking |
|
|
; |
|
|
if ($strict and $self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'source'; |
|
|
|
|
|
; |
|
|
} |
|
|
my $parent = $source-> |
|
|
parent_node |
|
|
; |
|
|
if ($strict and defined $parent and |
|
|
$parent-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'parent'; |
|
|
|
|
|
; |
|
|
} |
|
|
my $nt = $source-> |
|
|
node_type |
|
|
; |
|
|
my $oe; |
|
|
if ($nt == |
|
|
'2' |
|
|
) { |
|
|
$oe = $source-> |
|
|
owner_element |
|
|
; |
|
|
if ($strict and defined $oe and $oe-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'oe'; |
|
|
|
|
|
; |
|
|
} |
|
|
} elsif ($nt == |
|
|
'9' or |
|
|
|
|
|
$nt == |
|
|
'10' or |
|
|
|
|
|
$nt == |
|
|
'6' or |
|
|
|
|
|
$nt == |
|
|
'12' |
|
|
) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#ADOPT_NODE_TYPE_NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'source'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my @change_od; |
|
|
my @nodes = ($source); |
|
|
while (@nodes) { |
|
|
my $node = shift @nodes; |
|
|
my $nt = $node-> |
|
|
node_type |
|
|
; |
|
|
if ($strict and $node-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOMOD_DESCENDANT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $node; |
|
|
|
|
|
; |
|
|
} |
|
|
if ($nt == |
|
|
'1' |
|
|
) { |
|
|
push @change_od, $node; |
|
|
push @nodes, @{$node-> |
|
|
child_nodes |
|
|
}; |
|
|
my $attrs = $node-> |
|
|
attributes |
|
|
; |
|
|
my $attrsLength = $attrs-> |
|
|
length |
|
|
; |
|
|
for my $i (0..($attrsLength - 1)) { |
|
|
push @nodes, $attrs-> |
|
|
item |
|
|
($i); |
|
|
} |
|
|
} elsif ($nt == |
|
|
'2' or |
|
|
|
|
|
$nt == |
|
|
'5' or |
|
|
|
|
|
$nt == |
|
|
'11' |
|
|
) { |
|
|
push @change_od, $node; |
|
|
push @nodes, @{$node-> |
|
|
child_nodes |
|
|
}; |
|
|
} elsif ($nt == |
|
|
'3' or |
|
|
|
|
|
$nt == |
|
|
'8' or |
|
|
|
|
|
$nt == |
|
|
'7' or |
|
|
|
|
|
$nt == |
|
|
'4' |
|
|
) { |
|
|
push @change_od, $node; |
|
992 |
} else { |
} else { |
993 |
## TODO: assertion |
return '1.0'; |
|
} |
|
|
} # nodes |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if |
|
|
(defined $parent) { |
|
|
$parent-> |
|
|
remove_child |
|
|
($source); |
|
|
} elsif (defined $oe) { |
|
|
$oe-> |
|
|
remove_attribute_node |
|
|
($source); |
|
994 |
} |
} |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
$r = $source; |
|
|
my $old_od = $change_od[0]-> |
|
|
owner_document |
|
|
; |
|
|
## NOTE: The array must have more than zero |
|
|
## nodes by definition. In addition, |
|
|
## it cannot contain document or document |
|
|
## type nodes in current implementation. |
|
|
|
|
|
if ($old_od eq $self) { |
|
|
last ADOPT; |
|
995 |
} |
} |
996 |
|
} # xml_version |
997 |
|
|
998 |
my $old_od_list; |
## |Document| methods |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$old_od_list = $old_od->{ |
|
|
'b' |
|
|
}->{${$old_od->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'do'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
my $new_od_list; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$new_od_list = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'do'}; |
|
|
|
|
999 |
|
|
|
} |
|
|
|
|
|
; |
|
|
for my $n (@change_od) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$n->{ |
|
|
'b' |
|
|
}->{${$n->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'od'} = $self->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
my $nid = |
|
|
$n->{'id'} |
|
|
; |
|
|
CORE::delete $old_od_list->{$$nid}; |
|
|
$new_od_list->{$$nid} = $nid; |
|
|
} |
|
|
|
|
|
for my $src (@change_od) { |
|
|
my $src_ud; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$src_ud = $src->{ |
|
|
'b' |
|
|
}->{${$src->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'ud'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
for my $key (keys %{$src_ud or {}}) { |
|
|
my $dh = $src_ud->{$key}->[1]; |
|
|
if ($dh) { |
|
|
$dh-> |
|
|
handle |
|
|
|
|
|
( |
|
|
'5' |
|
|
, |
|
|
$key, $src_ud->{$key}->[0], $src, |
|
|
undef |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} # ADOPT |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
1000 |
sub get_element_by_id ($$) { |
sub get_element_by_id ($$) { |
1001 |
my ($self, $elementId) = @_; |
local $Error::Depth = $Error::Depth + 1; |
1002 |
my $r; |
my @nodes = @{$_[0]->child_nodes}; |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
@nodes = @{$self-> |
|
|
child_nodes |
|
|
}; |
|
1003 |
N: while (@nodes) { |
N: while (@nodes) { |
1004 |
my $node = shift @nodes; |
my $node = shift @nodes; |
1005 |
next N unless $node-> |
next N unless $node->node_type == 1; # ELEMENT_NODE |
1006 |
node_type |
for my $attr (@{$node->attributes}) { |
1007 |
== |
if ($attr->is_id and $attr->value eq $_[1]) { |
1008 |
'1' |
return $node; |
|
; |
|
|
for my $attr (@{$node-> |
|
|
attributes |
|
|
}) { |
|
|
if ($attr-> |
|
|
is_id and |
|
|
|
|
|
$attr-> |
|
|
value eq |
|
|
$elementId) { |
|
|
$r = $attr; |
|
|
last N; |
|
1009 |
} |
} |
1010 |
} |
} |
1011 |
unshift @nodes, @{$node-> |
unshift @nodes, @{$node->child_nodes}; |
|
child_nodes |
|
|
}; |
|
1012 |
} # N |
} # N |
1013 |
|
return undef; |
1014 |
|
} # get_element_by_id |
1015 |
|
|
1016 |
|
## TODO: HTML5 case normalization |
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
1017 |
sub get_elements_by_tag_name ($$) { |
sub get_elements_by_tag_name ($$) { |
1018 |
my ($self, $name) = @_; |
my $name = ''.$_[1]; |
1019 |
my $r; |
my $chk; |
1020 |
|
if ($name eq '*') { |
1021 |
{ |
$chk = sub () { 1 }; |
|
|
|
|
|
|
|
$name = "$name"; |
|
|
my $chk; |
|
|
if ($name eq '*') { |
|
|
$chk = sub { |
|
|
1 |
|
|
}; |
|
|
} else { |
|
|
$chk = sub { |
|
|
my $node = shift; |
|
|
my $nodeName = $node-> |
|
|
node_name |
|
|
; |
|
|
($nodeName eq $name); |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = bless \[$self, $chk], |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub get_elements_by_tag_name_ns ($$$) { |
|
|
my ($self, $namespaceURI, $localName) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1144080824:30455:ZO0D78781+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$namespaceURI = undef; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$namespaceURI = "$namespaceURI" if defined $namespaceURI; |
|
|
$localName = "$localName"; |
|
|
my $chk; |
|
|
if (not defined $namespaceURI) { |
|
|
if ($localName eq '*') { |
|
|
$chk = sub { |
|
|
my $node = shift; |
|
|
(not defined $node-> |
|
|
namespace_uri |
|
|
); |
|
|
}; |
|
|
} else { |
|
|
$chk = sub { |
|
|
my $node = shift; |
|
|
(not defined $node-> |
|
|
namespace_uri and |
|
|
|
|
|
$node-> |
|
|
local_name eq |
|
|
$localName); |
|
|
}; |
|
|
} |
|
|
} elsif ($namespaceURI eq '*') { |
|
|
if ($localName eq '*') { |
|
|
$chk = sub { |
|
|
1 |
|
|
}; |
|
1022 |
} else { |
} else { |
1023 |
$chk = sub { |
$chk = sub ($) { |
1024 |
my $node = shift; |
return $_[0]->manakai_tag_name eq $name; |
|
($node-> |
|
|
local_name eq |
|
|
$localName); |
|
1025 |
}; |
}; |
1026 |
} |
} |
|
} else { |
|
|
if ($localName eq '*') { |
|
|
$chk = sub { |
|
|
my $node = shift; |
|
|
my $nsuri = $node-> |
|
|
namespace_uri |
|
|
; |
|
|
(defined $nsuri and $nsuri eq $namespaceURI); |
|
|
}; |
|
|
} else { |
|
|
$chk = sub { |
|
|
my $node = shift; |
|
|
my $nsuri = $node-> |
|
|
namespace_uri |
|
|
; |
|
|
(defined $nsuri and $nsuri eq $namespaceURI and |
|
|
$node-> |
|
|
local_name eq |
|
|
$localName); |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = bless \[$self, $chk], |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub import_node ($$;$) { |
|
|
my ($self, $importedNode, $deep) = @_; |
|
|
my $r; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'import_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
|
|
$r} |
|
|
sub normalize_document ($) { |
|
|
my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'normalize_document', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
|
|
} |
|
|
sub rename_node ($$$$) { |
|
|
my ($self, $n, $namespaceURI, $qualifiedName) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1144080824:30455:ZO0D78781+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$namespaceURI = undef; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
my $r; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'rename_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
|
|
$r} |
|
|
sub manakai_entity_base_uri ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'buri'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
unless (defined $r) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'duri'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
1027 |
|
|
1028 |
|
require Message::DOM::NodeList; |
1029 |
|
return bless \[$_[0], $chk], 'Message::DOM::NodeList::GetElementsList'; |
1030 |
|
} # get_elements_by_tag_name |
1031 |
|
|
1032 |
$self->{ |
sub get_elements_by_tag_name_ns ($$$) { |
1033 |
'b' |
my $nsuri = defined $_[1] ? ''.$_[1] : ''; |
1034 |
}->{${$self->{ |
my $lname = ''.$_[2]; |
1035 |
'id' |
my $chk; |
1036 |
}}} |
if ($nsuri eq '*') { |
1037 |
->{'buri'} = $given; |
if ($lname eq '*') { |
1038 |
|
$chk = sub () { 1 }; |
1039 |
|
} else { |
1040 |
} |
$chk = sub ($) { |
1041 |
|
return $_[0]->manakai_local_name eq $lname; |
1042 |
; |
}; |
1043 |
|
} |
1044 |
|
} elsif ($nsuri eq '') { |
1045 |
} |
if ($lname eq '*') { |
1046 |
} |
$chk = sub ($) { |
1047 |
} |
return not defined $_[0]->namespace_uri; |
1048 |
sub all_declarations_processed ($;$) { |
}; |
1049 |
if (@_ == 1) {my ($self) = @_; |
} else { |
1050 |
my $r = 0; |
$chk = sub ($) { |
1051 |
|
return (not defined $_[0]->namespace_uri and |
1052 |
{ |
$_[0]->manakai_local_name eq $lname); |
1053 |
|
}; |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
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'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed'} = $given; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocument>}->{has_feature} = {'core', |
|
|
{'', |
|
|
'1', |
|
|
'1.0', |
|
|
'1', |
|
|
'2.0', |
|
|
'1', |
|
|
'3.0', |
|
|
'1'}, |
|
|
'xml', |
|
|
{'', |
|
|
'1', |
|
|
'1.0', |
|
|
'1', |
|
|
'2.0', |
|
|
'1', |
|
|
'3.0', |
|
|
'1'}, |
|
|
'xmlversion', |
|
|
{'', |
|
|
'1', |
|
|
'1.0', |
|
|
'1', |
|
|
'1.1', |
|
|
'1'}}; |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocument>} = 14.1; |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocument>}->{compat_class}->{q<Message::DOM::Document::ManakaiDOMDocument>} = 1; |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Document::ManakaiDOMDocument>} = {'s1a', |
|
|
['child'], |
|
|
'v1h', |
|
|
['do'], |
|
|
'w0', |
|
|
['impl']}; |
|
|
package Message::DOM::IFLatest::DocumentFragment; |
|
|
our $VERSION = 20060404.0922; |
|
|
package Message::DOM::Document::ManakaiDOMDocumentFragment; |
|
|
our $VERSION = 20060404.0922; |
|
|
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
|
|
'Message::DOM::IF::DocumentFragment', |
|
|
'Message::DOM::IF::Node', |
|
|
'Message::DOM::IFLatest::DocumentFragment', |
|
|
'Message::DOM::IFLatest::Node', |
|
|
'Message::DOM::IFLevel1::DocumentFragment', |
|
|
'Message::DOM::IFLevel1::Node', |
|
|
'Message::DOM::IFLevel2::DocumentFragment', |
|
|
'Message::DOM::IFLevel2::Node', |
|
|
'Message::DOM::IFLevel3::DocumentFragment', |
|
|
'Message::DOM::IFLevel3::Node'; |
|
|
sub ___create_node_stem ($$$$) { |
|
|
my ($self, $bag, $obj, $opt) = @_; |
|
|
my $r = {}; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$obj->{ |
|
|
'child' |
|
|
} = []; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$obj->{'od'} = $opt->{'od'}->{ |
|
|
'id' |
|
|
}; |
|
|
$bag->{${$opt->{'od'}->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'do'}->{${$obj->{ |
|
|
'id' |
|
|
}}} |
|
|
= $obj->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$r = $obj; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub node_type ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
|
$r = '11'; |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
|
|
} |
|
|
} |
|
|
sub append_child ($$) { |
|
|
my ($self, $newChild) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self eq $newChild) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
|
|
|
|
|
; |
|
|
} |
|
|
my $self_od = $self-> |
|
|
owner_document |
|
|
; |
|
|
my $child_od = $newChild-> |
|
|
owner_document |
|
|
; |
|
|
my $child_nt = $newChild-> |
|
|
node_type |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$strict = $self_od-> |
|
|
strict_error_checking |
|
|
; |
|
|
|
|
|
## -- Node Type check |
|
|
my @new_child; |
|
|
if ({ |
|
|
'3' => 1, |
|
|
'5' => 1, |
|
|
'1' => 1, |
|
|
'7' => 1, |
|
|
'4' => 1, |
|
|
'8' => 1, |
|
|
}->{$child_nt}) { |
|
|
push @new_child, $newChild; |
|
|
} elsif ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
for my $cn (@{$newChild-> |
|
|
child_nodes |
|
|
}) { |
|
|
unless ({ |
|
|
'3' => 1, |
|
|
'5' => 1, |
|
|
'1' => 1, |
|
|
'7' => 1, |
|
|
'4' => 1, |
|
|
'8' => 1, |
|
|
}->{$cn-> |
|
|
node_type |
|
|
}) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
push @new_child, $cn; |
|
1054 |
} |
} |
1055 |
} else { |
} else { |
1056 |
|
if ($lname eq '*') { |
1057 |
|
$chk = sub ($) { |
1058 |
{ |
my $ns = $_[0]->namespace_uri; |
1059 |
|
return (defined $ns and $ns eq $nsuri); |
1060 |
local $Error::Depth = $Error::Depth - 1; |
}; |
1061 |
|
} else { |
1062 |
{ |
$chk = sub ($) { |
1063 |
|
my $ns = $_[0]->namespace_uri; |
1064 |
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; |
return (defined $ns and $ns eq $nsuri and |
1065 |
|
$_[0]->manakai_local_name eq $lname); |
1066 |
|
}; |
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
|
|
parent_node |
|
|
: |
|
|
|
|
|
undef |
|
|
; |
|
|
if ($strict) { |
|
|
## -- Wrong-document check |
|
|
unless ($self_od eq $child_od) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
## -- Read-onlyness check |
|
|
if ($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
if (@new_child) { |
|
|
if ($nc_parent and |
|
|
$nc_parent-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
1067 |
} |
} |
1068 |
} |
} |
1069 |
|
|
1070 |
## -- Insert at... |
require Message::DOM::NodeList; |
1071 |
my $index = -1; # last |
return bless \[$_[0], $chk], 'Message::DOM::NodeList::GetElementsList'; |
1072 |
|
} # get_elements_by_tag_name |
1073 |
|
|
1074 |
; # FOR !tc:ForAppendChild |
## TODO: import_node |
1075 |
|
|
1076 |
## -- Removes from parent |
## TODO: normalize_document |
|
if ($nc_parent) { |
|
|
if ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
|
|
1077 |
|
|
1078 |
{ |
## TODO: rename_node |
1079 |
|
|
1080 |
|
## |DocumentTraversal| methods |
1081 |
|
|
1082 |
$newChild->{ |
## TODO: create_node_iterator |
|
'b' |
|
|
}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'} = []; |
|
1083 |
|
|
1084 |
|
sub manakai_create_serial_walker ($$;$$$); |
1085 |
|
|
1086 |
} |
sub create_tree_walker ($$;$$$); |
|
|
|
|
; |
|
|
} else { |
|
|
my $v; |
|
|
|
|
|
|
|
|
{ |
|
1087 |
|
|
1088 |
|
## |DocumentView| attribute |
1089 |
|
|
1090 |
$v = $nc_parent->{ |
sub default_view ($); |
|
'b' |
|
|
}->{${$nc_parent->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
1091 |
|
|
1092 |
|
## |HTMLDocument| attributes |
1093 |
|
|
1094 |
} |
sub compat_mode ($) { |
1095 |
|
if (${$_[0]}->{manakai_is_html}) { |
1096 |
; |
if (defined ${$_[0]}->{manakai_compat_mode} and |
1097 |
RP: for my $i (0..$#$v) { |
${$_[0]}->{manakai_compat_mode} eq 'quirks') { |
1098 |
my $nodeid = $v->[$i]; |
return 'BackCompat'; |
|
if ( |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
|
|
) { |
|
|
splice @$v, $i, 1, (); |
|
|
last RP; |
|
|
} |
|
|
} # RP |
|
1099 |
} |
} |
1100 |
} |
} |
1101 |
|
return 'CSS1Compat'; |
1102 |
|
} # compat_mode |
1103 |
|
|
1104 |
## -- Rewrite the |parentNode| properties |
sub manakai_compat_mode ($;$) { |
1105 |
for my $nc (@new_child) { |
if (${$_[0]}->{manakai_is_html}) { |
1106 |
|
if (@_ > 1 and defined $_[1] and |
1107 |
|
{'no quirks' => 1, 'limited quirks' => 1, 'quirks' => 1}->{$_[1]}) { |
1108 |
{ |
${$_[0]}->{manakai_compat_mode} = $_[1]; |
|
|
|
|
|
|
|
$nc->{ |
|
|
'b' |
|
|
}->{${$nc->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'} = $self->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $children; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$children = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
## -- Adds to children list |
|
|
push @$children, map { |
|
|
|
|
|
$_->{'id'} |
|
|
|
|
|
} @new_child; |
|
|
$r = $newChild; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub insert_before ($$;$) { |
|
|
my ($self, $newChild, $refChild) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self eq $newChild) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
|
|
|
|
|
; |
|
|
} |
|
|
my $self_od = $self-> |
|
|
owner_document |
|
|
; |
|
|
my $child_od = $newChild-> |
|
|
owner_document |
|
|
; |
|
|
my $child_nt = $newChild-> |
|
|
node_type |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$strict = $self_od-> |
|
|
strict_error_checking |
|
|
; |
|
|
|
|
|
## -- Node Type check |
|
|
my @new_child; |
|
|
if ({ |
|
|
'3' => 1, |
|
|
'5' => 1, |
|
|
'1' => 1, |
|
|
'7' => 1, |
|
|
'4' => 1, |
|
|
'8' => 1, |
|
|
}->{$child_nt}) { |
|
|
push @new_child, $newChild; |
|
|
} elsif ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
for my $cn (@{$newChild-> |
|
|
child_nodes |
|
|
}) { |
|
|
unless ({ |
|
|
'3' => 1, |
|
|
'5' => 1, |
|
|
'1' => 1, |
|
|
'7' => 1, |
|
|
'4' => 1, |
|
|
'8' => 1, |
|
|
}->{$cn-> |
|
|
node_type |
|
|
}) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
push @new_child, $cn; |
|
1109 |
} |
} |
1110 |
|
return ${$_[0]}->{manakai_compat_mode} || 'no quirks'; |
1111 |
} else { |
} else { |
1112 |
|
return 'no quirks'; |
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
1113 |
} |
} |
1114 |
|
} # manakai_compat_mode |
1115 |
|
|
1116 |
my $nc_parent = @new_child ? $new_child[0]-> |
sub inner_html ($;$) { |
1117 |
parent_node |
my $self = $_[0]; |
1118 |
: |
local $Error::Depth = $Error::Depth + 1; |
1119 |
|
|
1120 |
undef |
if ($$self->{manakai_is_html}) { |
1121 |
; |
require Whatpm::HTML; |
1122 |
if ($strict) { |
if (@_ > 1) { |
1123 |
## -- Wrong-document check |
## Step 1 |
1124 |
unless ($self_od eq $child_od) { |
## TODO: Stop parsing and ... |
1125 |
|
|
1126 |
|
## Step 2 |
1127 |
|
my @cn = @{$self->child_nodes}; |
1128 |
|
for (@cn) { ## NOTE: Might throw a |NO_MODIFICATION_ALLOWED_ERR|. |
1129 |
|
$self->remove_child ($_); # |
1130 |
|
} |
1131 |
|
|
1132 |
{ |
## Step 3, 4, 5 |
1133 |
|
Whatpm::HTML->parse_string ($_[1] => $self); |
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
1134 |
|
|
1135 |
;} |
## TODO: |
1136 |
|
## <script>var input = function_to_do_xmlhttprequest (location.href); |
1137 |
|
## document.innerHTML = input</script> |
1138 |
|
|
1139 |
; |
return unless defined wantarray; |
1140 |
} |
} |
1141 |
|
|
1142 |
## -- Read-onlyness check |
require Whatpm::HTML::Serializer; |
1143 |
if ($self-> |
return ${ Whatpm::HTML::Serializer->get_inner_html ($self) }; |
1144 |
manakai_read_only |
} else { |
1145 |
) { |
if (@_ > 1) { |
1146 |
|
## Step 1 |
1147 |
|
require Whatpm::XMLParser; # MUST |
1148 |
|
my $doc = $self->implementation->create_document; |
1149 |
|
|
1150 |
|
## Step 2 |
1151 |
|
# |
1152 |
|
|
1153 |
{ |
## Step 3 |
1154 |
|
$doc = Whatpm::XMLParser->parse_string ($_[1] => $doc); # MUST |
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
1155 |
|
|
1156 |
|
## Step 4 |
1157 |
|
# |
1158 |
|
|
1159 |
;} |
## Step 5 |
1160 |
|
## TODO: ill-formed -> SYNTAX_ERR # MUST |
1161 |
|
|
1162 |
; |
## Step 6 # MUST |
1163 |
} |
my @cn = @{$self->child_nodes}; ## TODO: If read-only |
1164 |
if (@new_child) { |
for (@cn) { |
1165 |
if ($nc_parent and |
$self->remove_child ($_); |
|
$nc_parent-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
1166 |
} |
} |
|
} |
|
|
} |
|
|
|
|
|
## -- Insert at... |
|
|
my $index = -1; # last |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
|
|
if (defined $refChild) { |
|
|
if ($refChild eq $newChild) { |
|
|
|
|
|
|
|
|
{ |
|
1167 |
|
|
1168 |
|
## Step 7, 8, 9, 10 |
1169 |
{ |
for my $node (@{$doc->child_nodes}) { |
1170 |
|
$self->append_child ($self->adopt_node ($node)); |
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
; |
|
1171 |
} |
} |
1172 |
|
|
1173 |
my $cns = $self-> |
return unless defined wantarray; |
|
child_nodes |
|
|
; |
|
|
my $cnsl = @$cns; |
|
|
C: { |
|
|
$index = 0; |
|
|
for my $i (0..($cnsl-1)) { |
|
|
my $cn = $cns->[$i]; |
|
|
if ($cn eq $refChild) { |
|
|
$index += $i; |
|
|
last C; |
|
|
} elsif ($cn eq $newChild) { |
|
|
$index = -1; # offset |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
; |
|
|
} # C |
|
|
} else { # |oldChild| is not defined |
|
|
|
|
|
|
|
|
; |
|
1174 |
} |
} |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; # FOR !tc:ForAppendChild |
|
|
|
|
|
## -- Removes from parent |
|
|
if ($nc_parent) { |
|
|
if ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$newChild->{ |
|
|
'b' |
|
|
}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'} = []; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} else { |
|
|
my $v; |
|
|
|
|
|
|
|
|
{ |
|
1175 |
|
|
1176 |
|
## TODO: This serializer is currently not conformant to HTML5 spec. |
1177 |
$v = $nc_parent->{ |
require Whatpm::XMLSerializer; |
1178 |
'b' |
my $r = ''; |
1179 |
}->{${$nc_parent->{ |
for (@{$self->child_nodes}) { |
1180 |
'id' |
$r .= ${ Whatpm::XMLSerializer->get_outer_xml ($_, sub { |
1181 |
}}} |
## TODO: INVALID_STATE_ERR |
1182 |
->{'child'}; |
}) }; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
RP: for my $i (0..$#$v) { |
|
|
my $nodeid = $v->[$i]; |
|
|
if ( |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
|
|
) { |
|
|
splice @$v, $i, 1, (); |
|
|
last RP; |
|
|
} |
|
|
} # RP |
|
1183 |
} |
} |
1184 |
|
return $r; |
1185 |
} |
} |
1186 |
|
} # inner_html |
1187 |
|
|
1188 |
## -- Rewrite the |parentNode| properties |
sub manakai_is_html ($;$) { |
1189 |
for my $nc (@new_child) { |
if (@_ > 1) { |
1190 |
|
if ($_[1]) { |
1191 |
|
${$_[0]}->{manakai_is_html} = 1; |
|
{ |
|
|
|
|
|
|
|
|
$nc->{ |
|
|
'b' |
|
|
}->{${$nc->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'} = $self->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $children; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$children = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
## -- Adds to children list |
|
|
if ($index == -1) { |
|
|
push @$children, map { |
|
|
|
|
|
$_->{'id'} |
|
|
|
|
|
} @new_child; |
|
1192 |
} else { |
} else { |
1193 |
splice @$children, $index, 0, map { |
delete ${$_[0]}->{manakai_is_html}; |
1194 |
|
delete ${$_[0]}->{manakai_compat_mode}; |
|
$_->{'id'} |
|
|
|
|
|
} @new_child; |
|
1195 |
} |
} |
|
$r = $newChild; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub replace_child ($$$) { |
|
|
my ($self, $newChild, $oldChild) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($self eq $newChild) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
|
|
|
|
|
; |
|
|
} |
|
|
my $self_od = $self-> |
|
|
owner_document |
|
|
; |
|
|
my $child_od = $newChild-> |
|
|
owner_document |
|
|
; |
|
|
my $child_nt = $newChild-> |
|
|
node_type |
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$strict = $self_od-> |
|
|
strict_error_checking |
|
|
; |
|
|
|
|
|
## -- Node Type check |
|
|
my @new_child; |
|
|
if ({ |
|
|
'3' => 1, |
|
|
'5' => 1, |
|
|
'1' => 1, |
|
|
'7' => 1, |
|
|
'4' => 1, |
|
|
'8' => 1, |
|
|
}->{$child_nt}) { |
|
|
push @new_child, $newChild; |
|
|
} elsif ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
for my $cn (@{$newChild-> |
|
|
child_nodes |
|
|
}) { |
|
|
unless ({ |
|
|
'3' => 1, |
|
|
'5' => 1, |
|
|
'1' => 1, |
|
|
'7' => 1, |
|
|
'4' => 1, |
|
|
'8' => 1, |
|
|
}->{$cn-> |
|
|
node_type |
|
|
}) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
push @new_child, $cn; |
|
|
} |
|
|
} else { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
1196 |
} |
} |
1197 |
|
return ${$_[0]}->{manakai_is_html}; |
1198 |
|
} # manakai_is_html |
1199 |
|
|
1200 |
my $nc_parent = @new_child ? $new_child[0]-> |
package Message::IF::Document; |
1201 |
parent_node |
package Message::IF::DocumentTraversal; |
1202 |
: |
package Message::IF::DocumentXDoctype; |
1203 |
|
package Message::IF::DocumentSelector; |
1204 |
undef |
package Message::IF::HTMLDocument; |
|
; |
|
|
if ($strict) { |
|
|
## -- Wrong-document check |
|
|
unless ($self_od eq $child_od) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
## -- Read-onlyness check |
|
|
if ($self-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
1205 |
|
|
1206 |
;} |
package Message::DOM::DOMImplementation; |
1207 |
|
|
1208 |
; |
sub create_document ($;$$$) { |
1209 |
} |
my $r = Message::DOM::Document->____new ($_[0]); |
|
if (@new_child) { |
|
|
if ($nc_parent and |
|
|
$nc_parent-> |
|
|
manakai_read_only |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
1210 |
|
|
1211 |
|
if (defined $_[2]) { |
1212 |
} |
local $Error::Depth = $Error::Depth + 1; |
1213 |
|
$r->append_child ($r->create_element_ns ($_[1], $_[2])); # NAMESPACE_ERR |
1214 |
|
## NOTE: manakai might raise DOMExceptions in cases not defined |
1215 |
;} |
## in DOM3Core spec: XMLNSPREFIX_NONXMLNSNS_ERR, |
1216 |
|
## XMLNS_NONXMLNSNS_ERR, and NONXMLNSPREFIX_XMLNSNS_ERR. |
1217 |
; |
} elsif (defined $_[1]) { |
1218 |
} |
report Message::DOM::DOMException |
1219 |
} |
-object => $_[0], |
1220 |
|
-type => 'NAMESPACE_ERR', |
1221 |
|
-subtype => 'QNAME_NULLNS_ERR'; |
1222 |
} |
} |
1223 |
|
|
1224 |
## -- Insert at... |
if (defined $_[3]) { |
1225 |
my $index = -1; # last |
if ($_[3]->parent_node) { |
1226 |
|
report Message::DOM::DOMException |
1227 |
|
-object => $_[0], |
1228 |
{ |
-type => 'WRONG_DOCUMENT_ERR', |
1229 |
|
-subtype => 'INUSE_DOCTYPE_ERR'; |
|
|
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
|
|
if (defined $oldChild) { |
|
|
if ($oldChild eq $newChild) { |
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $cns = $self-> |
|
|
child_nodes |
|
|
; |
|
|
my $cnsl = @$cns; |
|
|
C: { |
|
|
$index = 0; |
|
|
for my $i (0..($cnsl-1)) { |
|
|
my $cn = $cns->[$i]; |
|
|
if ($cn eq $oldChild) { |
|
|
$index += $i; |
|
|
last C; |
|
|
} elsif ($cn eq $newChild) { |
|
|
$index = -1; # offset |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} # C |
|
|
} else { # |oldChild| is not defined |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth - 1; |
|
|
|
|
|
{ |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; # FOR !tc:ForAppendChild |
|
|
|
|
|
## -- Removes from parent |
|
|
if ($nc_parent) { |
|
|
if ($child_nt == |
|
|
'11' |
|
|
) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$newChild->{ |
|
|
'b' |
|
|
}->{${$newChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'} = []; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} else { |
|
|
my $v; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$v = $nc_parent->{ |
|
|
'b' |
|
|
}->{${$nc_parent->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
RP: for my $i (0..$#$v) { |
|
|
my $nodeid = $v->[$i]; |
|
|
if ( |
|
|
(${$new_child[0]->{'id'}} eq ${$nodeid}) |
|
|
) { |
|
|
splice @$v, $i, 1, (); |
|
|
last RP; |
|
|
} |
|
|
} # RP |
|
1230 |
} |
} |
1231 |
|
local $Error::Depth = $Error::Depth + 1; |
1232 |
|
$r->insert_before ($_[3], $r->first_child); # EXTERNAL_OBJECT_ERR |
1233 |
} |
} |
1234 |
|
|
1235 |
## -- Rewrite the |parentNode| properties |
return $r; |
1236 |
for my $nc (@new_child) { |
} # create_document |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$nc->{ |
|
|
'b' |
|
|
}->{${$nc->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'} = $self->{ |
|
|
'id' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $children; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$children = $self->{ |
|
|
'b' |
|
|
}->{${$self->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'child'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
## -- Replaces the node |
|
|
splice @$children, $index, 1, map { |
|
|
|
|
|
$_->{'id'} |
|
|
|
|
|
} @new_child; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
CORE::delete |
|
|
$oldChild->{ |
|
|
'b' |
|
|
}->{${$oldChild->{ |
|
|
'id' |
|
|
}}} |
|
|
->{'parent'}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
$r = $oldChild; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub node_name ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
$r = '#document-fragment'; |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
|
|
} |
|
|
} |
|
|
sub manakai_append_text ($$) { |
|
|
my ($self, $string) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$lc = $self-> |
|
|
last_child |
|
|
; |
|
|
if (defined $lc and |
|
|
$lc-> |
|
|
node_type |
|
|
== |
|
|
'3' |
|
|
) { |
|
|
$lc-> |
|
|
manakai_append_text |
|
|
|
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
|
|
} else { |
|
|
my $text = $self-> |
|
|
owner_document |
|
|
|
|
|
-> |
|
|
create_text_node |
|
|
|
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
|
|
$self-> |
|
|
append_child |
|
|
($text); |
|
|
} |
|
|
$r = $self; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub get_feature ($$$) { |
|
|
my ($self, $feature, $version) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$feature = lc $feature; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$version = '' unless defined $version; |
|
|
|
|
|
|
|
|
} |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$feature =~ s/^\+//; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($Message::DOM::DOMFeature::ClassInfo->{ref $self} |
|
|
->{has_feature}->{$feature}->{$version}) { |
|
|
$r = $self; |
|
|
} else { |
|
|
CLASS: for my $__class (sort { |
|
|
$Message::DOM::ClassPoint{$b} <=> $Message::DOM::ClassPoint{$a} |
|
|
} grep { |
|
|
$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Document::ManakaiDOMDocumentFragment'} |
|
|
->{compat_class}->{$_} |
|
|
} keys %{$Message::DOM::DOMFeature::ClassInfo->{'Message::DOM::Document::ManakaiDOMDocumentFragment'} |
|
|
->{compat_class} or {}}) { |
|
|
if ($Message::DOM::DOMFeature::ClassInfo->{$__class} |
|
|
->{has_feature}->{$feature}->{$version}) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${($self->{'b'})->{${($self->{'id'})}}->{ |
|
|
'cls' |
|
|
}}->___create_node_ref ({ |
|
|
|
|
|
'id' |
|
|
=> ($self->{'id'}), |
|
|
|
|
|
'b' |
|
|
=> ($self->{'b'}), |
|
|
}, { |
|
|
'nrcls' => \$__class, |
|
|
}); |
|
|
($self->{'b'})->{${($self->{'id'})}}->{ |
|
|
'rc' |
|
|
}++; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
last CLASS; |
|
|
} |
|
|
} # CLASS |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
unless (defined $r) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub base_uri ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$r = $self-> |
|
|
owner_document |
|
|
-> |
|
|
base_uri |
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
1237 |
|
|
1238 |
|
=head1 LICENSE |
1239 |
|
|
1240 |
;} |
Copyright 2007 Wakaba <w@suika.fam.cx> |
1241 |
|
|
1242 |
; |
This program is free software; you can redistribute it and/or |
1243 |
|
modify it under the same terms as Perl itself. |
1244 |
|
|
1245 |
|
=cut |
1246 |
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self) = @_; |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
|
|
} |
|
|
} |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>}->{has_feature} = {'core', |
|
|
{'', |
|
|
'1', |
|
|
'1.0', |
|
|
'1', |
|
|
'2.0', |
|
|
'1', |
|
|
'3.0', |
|
|
'1'}, |
|
|
'xml', |
|
|
{'', |
|
|
'1', |
|
|
'1.0', |
|
|
'1', |
|
|
'2.0', |
|
|
'1', |
|
|
'3.0', |
|
|
'1'}, |
|
|
'xmlversion', |
|
|
{'', |
|
|
'1', |
|
|
'1.0', |
|
|
'1', |
|
|
'1.1', |
|
|
'1'}}; |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = 14.1; |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>}->{compat_class}->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = 1; |
|
|
$Message::Util::Grove::ClassProp{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = {'s1a', |
|
|
['child'], |
|
|
'w0', |
|
|
['od']}; |
|
|
for ($Message::DOM::IF::Document::, $Message::DOM::IF::DocumentFragment::, $Message::DOM::IF::Node::, $Message::DOM::IFLatest::Node::, $Message::DOM::IFLevel1::Document::, $Message::DOM::IFLevel1::DocumentFragment::, $Message::DOM::IFLevel1::Node::, $Message::DOM::IFLevel2::Document::, $Message::DOM::IFLevel2::DocumentFragment::, $Message::DOM::IFLevel2::Node::, $Message::DOM::IFLevel3::Document::, $Message::DOM::IFLevel3::DocumentFragment::, $Message::DOM::IFLevel3::Node::){} |
|
|
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
|
1247 |
1; |
1; |
1248 |
|
## $Date$ |