/[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.5 - (hide annotations) (download)
Sat Jul 7 12:26:10 2007 UTC (17 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.4: +5 -2 lines
++ manakai/t/ChangeLog	7 Jul 2007 12:17:46 -0000
	* DOM-Node.t: Test data for |manakai_read_only|
	attribute are added.

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

++ manakai/lib/Message/DOM/ChangeLog	7 Jul 2007 12:17:24 -0000
	* DOMDocument.pm (get_element_by_id): Implemented.
	(create_document): Implemented.

	* DOMException.pm (EXTERNAL_OBJECT_ERR, INUSE_DOCTYPE_ERR): New
	errors.
	(QNAME_NULLNS_ERR): New errors.

	* DocumenType.pm (create_document_type): Implemented.

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

1 wakaba 1.1 package Message::DOM::DOMImplementation;
2     use strict;
3 wakaba 1.5 our $VERSION=do{my @r=(q$Revision: 1.4 $=~/\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     $HasFeature->{xml}->{''} = 1;
49     $HasFeature->{xml}->{'1.0'} = 1;
50     $HasFeature->{xml}->{'2.0'} = 1;
51     $HasFeature->{xml}->{'3.0'} = 1;
52     $HasFeature->{xmlversion}->{''} = 1;
53     $HasFeature->{xmlversion}->{'1.0'} = 1;
54     $HasFeature->{xmlversion}->{'1.1'} = 1;
55     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/min>}->{''} = 1;
56     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/min>}->{'3.0'} = 1;
57     $HasFeature->{q<http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#minimum>}->{''} = 1;
58     $HasFeature->{q<http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#minimum>}->{'3.0'} = 1;
59     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctype>}->{''} = 1;
60     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctype>}->{'3.0'} = 1;
61    
62 wakaba 1.5 sub ___report_error { $_[1]->throw }
63    
64 wakaba 1.4 ## |DOMImplementation| methods
65    
66     sub create_document ($;$$$);
67    
68     sub create_document_type ($$;$$);
69 wakaba 1.1
70 wakaba 1.4 sub get_feature ($$;$) {
71     my $feature = lc $_[1]; ## TODO: What |lc|?
72     $feature =~ s/^\+//;
73    
74     if ($HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''}) {
75     return $_[0];
76     } else {
77     return undef;
78     }
79     } # get_feature
80 wakaba 1.1
81 wakaba 1.4 sub has_feature ($$;$) {
82     my $feature = lc $_[1];
83     my $plus = $feature =~ s/^\+// ? 1 : 0;
84     return $HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''};
85     } # has_feature
86 wakaba 1.1
87     package Message::IF::DOMImplementation;
88    
89 wakaba 1.4 =head1 LICENSE
90    
91     Copyright 2007 Wakaba <w@suika.fam.cx>
92    
93     This program is free software; you can redistribute it and/or
94     modify it under the same terms as Perl itself.
95    
96     =cut
97    
98 wakaba 1.1 1;
99 wakaba 1.5 ## $Date: 2007/07/07 05:58:11 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24