/[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.7 - (show annotations) (download)
Thu Jul 12 13:54:46 2007 UTC (17 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.6: +3 -3 lines
++ manakai/t/ChangeLog	12 Jul 2007 13:53:24 -0000
2007-07-12  Wakaba  <wakaba@suika.fam.cx>

	* DOM-Node.t: New attributes are added and
	some test results has been changed to sync with new implementation.

++ manakai/lib/Message/DOM/ChangeLog	12 Jul 2007 13:52:28 -0000
2007-07-12  Wakaba  <wakaba@suika.fam.cx>

	* AttributeDefinition.pm (owner_element_type_definition): Implemented.

	* DocumentType.pm (create_document_type_definition): Initialize
	|public_id|, |system_id|, and |internal_subset| attributes
	by empty strings for compatibility with Web browsers.
	(create_document_type): Initialize |internal_subset|
	attribute by an empty string for compatibility with
	Web browsers.

	* ElementTypeDefinition.pm, Entity.pm,
	Notation.pm (owner_document_type_definition): Implemented.

1 package Message::DOM::DOMImplementation;
2 use strict;
3 our $VERSION=do{my @r=(q$Revision: 1.6 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4 push our @ISA, 'Message::IF::DOMImplementation';
5 require Message::DOM::DOMException;
6
7 sub ____new ($) {
8 my $self = bless {}, shift;
9 return $self;
10 } # ____new
11 *new = \&____new;
12
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 create_document_type => 'Message::DOM::DocumentType',
21 create_mc_decode_handler => 'Message::Charset::Encode',
22 create_uri_reference => 'Message::URI::URIReference',
23 get_charset_name_from_uri => 'Message::Charset::Encode',
24 get_uri_from_charset_name => 'Message::Charset::Encode',
25 }->{$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
36 ## MCImplementation
37 sub create_mc_decode_handler;
38 sub get_charset_name_from_uri;
39 sub get_uri_from_charset_name;
40 ## URIImplementation
41 sub create_uri_reference ($$);
42
43 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 $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctypedeclaration>}->{''} = 1;
62 $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctypedeclaration>}->{'3.0'} = 1;
63
64 sub ___report_error { $_[1]->throw }
65
66 ## |DOMImplementation| methods
67
68 sub create_document ($;$$$);
69
70 sub create_document_type ($$$$);
71
72 sub get_feature ($$;$) {
73 my $feature = lc $_[1]; ## TODO: What |lc|?
74 $feature =~ s/^\+//;
75
76 if ($HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''}) {
77 return $_[0];
78 } else {
79 return undef;
80 }
81 } # get_feature
82
83 sub has_feature ($$;$) {
84 my $feature = lc $_[1];
85 my $plus = $feature =~ s/^\+// ? 1 : 0;
86 return $HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''};
87 } # has_feature
88
89 package Message::IF::DOMImplementation;
90
91 =head1 LICENSE
92
93 Copyright 2007 Wakaba <w@suika.fam.cx>
94
95 This program is free software; you can redistribute it and/or
96 modify it under the same terms as Perl itself.
97
98 =cut
99
100 1;
101 ## $Date: 2007/07/08 13:42:42 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24