/[suikacvs]/messaging/manakai/lib/Message/DOM/Notation.pm
Suika

Contents of /messaging/manakai/lib/Message/DOM/Notation.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Sat Jul 14 16:32:28 2007 UTC (17 years, 4 months ago) by wakaba
Branch: MAIN
CVS Tags: manakai-release-0-4-0, HEAD
Changes since 1.8: +3 -7 lines
Error occurred while calculating annotation data.
++ manakai/t/ChangeLog	14 Jul 2007 16:32:13 -0000
2007-07-15  Wakaba  <wakaba@suika.fam.cx>

	* DOM-TreeWalker.t, DOM-SerialWalker.t: New test scripts.

	* DOM-DOMImplementation.t: Tests for |Traversal| feature
	are added.

	* DOM-Node.t: Tests for |Traversal| feature are added.

++ manakai/lib/Message/DOM/ChangeLog	14 Jul 2007 16:31:23 -0000
2007-07-15  Wakaba  <wakaba@suika.fam.cx>

	* TreeWalker.pm, SerialWalker.pm: New Perl modules.

	* Text.pm (whole_text): Parameter index number has
	been changed to support new |NodeFilter| Perl binding
	definition.

2007-07-14  Wakaba  <wakaba@suika.fam.cx>

	* AttributeDefinition.pm, DOMElement.pm, DocumentType.pm,
	ElementTypeDefinition.pm, Entity.pm, EntityReference.pm,
	Notation.pm, ProcessingInstruction.pm (AUTOLOAD): Don't croak even if an attempt is made to modify a read-only attribute.

	* DOMConfiguration.pm (can_set_parameter,
	set_parameter): Don't allow to set the value
	to a string other than <http://www.w3.org/TR/REC-xml> (XML 1.0 DTD).

	* DOMDocument.pm (Message::IF::DocumentTraversal): New interface.
	(create_tree_walker, manakai_create_serial_walker): References
	and prototypes are added.

	* DOMException.pm (NULLPO_ERR): New error type:-).

	* DOMImplementation.pm ($HasFeature): Feature |Traversal|,
	version |2.0|, is added.

