Changeset 8740


Ignore:
Timestamp:
2004-12-06T13:57:52+13:00 (19 years ago)
Author:
chi
Message:

Modifications for validated METS format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/METSPlug.pm

    r8514 r8740  
    108108
    109109    #eval {$self->{'parser_text'}->parse};
    110     $self->{'parsed_xml'} = $xml_parser;
    111     }
    112 }
    113 
    114 sub xml_end_document {
    115 }
    116 
    117 sub xml_doctype {
    118     my $self = shift(@_);
    119 
    120     my ($expat, $name, $sysid, $pubid, $internal) = @_;
    121  
    122     # allow the short-lived and badly named "GreenstoneArchive" files to be processed
    123     # as well as the "Archive" files which should now be created by import.pl
    124     die "" if ($name !~ /^(Greenstone)?Archive$/);
    125 
     110    $self->{'parsed_xml'} = $xml_parser;
     111    }
    126112    my $outhandle = $self->{'outhandle'};
    127113    print $outhandle "METSPlug: processing $self->{'file'}\n" if $self->{'verbosity'} > 1;
    128114}
    129115
     116sub xml_end_document {
     117}
     118
     119sub xml_doctype {
     120}
     121
    130122sub xml_start_tag {
    131123    my $self = shift(@_);
     
    133125
    134126    $self->{'element'} = $element;
    135     #print STDERR "###METS Element=$element\n";
    136127
    137128    #**deal with dmdSection
    138129    if ($element eq "mets:dmdSec" || $element eq "gsdl3:Metadata"){   
    139130    $self->xml_dmd_start_tag (@_);
     131    } elsif ($element eq "mets:file") {
     132    $_{'ID'} =~ m/FILE(.*)/;
     133    $self->{'file_Id'} = $1;
    140134    } elsif ($element eq "mets:FLocat"){
    141135    #***deal with fileSection
    142     $self->xml_file_start_tag (@_);
     136    $self->xml_fileloc_start_tag (@_);
    143137    } elsif ($element eq "mets:div"){
    144138    #***deal with StrucMap Section
     
    160154}
    161155
    162 sub xml_file_start_tag {
     156sub xml_fileloc_start_tag {
    163157    my $self = shift (@_);
    164158    my ($expat, $element) = @_;
    165159
    166160    my $xlink = $_{'xlink:href'};
    167     my ($section_num) = ($_{'ID'} =~ m/^FILE(.*)$/);
     161    #my ($section_num) = ($_{'ID'} =~ m/^FLOCAT(.*)$/);
     162    my $section_num = $self->{'file_Id'};
    168163
    169164    return if (!defined $section_num);
     
    190185        my $content_list = $self->{'fileSec_table'}->{"$section_num"};
    191186        push (@$content_list, $section_content);
    192         #print STDERR "###Adding the content=$xml_content\n";   
    193187    }
    194188    }
     
    199193    my ($expat, $element) = @_;
    200194
    201     if ($_{'ID'} ne "All") {
    202     my ($section_num) = ($_{'ID'} =~ m/DS(.*)/);
    203    
     195
     196    my ($section_num) = ($_{'ID'} =~ m/DS(.*)/);
     197
     198    if ($_{'ID'} ne "DSAll"){
    204199    if ($self->{'section_level'}==0) {
    205200        $self->open_document();
     
    211206    $self->{'section_level'}++;
    212207   
    213         #***Add metadata from dmdSection
     208    #***Add metadata from dmdSection
    214209    my $md_list = $self->{'dmdSec_table'}->{"$section_num"};
    215210   
     
    220215    }
    221216   
    222         #*** Add content from fileSection
     217    #*** Add content from fileSection
    223218    my $content_list = $self->{'fileSec_table'}->{"$section_num"};
    224 
     219   
    225220    foreach my $section_content (@$content_list){
    226221        my $content = $section_content->{'section_content'};
    227222        $self->{'doc_obj'}->add_utf8_text($self->{'section'},$content);
    228     }   
     223    }
    229224    }
    230225}
     
    248243    $self->{'metadata_name'} = "";
    249244    $self->{'metadata_value'} = "";
    250     }
     245    } elsif ($element eq "mets:file"){
     246    $self->{'file_id'} = "";
     247    }
     248   
    251249   
    252250    #*** StrucMap Section
Note: See TracChangeset for help on using the changeset viewer.