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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Sat Jun 16 15:27:45 2007 UTC (17 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +4 -9 lines
++ manakai/t/ChangeLog	16 Jun 2007 15:27:38 -0000
	* DOM-Node.t: Tests for |prefix| and |text_content| are added.

2007-06-16  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	16 Jun 2007 15:27:12 -0000
	* DOMConfiguration.pm: New module.

	* Attr.pm (trivial accessor for read-write attributes): Throw
	an exception if the node is read-only.  Delete the property
	if undef is specified.
	(prefix): Implemented.

	* DOMElement.pm (trivial accessor for read-write attributes): Throw
        an exception if the node is read-only.  Delete the property
        if undef is specified.
        (prefix): Implemented.
	(text_content, manakai_append_text): Old implementations are removed.

	* DOMCharacterData.pm (text_content): Implemented.

	* DOMDocument.pm (____new): Initialize the strict-document-children
	parameter by true.
	(text_content): Reimplemented.
	(dom_config): New.

	* DOMException.pm (READ_ONLY_NODE_ERR): New subtype.

	* DocumentType.pm (text_content): Implemented.

	* ElementTypeDefinition.pm (text_content): Implemented.

	* Node.pm (___report_error): New method.
	(text_content): Implemented.
	(manakai_append_text): Copied from |DOMElement.pm|.

	* Notation.pm (text_content): Implemented.

	* ProcessingInstruction.pm (text_content): Implemented.

	* Text.pm (is_element_content_whitespace): Alpha version.

2007-06-16  Wakaba  <wakaba@suika.fam.cx>

1 wakaba 1.1 package Message::DOM::ProcessingInstruction;
2     use strict;
3 wakaba 1.4 our $VERSION=do{my @r=(q$Revision: 1.3 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4 wakaba 1.1 push our @ISA, 'Message::DOM::Node', 'Message::IF::ProcessingInstruction';
5     require Message::DOM::Node;
6    
7     sub ____new ($$$$) {
8     my $self = shift->SUPER::____new (shift);
9     ($$self->{target}, $$self->{data}) = @_;
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     target => 1,
21     data => 1,
22     }->{$method_name}) {
23     no strict 'refs';
24     eval qq{
25     sub $method_name (\$) {
26     if (\@_ > 1) {
27     require Carp;
28     Carp::croak (qq<Can't modify read-only attribute>);
29     }
30     return \${\$_[0]}->{$method_name};
31     }
32     };
33     goto &{ $AUTOLOAD };
34     } elsif ({
35     ## Read-write attributes (DOMString, trivial accessors)
36     }->{$method_name}) {
37     no strict 'refs';
38     eval qq{
39     sub $method_name (\$) {
40     if (\@_ > 1) {
41     \${\$_[0]}->{$method_name} = ''.$_[1];
42     }
43     return \${\$_[0]}->{$method_name};
44     }
45     };
46     goto &{ $AUTOLOAD };
47     } else {
48     require Carp;
49     Carp::croak (qq<Can't locate method "$AUTOLOAD">);
50     }
51     } # AUTOLOAD
52     sub target ($);
53     sub data ($);
54    
55     ## The |Node| interface - attribute
56    
57 wakaba 1.3 sub child_nodes ($) {
58     require Message::DOM::NodeList;
59     return bless \\($_[0]), 'Message::DOM::NodeList::EmptyNodeList';
60     } # child_nodes
61 wakaba 1.2
62     ## The target of the processing instruction [DOM1, DOM2].
63     ## Same as |ProcessingInstruction.target| [DOM3].
64    
65     *node_name = \&target;
66    
67     ## Spec:
68     ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-111237558>
69    
70     sub node_type ($) { 7 } # PROCESSING_INSTRUCTION_NODE
71    
72     ## The entire content exclude the target [DOM1, DOM2].
73     ## Same as |ProcessingInstruction.data| [DOM3].
74    
75     *node_value = \&data;
76 wakaba 1.1
77 wakaba 1.4 *text_content = \&node_value;
78    
79 wakaba 1.1 package Message::IF::ProcessingInstruction;
80    
81     package Message::DOM::Document;
82    
83     ## Spec:
84     ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-135944439>
85     ## Compatibility note:
86     ## <http://suika.fam.cx/gate/2005/sw/createProcessingInstruction>
87    
88     sub create_processing_instruction ($$$) {
89     return Message::DOM::ProcessingInstruction->____new (@_[0, 1, 2]);
90     } # create_processing_instruction
91    
92     1;
93     ## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL>
94 wakaba 1.4 ## $Date: 2007/06/16 08:05:48 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24