--- messaging/manakai/bin/daf.pl 2006/08/15 10:59:24 1.16 +++ messaging/manakai/bin/daf.pl 2006/11/05 10:57:29 1.19 @@ -1,24 +1,25 @@ #!/usr/bin/perl -w use strict; use Message::Util::QName::Filter { - c => q, - DIS => q, dis => q, dp => q, - fe => q, ManakaiDOM => q, - pc => q, swcfg21 => q, - Util => q, }; -our$VERSION=do{my @r=(q$Revision: 1.16 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; +our$VERSION=do{my @r=(q$Revision: 1.19 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; use Cwd; use Getopt::Long; use Pod::Usage; our %Opt = (create_module => []); my @target_modules; GetOptions ( + 'create-dtd-driver=s' => sub { + shift; + my $i = [split /\s+/, shift, 3]; + $i->[3] = 'dtd-driver'; + push @{$Opt{create_module}}, $i; + }, 'create-dtd-modules=s' => sub { shift; my $i = [split /\s+/, shift, 3]; @@ -44,6 +45,7 @@ 'daem-file-suffix=s' => \$Opt{daem_suffix}, 'dafs-file-suffix=s' => \$Opt{dafs_suffix}, 'dafx-file-suffix=s' => \$Opt{dafx_suffix}, + 'dtd-file-suffix=s' => \$Opt{dtd_suffix}, 'help' => \$Opt{help}, 'load-module=s' => sub { shift; @@ -98,8 +100,8 @@ $Opt{daem_suffix} = '.dafm' unless defined $Opt{daem_suffix}; $Opt{dafx_suffix} = '.dafx' unless defined $Opt{dafx_suffix}; $Opt{dafs_suffix} = '.dafs' unless defined $Opt{dafs_suffix}; +$Opt{dtd_suffix} = '.dtd' unless defined $Opt{dtd_suffix}; $Opt{mod_suffix} = '.mod' unless defined $Opt{mod_suffix}; -$Message::DOM::DOMFeature::DEBUG = 1 if $Opt{debug}; require Error; $Error::Debug = 1 if $Opt{debug}; $Message::Util::Error::VERBOSE = 1 if $Opt{verbose}; @@ -131,35 +133,23 @@ my $start_time; BEGIN { $start_time = time } -use Message::Util::DIS::DNLite; - -my %feature; +use Message::DOM::DOMCore; for (@{$Opt{create_module}}) { my (undef, undef, undef, $out_type) = @$_; if ($out_type eq 'perl-pm') { require 'manakai/daf-perl-pm.pl'; - $feature{'+' . ExpandedURI q} = '1.0'; } elsif ($out_type eq 'perl-t') { require 'manakai/daf-perl-t.pl'; - $feature{ExpandedURI q} = '3.0'; - $feature{'+' . ExpandedURI q} = '1.0'; - $feature{'+' . ExpandedURI q} = '1.0'; } elsif ($out_type eq 'dtd-modules') { require 'manakai/daf-dtd-modules.pl'; - $feature{ExpandedURI q} = '3.0'; - $feature{'+' . ExpandedURI q} = '3.0'; + } elsif ($out_type eq 'dtd-driver') { + require 'manakai/daf-dtd-modules.pl'; } } -our $limpl = $Message::DOM::ImplementationRegistry->get_implementation - ({ExpandedURI q => '3.0', - '+' . ExpandedURI q => '1.0', - '+' . ExpandedURI q => '1.0', - %feature, - }); -our $impl = $limpl->get_feature (ExpandedURI q => '1.0'); +our $impl = $Message::DOM::ImplementationRegistry->get_implementation; ## --- Loading and Updating the Database @@ -169,7 +159,6 @@ $db->dom_config->set_parameter ('error-handler' => \&daf_on_error); my $parser = $impl->create_dis_parser; -my $DNi = $impl->get_feature (ExpandedURI q => '1.0'); my %ModuleSourceDISDocument; my %ModuleSourceDNLDocument; my %ModuleNameNamespaceBinding = ( @@ -296,7 +285,6 @@ daf_check_undefined (); -undef $DNi; undef %ModuleSourceDNLDocument; exit $HasError if $HasError; @@ -311,6 +299,8 @@ daf_perl_t ($mod_uri, $out_file_path, $mod_for); } elsif ($out_type eq 'dtd-modules') { daf_dtd_modules ($mod_uri, $out_file_path, $mod_for); + } elsif ($out_type eq 'dtd-driver') { + daf_dtd_driver ($mod_uri, $out_file_path, $mod_for); } } @@ -323,7 +313,6 @@ undef $db; status_msg "done"; -undef $limpl; undef $impl; { @@ -416,7 +405,7 @@ my $dis_doc = $ModuleSourceDISDocument{$module_uri}; next M unless $dis_doc; verbose_msg_ qq...>; - my $dnl_doc = $DNi->convert_dis_document_to_dnl_document + my $dnl_doc = $impl->convert_dis_document_to_dnl_document ($dis_doc, database_arg => $db, base_namespace_binding => {(map {$_->local_name => $_->target_namespace_uri}