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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations) (download)
Sat Jul 14 16:32:28 2007 UTC (17 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.7: +4 -2 lines
++ 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 wakaba 1.1 package Message::DOM::DOMImplementation;
2     use strict;
3 wakaba 1.8 our $VERSION=do{my @r=(q$Revision: 1.7 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4 wakaba 1.1 push our @ISA, 'Message::IF::DOMImplementation';
5 wakaba 1.5 require Message::DOM::DOMException;
6 wakaba 1.1
7     sub ____new ($) {
8     my $self = bless {}, shift;
9     return $self;
10     } # ____new
11 wakaba 1.4 *new = \&____new;
12 wakaba 1.1
13     sub AUTOLOAD {
14     my $method_name = our $AUTOLOAD;
15     $method_name =~ s/.*:://;
16     return if $method_name eq 'DESTROY';
17    
18     my $module_name = {
19     create_document => 'Message::DOM::DOMDocument', ## TODO: New module name
20 wakaba 1.2 create_document_type => 'Message::DOM::DocumentType',
21 wakaba 1.3 create_mc_decode_handler => 'Message::Charset::Encode',
22 wakaba 1.1 create_uri_reference => 'Message::URI::URIReference',
23 wakaba 1.3 get_charset_name_from_uri => 'Message::Charset::Encode',
24     get_uri_from_charset_name => 'Message::Charset::Encode',
25 wakaba 1.1 }->{$method_name};
26     if ($module_name) {
27     eval qq{ require $module_name } or die $@;
28     no strict 'refs';
29     goto &{ $AUTOLOAD };
30     } else {
31     require Carp;
32     Carp::croak (qq<Can't locate method "$AUTOLOAD">);
33     }
34     } # AUTOLOAD
35 wakaba 1.4
36 wakaba 1.3 ## MCImplementation
37     sub create_mc_decode_handler;
38     sub get_charset_name_from_uri;
39     sub get_uri_from_charset_name;
40 wakaba 1.1 ## URIImplementation
41     sub create_uri_reference ($$);
42    
43 wakaba 1.4 our $HasFeature;
44     $HasFeature->{core}->{''} = 1;
45     $HasFeature->{core}->{'1.0'} = 1;
46     $HasFeature->{core}->{'2.0'} = 1;
47     $HasFeature->{core}->{'3.0'} = 1;
48 wakaba 1.8 $HasFeature->{traversal}->{''} = 1;
49     $HasFeature->{traversal}->{'2.0'} = 1;
50 wakaba 1.4 $HasFeature->{xml}->{''} = 1;
51     $HasFeature->{xml}->{'1.0'} = 1;
52     $HasFeature->{xml}->{'2.0'} = 1;
53     $HasFeature->{xml}->{'3.0'} = 1;
54     $HasFeature->{xmlversion}->{''} = 1;
55     $HasFeature->{xmlversion}->{'1.0'} = 1;
56     $HasFeature->{xmlversion}->{'1.1'} = 1;
57     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/min>}->{''} = 1;
58     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/min>}->{'3.0'} = 1;
59     $HasFeature->{q<http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#minimum>}->{''} = 1;
60     $HasFeature->{q<http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#minimum>}->{'3.0'} = 1;
61     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctype>}->{''} = 1;
62     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctype>}->{'3.0'} = 1;
63 wakaba 1.6 $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctypedeclaration>}->{''} = 1;
64     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctypedeclaration>}->{'3.0'} = 1;
65 wakaba 1.4
66 wakaba 1.5 sub ___report_error { $_[1]->throw }
67    
68 wakaba 1.4 ## |DOMImplementation| methods
69    
70     sub create_document ($;$$$);
71    
72 wakaba 1.7 sub create_document_type ($$$$);
73 wakaba 1.1
74 wakaba 1.4 sub get_feature ($$;$) {
75     my $feature = lc $_[1]; ## TODO: What |lc|?
76     $feature =~ s/^\+//;
77    
78     if ($HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''}) {
79     return $_[0];
80     } else {
81     return undef;
82     }
83     } # get_feature
84 wakaba 1.1
85 wakaba 1.4 sub has_feature ($$;$) {
86     my $feature = lc $_[1];
87     my $plus = $feature =~ s/^\+// ? 1 : 0;
88     return $HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''};
89     } # has_feature
90 wakaba 1.1
91     package Message::IF::DOMImplementation;
92    
93 wakaba 1.4 =head1 LICENSE
94    
95     Copyright 2007 Wakaba <w@suika.fam.cx>
96    
97     This program is free software; you can redistribute it and/or
98     modify it under the same terms as Perl itself.
99    
100     =cut
101    
102 wakaba 1.1 1;
103 wakaba 1.8 ## $Date: 2007/07/12 13:54:46 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24