1 |
package Message::DOM::Entity; |
2 |
use strict; |
3 |
our $VERSION=do{my @r=(q$Revision: 1.2 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
4 |
push our @ISA, 'Message::DOM::Node', 'Message::IF::Entity'; |
5 |
require Message::DOM::Node; |
6 |
|
7 |
## Spec: |
8 |
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-527DCFF2> |
9 |
|
10 |
sub ____new ($$$) { |
11 |
my $self = shift->SUPER::____new (shift); |
12 |
$$self->{node_name} = $_[0]; |
13 |
$$self->{child_nodes} = []; |
14 |
return $self; |
15 |
} # ____new |
16 |
|
17 |
sub AUTOLOAD { |
18 |
my $method_name = our $AUTOLOAD; |
19 |
$method_name =~ s/.*:://; |
20 |
return if $method_name eq 'DESTROY'; |
21 |
|
22 |
if ({ |
23 |
## Read-only attributes (trivial accessors) |
24 |
node_name => 1, |
25 |
}->{$method_name}) { |
26 |
no strict 'refs'; |
27 |
eval qq{ |
28 |
sub $method_name (\$) { |
29 |
if (\@_ > 1) { |
30 |
require Carp; |
31 |
Carp::croak (qq<Can't modify read-only attribute>); |
32 |
} |
33 |
return \${\$_[0]}->{$method_name}; |
34 |
} |
35 |
}; |
36 |
goto &{ $AUTOLOAD }; |
37 |
} elsif ({ |
38 |
## Read-write attributes (DOMString, trivial accessors) |
39 |
public_id => 1, |
40 |
system_id => 1, |
41 |
}->{$method_name}) { |
42 |
no strict 'refs'; |
43 |
eval qq{ |
44 |
sub $method_name (\$) { |
45 |
if (\@_ > 1) { |
46 |
## TODO: read-only, undef |
47 |
\${\$_[0]}->{$method_name} = ''.$_[1]; |
48 |
} |
49 |
return \${\$_[0]}->{$method_name}; |
50 |
} |
51 |
}; |
52 |
goto &{ $AUTOLOAD }; |
53 |
} else { |
54 |
require Carp; |
55 |
Carp::croak (qq<Can't locate method "$AUTOLOAD">); |
56 |
} |
57 |
} # AUTOLOAD |
58 |
sub public_id ($;$); |
59 |
sub system_id ($;$); |
60 |
|
61 |
## The |Node| interface - attribute |
62 |
|
63 |
## Spec: |
64 |
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68D095> |
65 |
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1950641247> |
66 |
|
67 |
sub node_name ($); # read-only trivial accessor |
68 |
|
69 |
## Spec: |
70 |
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-111237558> |
71 |
|
72 |
sub node_type ($) { 6 } # ENTITY_NODE |
73 |
|
74 |
package Message::IF::Entity; |
75 |
|
76 |
package Message::DOM::Document; |
77 |
|
78 |
## Spec: |
79 |
## <http://suika.fam.cx/gate/2005/sw/DocumentXDoctype> |
80 |
|
81 |
sub create_general_entity ($$) { |
82 |
return Message::DOM::Entity->____new (@_[0, 1]); |
83 |
} # create_general_entity |
84 |
|
85 |
1; |
86 |
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
87 |
## $Date: 2007/06/15 14:32:50 $ |