Changeset 28267


Ignore:
Timestamp:
09/12/13 13:03:28 (8 years ago)
Author:
davidb
Message:

Code change to allow doc.xml files that do not have a DOCTYPE line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/GreenstoneXMLPlugin.pm

    r28265 r28267  
    105105    # can we process this file??
    106106    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     107
    107108    return undef unless $self->can_process_this_file($filename_full_path);
    108109
     
    145146
    146147sub xml_start_document {
    147 }
    148 
    149 sub xml_end_document {
    150 }
    151 
    152 sub get_doctype {
    153     my $self = shift(@_);
    154    
    155     return "(Greenstone)?Archive";
    156 }
    157 
    158 
    159 sub xml_doctype {
     148
    160149    my $self = shift(@_);
    161150
    162151    my ($expat, $name, $sysid, $pubid, $internal) = @_;
    163 
    164     # allow the short-lived and badly named "GreenstoneArchive" files to be processed
    165     # as well as the "Archive" files which should now be created by import.pl
    166     die "" if ($name !~ /^(Greenstone)?Archive$/);
    167152
    168153    my $outhandle = $self->{'outhandle'};
    169154    print $outhandle "GreenstoneXMLPlugin: processing $self->{'file'}\n" if $self->{'verbosity'} > 1;
    170155    print STDERR "<Processing n='$self->{'file'}' p='GreenstoneXMLPlugin'>\n" if $self->{'gli'};
     156
     157}
     158
     159sub xml_end_document {
     160}
     161
     162sub get_doctype {
     163    my $self = shift(@_);
     164   
     165    return "(Greenstone)?Archive";
     166}
     167
     168
     169sub xml_doctype {
     170    my $self = shift(@_);
     171
     172    my ($expat, $name, $sysid, $pubid, $internal) = @_;
     173
     174    # Some doc.xml files that have been manipulated by XML::Rules
     175    # no longer have the DOCTYPE line.  No obvious way to fix
     176    # the XML::Rules based code to keep DOCTYPE, so commenting
     177    # out the code below to allow doc.xml files with DOCTYPE
     178    # to be processed
     179
     180    # allow the short-lived and badly named "GreenstoneArchive" files to be processed
     181    # as well as the "Archive" files which should now be created by import.pl
     182##    die "" if ($name !~ /^(Greenstone)?Archive$/);
     183
     184#    my $outhandle = $self->{'outhandle'};
     185#    print $outhandle "GreenstoneXMLPlugin: processing $self->{'file'}\n" if $self->{'verbosity'} > 1;
     186#    print STDERR "<Processing n='$self->{'file'}' p='GreenstoneXMLPlugin'>\n" if $self->{'gli'};
    171187
    172188}
Note: See TracChangeset for help on using the changeset viewer.