62 |
sub DOCUMENT_POSITION_CONTAINED_BY () { 0x10 } |
sub DOCUMENT_POSITION_CONTAINED_BY () { 0x10 } |
63 |
sub DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC () { 0x20 } |
sub DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC () { 0x20 } |
64 |
|
|
65 |
|
## TODO: Define |UserDataHandler| Perl bindig |
66 |
|
## OperationType |
67 |
|
sub NODE_CLONED () { 1 } |
68 |
|
sub NODE_IMPORTED () { 2 } |
69 |
|
sub NODE_DELETED () { 3 } |
70 |
|
sub NODE_RENAMED () { 4 } |
71 |
|
sub NODE_ADOPTED () { 5 } |
72 |
|
|
73 |
sub ____new ($$) { |
sub ____new ($$) { |
74 |
my $self = bless \({}), shift; |
my $self = bless \({}), shift; |
75 |
$$self->{owner_document} = shift; |
$$self->{owner_document} = shift; |
146 |
return $$self->{child_nodes} ? $$self->{child_nodes}->[0] : undef; |
return $$self->{child_nodes} ? $$self->{child_nodes}->[0] : undef; |
147 |
} # first_child |
} # first_child |
148 |
|
|
149 |
|
sub manakai_language ($;$) { |
150 |
|
my $self = $_[0]; |
151 |
|
|
152 |
|
if (@_ > 1) { |
153 |
|
local $Error::Depth = $Error::Depth + 1; |
154 |
|
if ($self->node_type == 1) { # ELEMENT_NODE |
155 |
|
if (defined $_[1]) { |
156 |
|
if ($self->has_attribute_ns (undef, 'xml:lang')) { |
157 |
|
$self->set_attribute_ns (undef, [undef, 'xml:lang'] => $_[1]); |
158 |
|
# or exception |
159 |
|
} else { |
160 |
|
$self->set_attribute_ns |
161 |
|
(q<http://www.w3.org/XML/1998/namespace>, 'xml:lang', $_[1]); |
162 |
|
} |
163 |
|
} else { |
164 |
|
$self->remove_attribute_ns |
165 |
|
(q<http://www.w3.org/XML/1998/namespace>, 'lang'); |
166 |
|
$self->remove_attribute_ns (undef, 'xml:lang'); |
167 |
|
} |
168 |
|
} |
169 |
|
|
170 |
|
return undef unless defined wantarray; |
171 |
|
} |
172 |
|
|
173 |
|
my $target = $self; |
174 |
|
while (defined $target) { |
175 |
|
if ($target->node_Type == 1) { # ELEMENT_NODE |
176 |
|
my $r = $target->get_attribute_ns |
177 |
|
(q<http://www.w3.org/XML/1998/namespace>, 'lang'); |
178 |
|
return $r if defined $r; |
179 |
|
|
180 |
|
$r = $target->get_attribute_ns (undef, 'xml:lang'); |
181 |
|
return $r if defined $r; |
182 |
|
} |
183 |
|
|
184 |
|
$target = $target->parent_node; |
185 |
|
} |
186 |
|
|
187 |
|
## TODO: from ownerDocument |
188 |
|
## TODO: from upper-level protocol |
189 |
|
|
190 |
|
## TODO: Documentation |
191 |
|
|
192 |
|
return ''; |
193 |
|
} # manakai_language |
194 |
|
|
195 |
sub last_child ($) { |
sub last_child ($) { |
196 |
my $self = shift; |
my $self = shift; |
197 |
return $$self->{child_nodes} && $$self->{child_nodes}->[0] |
return $$self->{child_nodes} && $$self->{child_nodes}->[0] |