4 |
push our @ISA, 'Message::IF::Node'; |
push our @ISA, 'Message::IF::Node'; |
5 |
require Scalar::Util; |
require Scalar::Util; |
6 |
|
|
7 |
|
## The |Node| interface - constants |
8 |
|
|
9 |
|
## Definition group NodeType |
10 |
|
|
11 |
|
## Spec: |
12 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1841493061> |
13 |
|
## <http://suika.fam.cx/gate/2005/sw/manakai/DOM%20Extensions#anchor-23> |
14 |
|
|
15 |
|
## NOTE: Numeric codes up to 200 are reserved by W3C [DOM1SE, DOM2, DOM3]. |
16 |
|
|
17 |
|
sub ELEMENT_NODE () { 1 } |
18 |
|
sub ATTRIBUTE_NODE () { 2 } |
19 |
|
sub TEXT_NODE () { 3 } |
20 |
|
sub CDATA_SECTION_NODE () { 4 } |
21 |
|
sub ENTITY_REFERENCE_NODE () { 5 } |
22 |
|
sub ENTITY_NODE () { 6 } |
23 |
|
sub PROCESSING_INSTRUCTION_NODE () { 7 } |
24 |
|
sub COMMENT_NODE () { 8 } |
25 |
|
sub DOCUMENT_NODE () { 9 } |
26 |
|
sub DOCUMENT_TYPE_NODE () { 10 } |
27 |
|
sub DOCUMENT_FRAGMENT_NODE () { 11 } |
28 |
|
sub NOTATION_NODE () { 12 } |
29 |
|
sub ELEMENT_TYPE_DEFINITION_NODE () { 81001 } |
30 |
|
sub ATTRIBUTE_DEFINITION_NODE () { 81002 } |
31 |
|
|
32 |
|
## Definition group DocumentPosition |
33 |
|
|
34 |
|
## Spec: |
35 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DocumentPosition> |
36 |
|
|
37 |
|
sub DOCUMENT_POSITION_DISCONNECTED () { 0x01 } |
38 |
|
sub DOCUMENT_POSITION_PRECEDING () { 0x02 } |
39 |
|
sub DOCUMENT_POSITION_FOLLOWING () { 0x04 } |
40 |
|
sub DOCUMENT_POSITION_CONTAINS () { 0x08 } |
41 |
|
sub DOCUMENT_POSITION_CONTAINED_BY () { 0x10 } |
42 |
|
sub DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC () { 0x20 } |
43 |
|
|
44 |
sub ____new ($$) { |
sub ____new ($$) { |
45 |
my $self = bless \({}), shift; |
my $self = bless \({}), shift; |
46 |
$$self->{owner_document} = shift; |
$$self->{owner_document} = shift; |
77 |
}->{$method_name}) { |
}->{$method_name}) { |
78 |
no strict 'refs'; |
no strict 'refs'; |
79 |
eval qq{ |
eval qq{ |
80 |
sub $method_name (\$) { |
sub $method_name (\$;\$) { |
81 |
if (\@_ > 1) { |
if (\@_ > 1) { |
82 |
\${\$_[0]}->{$method_name} = ''.$_[1]; |
\${\$_[0]}->{$method_name} = ''.\$_[1]; |
83 |
} |
} |
84 |
return \${\$_[0]}->{$method_name}; |
return \${\$_[0]}->{$method_name}; |
85 |
} |
} |
98 |
|
|
99 |
## The |Node| interface - attribute |
## The |Node| interface - attribute |
100 |
|
|
101 |
|
## Spec: |
102 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-84CF096> |
103 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1950641247> |
104 |
|
|
105 |
|
sub attributes ($) { |
106 |
|
## NOTE: Overloaded by |Message::DOM::Element|. |
107 |
|
return undef; |
108 |
|
} # attributes |
109 |
|
|
110 |
|
## Spec: |
111 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68D095> |
112 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1950641247> |
113 |
|
|
114 |
|
sub node_name ($) { |
115 |
|
## NOTE: Overloaded by subclasses. |
116 |
|
return undef; |
117 |
|
} # node_name |
118 |
|
|
119 |
|
## Spec: |
120 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-111237558> |
121 |
|
|
122 |
|
sub node_type ($) { |
123 |
|
## NOTE: Overloaded by subclasses. |
124 |
|
die "Node->node_type is not defined"; |
125 |
|
} # node_type |
126 |
|
|
127 |
|
## Spec: |
128 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68D080> |
129 |
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1950641247> |
130 |
|
|
131 |
|
sub node_value ($;$) { |
132 |
|
## NOTE: Overloaded by subclasses. |
133 |
|
return undef; |
134 |
|
} # node_value |
135 |
|
|
136 |
sub is_equal_node ($$) { |
sub is_equal_node ($$) { |
137 |
return shift eq shift; |
return shift eq shift; |
138 |
} # is_equal_node |
} # is_equal_node |
252 |
return undef; |
return undef; |
253 |
} # previous_sibling |
} # previous_sibling |
254 |
|
|
|
sub ELEMENT_NODE () { 1 } |
|
|
sub ATTRIBUTE_NODE () { 2 } |
|
|
sub TEXT_NODE () { 3 } |
|
|
sub CDATA_SECTION_NODE () { 4 } |
|
|
sub ENTITY_REFERENCE_NODE () { 5 } |
|
|
sub ENTITY_NODE () { 6 } |
|
|
sub PROCESSING_INSTRUCTION_NODE () { 7 } |
|
|
sub COMMENT_NODE () { 8 } |
|
|
sub DOCUMENT_NODE () { 9 } |
|
|
sub DOCUMENT_TYPE_NODE () { 10 } |
|
|
sub DOCUMENT_FRAGMENT_NODE () { 11 } |
|
|
sub NOTATION_NODE () { 12 } |
|
|
|
|
255 |
package Message::IF::Node; |
package Message::IF::Node; |
256 |
|
|
257 |
1; |
1; |