Show
Ignore:
Timestamp:
28.08.2008 17:20:44 (11 years ago)
Author:
ak19
Message:

OAIPlugin now works again: 1. needs to inherit from ReadTextFile? as well in order to have access to the method textcat_get_language_encoding; 2. if dc is not specified as a prefix in each metadata element tag, looks inside the containing/wrapper element to see if that is set to dc and if so, uses that as the prefix.

Files:
1 modified

Legend:

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

    r17026 r17066  
    3434 
    3535use ReadXMLFile; 
     36use ReadTextFile; # needed for subroutine textcat_get_language_encoding 
    3637 
    3738sub BEGIN { 
    38     @OAIPlugin::ISA = ('ReadXMLFile'); 
     39    @OAIPlugin::ISA = ('ReadXMLFile', 'ReadTextFile'); 
    3940} 
    4041 
     
    4647    'reqd' => "no", 
    4748    'deft' => &get_default_process_exp() }, 
     49      { 'name' => "input_encoding", # needed by subroutine textcat_get_language_encoding 
     50    'desc' => "{ReadTextFile.input_encoding}", 
     51    'type' => "enum", 
     52    'list' => $ReadTextFile::encoding_plus_auto_list, 
     53    'reqd' => "no" , 
     54    'deft' => "auto" } 
    4855      ]; 
    4956 
     
    410417    my($namespace,$top_level_prefix) = ($wrapper_metadata_xml =~ m/^(.*?):(.*?)$/); 
    411418 
    412     if ($top_level_prefix !~ /dc$/) { 
     419    # sometimes, the dc namespace is not specified as the prefix in each element (like <dc:title>) 
     420    # but is rather defined in the wrapper element containing the various dc meta elements, 
     421    # like <dc><title></title><creator></creator></dc>. 
     422    # In such a case, we use this wrapper element as the top_level_prefix 
     423    if(!defined $top_level_prefix && defined $wrapper_metadata_xml && $wrapper_metadata_xml =~ m/dc$/) { 
     424        $top_level_prefix = $wrapper_metadata_xml; 
     425    } 
     426 
     427    if ($top_level_prefix !~ m/dc$/) { 
    413428        print $outhandle "Warning: OAIPlugin currently only designed for Dublin Core (or variant) metadata\n"; 
    414429        print $outhandle "         This recorded metadata section '$top_level_prefix' does not appear to match.\n"; 
     
    434449        { 
    435450        $metaname = "$top_level_prefix.$metaname"; 
     451#       print STDERR "*** metaname = $metaname\tmetavalue = $metavalue\n"; 
    436452        } 
    437453        $metaname =~ s/\.(.)/\.\u$1/;