1 |
#!/usr/bin/perl |
## NOTE: This module will be renamed as CharacterData.pm |
|
## This file is automatically generated |
|
|
## at 2006-12-31T09:31:48+00:00, |
|
|
## from file "../lib/Message/DOM/CharacterData.dis", |
|
|
## module <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.CharacterData>. |
|
|
## Don't edit by hand! |
|
|
use strict; |
|
|
require Message::DOM::DOMCore; |
|
|
require Message::DOM::Document; |
|
|
require Message::DOM::TreeCore; |
|
|
require Message::Util::Error::DOMException; |
|
|
package Message::DOM::CharacterData; |
|
|
our $VERSION = 20061231.0931; |
|
|
package Message::DOM::CharacterData::ManakaiDOMDocumentCharacterData; |
|
|
our $VERSION = 20061231.0931; |
|
|
push @Message::DOM::Document::ManakaiDOMDocument::ISA, q<Message::DOM::CharacterData::ManakaiDOMDocumentCharacterData> unless Message::DOM::Document::ManakaiDOMDocument->isa (q<Message::DOM::CharacterData::ManakaiDOMDocumentCharacterData>); |
|
|
sub create_text_node ($$) { |
|
|
my ($self, $data) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = bless \{ |
|
|
|
|
|
'od' |
|
|
=> $self, |
|
|
|
|
|
'con' |
|
|
=> \$data, |
|
|
}, |
|
|
'Message::DOM::CharacterData::ManakaiDOMText' |
|
|
; |
|
|
Scalar::Util::weaken ($$r->{ |
|
|
'od' |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub create_comment ($$) { |
|
|
my ($self, $data) = @_; |
|
|
my $r; |
|
2 |
|
|
3 |
{ |
package Message::DOM::CharacterData; |
4 |
|
use strict; |
5 |
|
our $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
6 |
$r = bless \{ |
push our @ISA, 'Message::DOM::Node', 'Message::IF::CharacterData'; |
7 |
|
require Message::DOM::Node; |
|
'od' |
|
|
=> $self, |
|
|
|
|
|
'con' |
|
|
=> \$data, |
|
|
}, |
|
|
'Message::DOM::CharacterData::ManakaiDOMComment' |
|
|
; |
|
|
Scalar::Util::weaken ($$r->{ |
|
|
'od' |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::CharacterData::ManakaiDOMDocumentCharacterData>}->{has_feature} = {}; |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::CharacterData::ManakaiDOMDocumentCharacterData>} = 0; |
|
|
package Message::DOM::IF::CharacterData; |
|
|
our $VERSION = 20061231.0931; |
|
|
package Message::DOM::CharacterData::ManakaiDOMCharacterData; |
|
|
our $VERSION = 20061231.0931; |
|
|
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
|
|
'Message::DOM::IF::CharacterData', |
|
|
'Message::DOM::IF::Node', |
|
|
'Message::DOM::IF::StringExtended'; |
|
8 |
use Message::Util::Error; |
use Message::Util::Error; |
|
sub child_nodes ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
9 |
|
|
10 |
{ |
sub ____new ($$$) { |
11 |
|
my $self = shift->SUPER::____new (shift); |
12 |
|
$$self->{data} = ''.(ref $_[0] eq 'SCALAR' ? ${$_[0]} : $_[0]); |
13 |
|
return $self; |
14 |
|
} # ____new |
15 |
|
|
16 |
|
## |Node| attributes |
17 |
|
|
18 |
|
sub base_uri ($) { |
19 |
|
## NOTE: Same as |EntityReference|'s. |
20 |
|
|
21 |
|
my $self = $_[0]; |
22 |
|
local $Error::Depth = $Error::Depth + 1; |
23 |
|
my $pe = $$self->{parent_node}; |
24 |
|
while (defined $pe) { |
25 |
|
my $nt = $pe->node_type; |
26 |
|
if ($nt == 1 or $nt == 2 or $nt == 6 or $nt == 9 or $nt == 11) { |
27 |
|
## Element, Attr, Entity, Document, or DocumentFragment |
28 |
|
return $pe->base_uri; |
29 |
|
} elsif ($nt == 5) { |
30 |
|
## EntityReference |
31 |
|
return $pe->manakai_entity_base_uri if $pe->manakai_external; |
32 |
|
} |
33 |
|
$pe = $$pe->{parent_node}; |
34 |
|
} |
35 |
|
return $pe->base_uri if $pe; |
36 |
|
return $$self->{owner_document}->base_uri; |
37 |
|
} # base_uri |
38 |
|
|
39 |
|
sub child_nodes ($) { |
40 |
|
require Message::DOM::NodeList; |
41 |
|
return bless \\($_[0]), 'Message::DOM::NodeList::EmptyNodeList'; |
42 |
|
} # child_nodes |
43 |
|
|
44 |
{ |
## |CDATASection|: |
45 |
|
## The content of the CDATA section [DOM1, DOM2, DOM3]. |
46 |
|
## Same as |CharacterData.data| [DOM3]. |
47 |
|
|
48 |
|
## |Comment|: |
49 |
|
## The content of the comment [DOM1, DOM2, DOM3]. |
50 |
|
## Same as |CharacterData.data| [DOM3]. |
51 |
|
|
52 |
$r = bless [], |
## |Text|: |
53 |
'Message::DOM::TreeCore::ManakaiDOMEmptyNodeList' |
## The content of the text node [DOM1, DOM2, DOM3]. |
54 |
; |
## Same as |CharacterData.data| [DOM3]. |
55 |
|
|
56 |
|
*node_value = \&data; # For |CDATASection|, |Comment|, and |Text|. |
57 |
|
|
58 |
} |
## ISSUE: DOM3 Core does not explicitly say setting |null| |
59 |
|
## on read-only node is ignored. Strictly speaking, it does not even |
60 |
|
## say what the setter does for |CharacterData| and PI nodes. |
61 |
|
## What if setting |null| to non read-only |CharacterData| or PI? |
62 |
|
|
63 |
; |
*text_content = \&node_value; # For |CDATASection|, |Comment|, and |Text|. |
64 |
|
|
65 |
|
## |Node| methods |
66 |
|
|
|
} |
|
|
$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::CharacterData::ManakaiDOMCharacterData', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'child_nodes'; |
|
|
} |
|
|
} |
|
67 |
sub append_child ($$) { |
sub append_child ($$) { |
68 |
my ($self, $newChild) = @_; |
report Message::DOM::DOMException |
69 |
my $r; |
-object => $_[0], |
70 |
|
-type => 'HIERARCHY_REQUEST_ERR', |
71 |
{ |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
72 |
|
} # append_child |
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::CharacterData::ManakaiDOMCharacterData', '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; |
|
73 |
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub insert_before ($$;$) { |
|
|
my ($self, $newChild, $refChild) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::CharacterData::ManakaiDOMCharacterData', '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; |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub replace_child ($$$) { |
|
|
my ($self, $newChild, $oldChild) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::CharacterData::ManakaiDOMCharacterData', '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; |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
74 |
sub manakai_append_text ($$) { |
sub manakai_append_text ($$) { |
75 |
my ($self, $string) = @_; |
## NOTE: Same as |ProcessingInstruction|'s. |
76 |
my $r; |
if (${${$_[0]}->{owner_document}}->{strict_error_checking} and |
77 |
|
${$_[0]}->{manakai_read_only}) { |
78 |
{ |
report Message::DOM::DOMException |
79 |
|
-object => $_[0], |
80 |
|
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
81 |
{ |
-subtype => 'READ_ONLY_NODE_ERR'; |
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if |
|
|
($self-> |
|
|
owner_document |
|
|
|
|
|
-> |
|
|
strict_error_checking and |
|
|
|
|
|
$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#method' => 'manakai_append_text', 'http://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::CharacterData::ManakaiDOMCharacterData'; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
82 |
} |
} |
83 |
my $v = $$self->{ |
${$_[0]}->{data} .= ref $_[1] eq 'SCALAR' ? ${$_[1]} : $_[1]; |
84 |
'con' |
} # manakai_append_text |
|
}; |
|
|
$$v .= ref $string eq 'SCALAR' ? $$string : $string; |
|
|
$r = $self; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub node_value ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$$self->{ |
|
|
'con' |
|
|
}}; |
|
|
|
|
|
|
|
|
} |
|
|
$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' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
my $v = $$self->{ |
|
|
'con' |
|
|
}; |
|
|
$$v = defined $given ? $given : ''; |
|
|
## NOTE: Setting NULL is supported for |
|
|
## compatibility with |textContent|. |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub text_content ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$$self->{ |
|
|
'con' |
|
|
}}; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
85 |
|
|
86 |
{ |
sub insert_before ($;$) { |
87 |
|
report Message::DOM::DOMException |
88 |
if |
-object => $_[0], |
89 |
($self-> |
-type => 'HIERARCHY_REQUEST_ERR', |
90 |
manakai_read_only |
-subtype => 'CHILD_NODE_TYPE_ERR'; |
91 |
) { |
} # insert_before |
92 |
|
|
93 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
sub replace_child ($$) { |
94 |
|
report Message::DOM::DOMException |
95 |
; |
-object => $_[0], |
96 |
} |
-type => 'HIERARCHY_REQUEST_ERR', |
97 |
|
-subtype => 'CHILD_NODE_TYPE_ERR'; |
98 |
|
} # replace_child |
99 |
|
|
100 |
|
## |CharacterData| attributes |
101 |
|
|
102 |
} |
sub data ($;$) { |
103 |
|
if (@_ > 1) { |
104 |
; |
if (${${$_[0]}->{owner_document}}->{strict_error_checking} and |
105 |
my $v = $$self->{ |
${$_[0]}->{manakai_read_only}) { |
106 |
'con' |
report Message::DOM::DOMException |
107 |
}; |
-object => $_[0], |
108 |
$$v = defined $given ? $given : ''; |
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
109 |
## NOTE: Setting NULL is supported for |
-subtype => 'READ_ONLY_NODE_ERR'; |
|
## compatibility with |textContent|. |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub base_uri ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$pe = $self-> |
|
|
parent_node |
|
|
; |
|
|
W: { |
|
|
while (defined $pe) { |
|
|
my $nt = $pe-> |
|
|
node_type |
|
|
; |
|
|
if ($nt == |
|
|
1 or |
|
|
|
|
|
$nt == |
|
|
2 or |
|
|
|
|
|
$nt == |
|
|
9 or |
|
|
|
|
|
$nt == |
|
|
11 or |
|
|
|
|
|
$nt == |
|
|
6 |
|
|
) { |
|
|
$r = $pe-> |
|
|
base_uri |
|
|
; |
|
|
last W; |
|
|
} elsif ($nt == |
|
|
5 |
|
|
) { |
|
|
if ($pe-> |
|
|
manakai_external |
|
|
) { |
|
|
$r = $pe-> |
|
|
manakai_entity_base_uri |
|
|
; |
|
|
last W; |
|
|
} |
|
|
} |
|
|
$pe = $pe-> |
|
|
parent_node |
|
|
; |
|
|
} |
|
|
if ($pe) { |
|
|
$r = $pe-> |
|
|
base_uri |
|
|
; |
|
|
} else { |
|
|
$r = $self-> |
|
|
owner_document |
|
|
-> |
|
|
base_uri |
|
|
; |
|
110 |
} |
} |
|
} # W |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$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::CharacterData::ManakaiDOMCharacterData', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
|
|
} |
|
|
} |
|
|
sub find_offset16 ($$) { |
|
|
my ($self, $offset32) = @_; |
|
|
my $r = 0; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$v = $$self->{ |
|
|
'con' |
|
|
}; |
|
|
|
|
|
if (not defined $offset32 or $offset32 < 0 or |
|
|
CORE::length ($$v) < $offset32) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#index' => $offset32, '-type' => 'INDEX_SIZE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'find_offset16', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#StringIndexOutOfBoundsException', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::CharacterData::ManakaiDOMCharacterData', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'offset32'; |
|
|
|
|
|
; |
|
|
} |
|
111 |
|
|
112 |
my $ss = substr $$v, 0, $offset32; |
if (defined $_[1]) { |
113 |
$r = $offset32; |
${$_[0]}->{data} = ''.$_[1]; |
|
if ($ss =~ /[\x{10000}-\x{10FFFF}]/) { |
|
|
while ($ss =~ /[\x{10000}-\x{10FFFF}]+/g) { |
|
|
$r += $+[0] - $-[0]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub find_offset32 ($$) { |
|
|
my ($self, $offset16) = @_; |
|
|
my $r = 0; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$v = $$self->{ |
|
|
'con' |
|
|
}; |
|
|
|
|
|
if (not defined $offset16 or $offset16 < 0) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#index' => $offset16, '-type' => 'INDEX_SIZE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'find_offset32', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#StringIndexOutOfBoundsException', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::CharacterData::ManakaiDOMCharacterData', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'offset16'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
my $o = $offset16; |
|
|
while ($o > 0) { |
|
|
my $c = substr ($$v, $r, 1); |
|
|
if (length $c) { |
|
|
if ($c =~ /[\x{10000}-\x{10FFFF}]/) { |
|
|
$o -= 2; |
|
114 |
} else { |
} else { |
115 |
$o--; |
${$_[0]}->{data} = ''; # for |text_content|. |
116 |
} |
} |
|
$r++; |
|
|
} else { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#index' => $offset16, '-type' => 'INDEX_SIZE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'find_offset32', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#StringIndexOutOfBoundsException', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::CharacterData::ManakaiDOMCharacterData', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'offset16'; |
|
|
|
|
|
; |
|
117 |
} |
} |
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub data ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = ${$$self->{ |
|
|
'con' |
|
|
}}; |
|
|
|
|
|
|
|
|
} |
|
|
$r; |
|
|
} else {my ($self, $given) = @_; |
|
|
|
|
|
{ |
|
|
|
|
118 |
|
|
119 |
{ |
return ${$_[0]}->{data}; |
120 |
|
} # data |
121 |
|
|
122 |
if |
sub length ($) { |
123 |
($self-> |
my $self = $_[0]; |
124 |
manakai_read_only |
my $r = CORE::length $$self->{data}; |
125 |
) { |
$r++ while $$self->{data} =~ /[\x{10000}-\x{10FFFF}]/g; |
126 |
|
return $r; |
127 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
} # length |
128 |
|
|
129 |
; |
## |CharacterData| methods |
130 |
} |
|
131 |
|
*append_data = \&manakai_append_text; |
132 |
|
|
133 |
} |
sub delete_data ($;$) { |
134 |
|
my $self = $_[0]; |
135 |
; |
my $offset = 0+$_[1]; |
136 |
my $v = $$self->{ |
my $count = 0+$_[2]; |
137 |
'con' |
|
138 |
}; |
if ($offset < 0 or $count < 0) { |
139 |
$$v = defined $given ? $given : ''; |
report Message::DOM::DOMException |
140 |
## NOTE: Setting NULL is supported for |
-object => $self, |
141 |
## compatibility with |textContent|. |
-type => 'INDEX_SIZE_ERR', |
142 |
|
-subtype => 'INDEX_OUT_OF_BOUND_ERR'; |
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
sub length ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = 0; |
|
|
|
|
|
{ |
|
|
|
|
|
my |
|
|
$v = $$self->{ |
|
|
'con' |
|
|
}; |
|
|
$r = CORE::length $$v; |
|
|
$r++ while $$v =~ /[\x{10000}-\x{10FFFF}]/g; |
|
|
|
|
|
|
|
|
} |
|
|
$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::CharacterData::ManakaiDOMCharacterData', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'length'; |
|
|
} |
|
|
} |
|
|
sub substring_data ($$$) { |
|
|
my ($self, $offset, $count) = @_; |
|
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
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' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
if ($count < 0) { |
|
|
|
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INDEX_SIZE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'substring_data', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#length' => $count, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NEGATIVE_LENGTH_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::CharacterData::ManakaiDOMCharacterData', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'count'; |
|
|
|
|
|
; |
|
|
} |
|
|
my $eoffset32; |
|
|
|
|
|
|
|
|
try {local $Error::Depth = $Error::Depth + 3; |
|
|
|
|
|
|
|
|
$eoffset32 = $self-> |
|
|
find_offset32 |
|
|
|
|
|
($offset + $count); |
|
|
} catch |
|
|
Message::DOM::IF::DOMException with |
|
|
{ |
|
|
my $err = shift; |
|
|
if ($err->subtype eq |
|
|
'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#StringIndexOutOfBoundsException' |
|
|
) { |
|
|
$eoffset32 = ($offset + $count) * 2; |
|
|
} else { |
|
|
$err->throw; |
|
143 |
} |
} |
|
}; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$offset32 = $self-> |
|
|
find_offset32 |
|
|
($offset); |
|
|
my $data = $self-> |
|
|
data |
|
|
; |
|
|
$r = substr ($data, $offset32, $eoffset32 - $offset32); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub append_data ($$) { |
|
|
my ($self, $arg) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
144 |
|
|
145 |
{ |
require Message::DOM::StringExtended; |
146 |
|
|
147 |
|
my $offset32; |
148 |
|
try { |
149 |
|
$offset32 = Message::DOM::StringExtended::find_offset32 |
150 |
|
($$self->{data}, $offset); |
151 |
|
} catch Error::Simple with { |
152 |
|
my $err = shift; |
153 |
|
if ($err->text eq "String index out of bounds\n") { |
154 |
|
report Message::DOM::DOMException |
155 |
|
-object => $self, |
156 |
|
-type => 'INDEX_SIZE_ERR', |
157 |
|
-subtype => 'INDEX_OUT_OF_BOUND_ERR'; |
158 |
|
} else { |
159 |
|
$err->throw; |
160 |
|
} |
161 |
|
}; |
162 |
|
|
163 |
|
my $eoffset32; |
164 |
|
try { |
165 |
|
$eoffset32 = Message::DOM::StringExtended::find_offset32 |
166 |
|
($$self->{data}, $offset + $count); |
167 |
|
} catch Error::Simple with { |
168 |
|
my $err = shift; |
169 |
|
if ($err->text eq "String index out of bounds\n") { |
170 |
|
$eoffset32 = ($offset + $count) * 2; |
171 |
|
} else { |
172 |
|
$err->throw; |
173 |
|
} |
174 |
|
}; |
175 |
|
|
176 |
$self-> |
substr ($$self->{data}, $offset32, $eoffset32 - $offset32) = ''; |
177 |
manakai_append_text |
return undef; |
178 |
(\$arg); |
} # delete_data |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
179 |
|
|
|
} |
|
|
} |
|
180 |
sub insert_data ($$$) { |
sub insert_data ($$$) { |
181 |
my ($self, $offset, $arg) = @_; |
my $self = $_[0]; |
182 |
|
my $offset = 0+$_[1]; |
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
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' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$offset32 = $self-> |
|
|
find_offset32 |
|
|
($offset); |
|
|
my $data = $self-> |
|
|
data |
|
|
; |
|
|
substr ($data, $offset32, 0) = $arg; |
|
|
$self-> |
|
|
data |
|
|
($data); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
sub delete_data ($$$) { |
|
|
my ($self, $offset, $count) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
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' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
|
|
|
|
|
; |
|
|
} |
|
183 |
|
|
184 |
|
if (${$$self->{owner_document}}->{strict_error_checking} and |
185 |
} |
$$self->{manakai_read_only}) { |
186 |
|
report Message::DOM::DOMException |
187 |
; |
-object => $self, |
188 |
if ($count < 0) { |
-type => 'NO_MODIFICATION_ALLOWED_ERR', |
189 |
|
-subtype => 'READ_ONLY_NODE_ERR'; |
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'INDEX_SIZE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'delete_data', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#length' => $count, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NEGATIVE_LENGTH_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::CharacterData::ManakaiDOMCharacterData', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'count'; |
|
|
|
|
|
; |
|
|
} |
|
|
my $eoffset32; |
|
|
|
|
|
|
|
|
try {local $Error::Depth = $Error::Depth + 3; |
|
|
|
|
|
|
|
|
$eoffset32 = $self-> |
|
|
find_offset32 |
|
|
|
|
|
($offset + $count); |
|
|
} catch |
|
|
Message::DOM::IF::DOMException with |
|
|
{ |
|
|
my $err = shift; |
|
|
if ($err->subtype eq |
|
|
'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#StringIndexOutOfBoundsException' |
|
|
) { |
|
|
$eoffset32 = ($offset + $count) * 2; |
|
|
} else { |
|
|
$err->throw; |
|
190 |
} |
} |
|
}; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
my |
|
|
$offset32 = $self-> |
|
|
find_offset32 |
|
|
($offset); |
|
|
my $data = $self-> |
|
|
data |
|
|
; |
|
|
substr ($data, $offset32, $eoffset32 - $offset32) = ''; |
|
|
$self-> |
|
|
data |
|
|
($data); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
sub replace_data ($$$$) { |
|
|
my ($self, $offset, $count, $arg) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$self-> |
|
|
delete_data |
|
|
($offset, $count); |
|
|
$self-> |
|
|
insert_data |
|
|
($offset, $arg); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::CharacterData::ManakaiDOMCharacterData>}->{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::CharacterData::ManakaiDOMCharacterData>} = 14.1; |
|
|
package Message::DOM::IF::Text; |
|
|
our $VERSION = 20061231.0931; |
|
|
package Message::DOM::CharacterData::ManakaiDOMText; |
|
|
our $VERSION = 20061231.0931; |
|
|
push our @ISA, 'Message::DOM::CharacterData::ManakaiDOMCharacterData', |
|
|
'Message::DOM::IF::CharacterData', |
|
|
'Message::DOM::IF::Node', |
|
|
'Message::DOM::IF::Text'; |
|
|
sub node_type ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
|
$r = 3; |
|
|
$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::CharacterData::ManakaiDOMText', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
|
|
} |
|
|
} |
|
|
sub node_name ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = '#text'; |
|
|
$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::CharacterData::ManakaiDOMText', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
|
|
} |
|
|
} |
|
|
sub get_feature ($$$) { |
|
|
my ($self, $feature, $version) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$feature = lc $feature; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
{ |
|
191 |
|
|
192 |
|
if ($offset < 0) { |
193 |
|
report Message::DOM::DOMException |
194 |
|
-object => $self, |
195 |
|
-type => 'INDEX_SIZE_ERR', |
196 |
|
-subtype => 'INDEX_OUT_OF_BOUND_ERR'; |
197 |
|
} |
198 |
|
|
199 |
$version = '' unless defined $version; |
require Message::DOM::StringExtended; |
200 |
|
my $offset32; |
201 |
|
try { |
202 |
} |
$offset32 = Message::DOM::StringExtended::find_offset32 |
203 |
my $r; |
($$self->{data}, $offset); |
204 |
|
} catch Error::Simple with { |
205 |
{ |
my $err = shift; |
206 |
|
if ($err->text eq "String index out of bounds\n") { |
207 |
|
report Message::DOM::DOMException |
208 |
$feature =~ s/^\+//; |
-object => $self, |
209 |
|
-type => 'INDEX_SIZE_ERR', |
210 |
|
-subtype => 'INDEX_OUT_OF_BOUND_ERR'; |
211 |
{ |
} else { |
212 |
|
$err->throw; |
213 |
if |
} |
214 |
($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { |
}; |
215 |
$r = $self; |
substr ($$self->{data}, $offset32, 0) = $_[2]; |
216 |
} |
} # insert_data |
217 |
|
|
218 |
|
sub replace_data ($;$$) { |
219 |
} |
my $self = $_[0]; |
220 |
|
my $offset = 0+$_[1]; |
221 |
; |
my $count = 0+$_[2]; |
222 |
unless (defined $r) { |
|
223 |
|
if ($offset < 0 or $count < 0) { |
224 |
|
report Message::DOM::DOMException |
225 |
{ |
-object => $self, |
226 |
|
-type => 'INDEX_SIZE_ERR', |
227 |
local $Error::Depth = $Error::Depth + 1; |
-subtype => 'INDEX_OUT_OF_BOUND_ERR'; |
228 |
|
} |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
sub is_element_content_whitespace ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = 0; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$r = $$self->{ |
|
|
'ecws' |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
$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' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
229 |
|
|
230 |
} |
require Message::DOM::StringExtended; |
231 |
|
|
232 |
; |
my $offset32; |
233 |
$$self->{ |
try { |
234 |
'ecws' |
$offset32 = Message::DOM::StringExtended::find_offset32 |
235 |
} = $given; |
($$self->{data}, $offset); |
236 |
|
} catch Error::Simple with { |
237 |
|
my $err = shift; |
238 |
} |
if ($err->text eq "String index out of bounds\n") { |
239 |
} |
report Message::DOM::DOMException |
240 |
} |
-object => $self, |
241 |
sub whole_text ($;$) { |
-type => 'INDEX_SIZE_ERR', |
242 |
if (@_ == 1) {my ($self) = @_; |
-subtype => 'INDEX_OUT_OF_BOUND_ERR'; |
|
my $r = ''; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
require |
|
|
Message::DOM::Traversal; |
|
|
my $doc = $self-> |
|
|
owner_document |
|
|
; |
|
|
my $doctrv = $doc-> |
|
|
get_feature |
|
|
(Traversal => '2.0'); |
|
|
my $tw1 = $doctrv-> |
|
|
create_tree_walker |
|
|
|
|
|
($doc, |
|
|
4294967295 |
|
|
, sub { |
|
|
($_[1]-> |
|
|
node_type |
|
|
|
|
|
== |
|
|
5 |
|
|
) |
|
|
? |
|
|
3 |
|
|
: |
|
|
|
|
|
1 |
|
|
|
|
|
}, |
|
|
1 |
|
|
); |
|
|
$tw1-> |
|
|
current_node |
|
|
($self); |
|
|
my $tw2 = $tw1->clone; |
|
|
$r = $self-> |
|
|
node_value |
|
|
; |
|
|
|
|
|
S: while (defined (my $node = $tw1-> |
|
|
previous_sibling |
|
|
)) { |
|
|
my $nt = $node-> |
|
|
node_type |
|
|
; |
|
|
if ($nt == |
|
|
3 or |
|
|
|
|
|
$nt == |
|
|
4 |
|
|
) { |
|
|
$r = $node-> |
|
|
node_value |
|
|
. $r; |
|
243 |
} else { |
} else { |
244 |
last S; |
$err->throw; |
245 |
} |
} |
246 |
} # S |
}; |
247 |
|
|
248 |
S: while (defined (my $node = $tw2-> |
my $eoffset32; |
249 |
next_sibling |
try { |
250 |
)) { |
$eoffset32 = Message::DOM::StringExtended::find_offset32 |
251 |
my $nt = $node-> |
($$self->{data}, $offset + $count); |
252 |
node_type |
} catch Error::Simple with { |
253 |
; |
my $err = shift; |
254 |
if ($nt == |
if ($err->text eq "String index out of bounds\n") { |
255 |
3 or |
$eoffset32 = ($offset + $count) * 2; |
|
|
|
|
$nt == |
|
|
4 |
|
|
) { |
|
|
$r .= $node-> |
|
|
node_value |
|
|
; |
|
256 |
} else { |
} else { |
257 |
last S; |
$err->throw; |
258 |
} |
} |
259 |
} # S |
}; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$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::CharacterData::ManakaiDOMText', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'whole_text'; |
|
|
} |
|
|
} |
|
|
sub replace_whole_text ($$) { |
|
|
my ($self, $content) = @_; |
|
|
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' => 'replace_whole_text', 'http://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::CharacterData::ManakaiDOMText'; |
|
|
$r} |
|
|
sub split_text ($$) { |
|
|
my ($self, $offset) = @_; |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
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' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
|
|
|
|
|
; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
my $parent = $self-> |
|
|
parent_node |
|
|
; |
|
|
if (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' => 'split_text', 'http://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::CharacterData::ManakaiDOMText'; |
|
260 |
|
|
261 |
; |
substr ($$self->{data}, $offset32, $eoffset32 - $offset32) = $_[3]; |
262 |
} |
return undef; |
263 |
|
} # replace_data |
264 |
|
|
265 |
|
sub substring_data ($;$$) { |
266 |
{ |
my $self = $_[0]; |
267 |
|
my $offset = 0+$_[1]; |
268 |
local $Error::Depth = $Error::Depth + 1; |
my $count = 0+$_[2]; |
269 |
|
|
270 |
{ |
if ($offset < 0 or $count < 0) { |
271 |
|
report Message::DOM::DOMException |
272 |
|
-object => $self, |
273 |
my |
-type => 'INDEX_SIZE_ERR', |
274 |
$offset32 = $self-> |
-subtype => 'INDEX_OUT_OF_BOUND_ERR'; |
|
find_offset32 |
|
|
($offset); |
|
|
my $data1 = $self-> |
|
|
data |
|
|
; |
|
|
my $data2 = substr ($data1, $offset32); |
|
|
substr ($data1, $offset32) = ''; |
|
|
|
|
|
$r = $self-> |
|
|
node_type |
|
|
== |
|
|
3 |
|
|
|
|
|
? $self-> |
|
|
owner_document |
|
|
|
|
|
-> |
|
|
create_text_node |
|
|
($data2) |
|
|
: $self-> |
|
|
owner_document |
|
|
|
|
|
-> |
|
|
create_cdata_section |
|
|
($data2); |
|
|
$r-> |
|
|
is_element_content_whitespace |
|
|
|
|
|
($self-> |
|
|
is_element_content_whitespace |
|
|
); |
|
|
$self-> |
|
|
data |
|
|
($data1); |
|
|
if (defined $parent) { |
|
|
$parent-> |
|
|
insert_before |
|
|
|
|
|
($r, $self-> |
|
|
next_sibling |
|
|
); |
|
275 |
} |
} |
276 |
|
|
277 |
|
require Message::DOM::StringExtended; |
278 |
|
|
279 |
|
my $eoffset32; |
280 |
|
try { |
281 |
|
$eoffset32 = Message::DOM::StringExtended::find_offset32 |
282 |
|
($$self->{data}, $offset + $count); |
283 |
|
} catch Error::Simple with { |
284 |
|
my $err = shift; |
285 |
|
if ($err->text eq "String index out of bounds\n") { |
286 |
|
$eoffset32 = ($offset + $count) * 2; |
287 |
|
} else { |
288 |
|
$err->throw; |
289 |
|
} |
290 |
|
}; |
291 |
|
|
292 |
|
local $Error::Depth = $Error::Depth + 1; |
293 |
|
my $offset32 = Message::DOM::StringExtended::find_offset32 |
294 |
|
($$self->{data}, $offset); |
295 |
|
return substr $$self->{data}, $offset32, $eoffset32 - $offset32; |
296 |
|
} # substring_data |
297 |
|
|
298 |
} |
package Message::DOM::CharacterData::Comment; |
299 |
|
push our @ISA, 'Message::DOM::CharacterData', 'Message::IF::Comment'; |
|
|
|
|
;} |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
} |
|
|
$r} |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::CharacterData::ManakaiDOMText>}->{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::CharacterData::ManakaiDOMText>} = 14.1; |
|
|
package Message::DOM::IF::Comment; |
|
|
our $VERSION = 20061231.0931; |
|
|
package Message::DOM::CharacterData::ManakaiDOMComment; |
|
|
our $VERSION = 20061231.0931; |
|
|
push our @ISA, 'Message::DOM::CharacterData::ManakaiDOMCharacterData', |
|
|
'Message::DOM::IF::CharacterData', |
|
|
'Message::DOM::IF::Comment', |
|
|
'Message::DOM::IF::Node'; |
|
|
sub node_type ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r; |
|
|
$r = 8; |
|
|
$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::CharacterData::ManakaiDOMComment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
|
|
} |
|
|
} |
|
|
sub node_name ($;$) { |
|
|
if (@_ == 1) {my ($self) = @_; |
|
|
my $r = ''; |
|
|
$r = '#comment'; |
|
|
$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::CharacterData::ManakaiDOMComment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
|
|
} |
|
|
} |
|
|
sub get_feature ($$$) { |
|
|
my ($self, $feature, $version) = @_; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$feature = lc $feature; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$version = '' unless defined $version; |
|
|
|
|
|
|
|
|
} |
|
|
my $r; |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
$feature =~ s/^\+//; |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
if |
|
|
($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { |
|
|
$r = $self; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
; |
|
|
unless (defined $r) { |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
local $Error::Depth = $Error::Depth + 1; |
|
300 |
|
|
301 |
{ |
## |Node| attributes |
302 |
|
|
303 |
|
sub node_name () { '#comment' } |
304 |
|
|
305 |
|
sub node_type () { 8 } # COMMENT_NODE |
306 |
|
|
307 |
$r = $self->SUPER::get_feature ($feature, $version); |
package Message::IF::CharacterData; |
308 |
|
package Message::IF::Comment; |
309 |
|
|
310 |
|
package Message::DOM::Document; |
311 |
|
|
312 |
} |
sub create_comment ($$) { |
313 |
|
return Message::DOM::CharacterData::Comment->____new ($_[0], $_[1]); |
314 |
|
} # create_comment |
315 |
|
|
316 |
|
=head1 LICENSE |
317 |
|
|
318 |
;} |
Copyright 2007 Wakaba <w@suika.fam.cx> |
319 |
|
|
320 |
; |
This program is free software; you can redistribute it and/or |
321 |
} |
modify it under the same terms as Perl itself. |
322 |
|
|
323 |
|
=cut |
324 |
|
|
|
} |
|
|
$r} |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::CharacterData::ManakaiDOMComment>}->{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::CharacterData::ManakaiDOMComment>} = 14.1; |
|
|
package Message::DOM::IF::StringExtended; |
|
|
our $VERSION = 20061231.0931; |
|
|
for ($Message::DOM::IF::Node::){} |
|
|
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
|
325 |
1; |
1; |
326 |
|
## $Date$ |