1 package Message::DOM::Notation;
2 use strict;
3 our $VERSION=do{my @r=(q$Revision: 1.8 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4 push our @ISA, 'Message::DOM::Node', 'Message::IF::Notation';
5 require Message::DOM::Node;
6
7 sub ____new ($$$) {
8 my $self = shift->SUPER::____new (shift);
9 $$self->{node_name} = $_[0];
10 return $self;
11 } # ____new
12
13 sub AUTOLOAD {
14 my $method_name = our $AUTOLOAD;
15 $method_name =~ s/.*:://;
16 return if $method_name eq 'DESTROY';
17
18 if ({
19 ## Read-only attributes (trivial accessors)
20 node_name => 1,
21 owner_document_type_definition => 1,
22 }->{$method_name}) {
23 no strict 'refs';
24 eval qq{
25 sub $method_name (\$) {
26 return \${\$_[0]}->{$method_name};
27 }
28 };
29 goto &{ $AUTOLOAD };
30 } elsif ({
31 ## Read-write attributes (DOMString, trivial accessors)
32 public_id => 1,
33 system_id => 1,
34 }->{$method_name}) {
35 no strict 'refs';
36 eval qq{
37 sub $method_name (\$;\$) {
38 if (\@_ > 1) {
39 if (\${\$_[0]}->{strict_error_checking} and
40 \${\$_[0]}->{manakai_read_only}) {
41 report Message::DOM::DOMException
42 -object => \$_[0],
43 -type => 'NO_MODIFICATION_ALLOWED_ERR',
44 -subtype => 'READ_ONLY_NODE_ERR';
45 }
46 if (defined \$_[1]) {
47 \${\$_[0]}->{$method_name} = ''.\$_[1];
48 } else {
49 delete \${\$_[0]}->{$method_name};
50 }
51 }
52 return \${\$_[0]}->{$method_name};
53 }
54 };
55 goto &{ $AUTOLOAD };
56 } else {
57 require Carp;
58 Carp::croak (qq<Can't locate method "$AUTOLOAD">);
59 }
60 } # AUTOLOAD
61
62 ## |Node| attributes
63
64 sub child_nodes ($) {
65 require Message::DOM::NodeList;
66 return bless \\($_[0]), 'Message::DOM::NodeList::EmptyNodeList';
67 } # child_nodes
68
69 sub node_name ($);
70
71 sub node_type () { 12 } # NOTATION_NODE
72
73 sub text_content () { undef }
74
75 ## |Node| methods
76
77 sub append_child ($$) {
78 report Message::DOM::DOMException
79 -object => $_[0],
80 -type => 'HIERARCHY_REQUEST_ERR',
81 -subtype => 'CHILD_NODE_TYPE_ERR';
82 } # append_child
83
84 sub manakai_append_text () { }
85
86 sub insert_before ($;$) {
87 report Message::DOM::DOMException
88 -object => $_[0],
89 -type => 'HIERARCHY_REQUEST_ERR',
90 -subtype => 'CHILD_NODE_TYPE_ERR';
91 } # insert_before
92
93 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 ## |Notation| attributes
101
102 sub manakai_declaration_base_uri ($;$) {
103 ## NOTE: Same as |Notation|'s.
104
105 if (@_ > 1) {
106 if (${${$_[0]}->{owner_document}}->{strict_error_checking} and
107 ${$_[0]}->{manakai_read_only}) {
108 report Message::DOM::DOMException
109 -object => $_[0],
110 -type => 'NO_MODIFICATION_ALLOWED_ERR',
111 -subtype => 'READ_ONLY_NODE_ERR';
112 }
113 if (defined $_[1]) {
114 ${$_[0]}->{manakai_declaration_base_uri} = ''.$_[1];
115 } else {
116 delete ${$_[0]}->{manakai_declaration_base_uri};
117 }
118 }
119
120 if (defined wantarray) {
121 if (defined ${$_[0]}->{manakai_declaration_base_uri}) {
122 return ${$_[0]}->{manakai_declaration_base_uri};
123 } else {
124 local $Error::Depth = $Error::Depth + 1;
125 return $_[0]->base_uri;
126 }
127 }
128 } # manakai_declaration_base_uri
129
130 ## NOTE: A manakai extension.
131 sub owner_document_type_definition ($);
132
133 ## NOTE: Setter is a manakai extension.
134 sub public_id ($;$);
135
136 ## NOTE: Setter is a manakai extension.
137 sub system_id ($;$);
138
139 package Message::IF::Notation;
140
141 package Message::DOM::Document;
142
143 sub create_notation ($$) {
144 if (${$_[0]}->{strict_error_checking}) {
145 my $xv = $_[0]->xml_version;
146 if (defined $xv) {
147 if ($xv eq '1.0' and
148 $_[1] =~ /\A\p{InXML_NameStartChar10}\p{InXMLNameChar10}*\z/) {
149 #
150 } elsif ($xv eq '1.1' and
151 $_[1] =~ /\A\p{InXMLNameStartChar11}\p{InXMLNameChar11}*\z/) {
152 #
153 } else {
154 report Message::DOM::DOMException
155 -object => $_[0],
156 -type => 'INVALID_CHARACTER_ERR',
157 -subtype => 'MALFORMED_NAME_ERR';
158 }
159 }
160 }
161
162 return Message::DOM::Notation->____new (@_[0, 1]);
163 } # create_notation
164
165 =head1 LICENSE
166
167 Copyright 2007 Wakaba <w@suika.fam.cx>
168
169 This program is free software; you can redistribute it and/or
170 modify it under the same terms as Perl itself.
171
172 =cut
173
174 1;
175 ## $Date: 2007/07/14 09:19:11 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24