Ignore:
Timestamp:
2018-10-25T21:17:02+13:00 (6 years ago)
Author:
ak19
Message:

Instead of the docoid being stored in the docsql-<OID>.xml filename, all filenames produced are back to being docsql.xml, but the root element Archive now contains the doc oid as attribute: <Archive docoid="oid">

Location:
main/trunk/greenstone2/perllib/plugouts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugouts/GreenstoneSQLPlugout.pm

    r32541 r32542  
    5252# It's fine: the die() stmts all take place before setting up the super class' begin
    5353
     54# TODO Q: about build_mode: how to detect removeold
    5455# TODO: deal with -removeold and everything? Or type out instructions for user
    5556
    5657# TODO Q: what is "group" in GreenstoneXMLPlugout?
    5758# TODO Q: site_name only exists for GS3. What about GS2?
     59
    5860
    5961my $process_mode_list =
     
    216218}
    217219
    218 # produce files called docsql-<OID>.xml instead of doc.xml
     220# Produce files called docsql.xml instead of doc.xml
    219221sub get_doc_xml_filename {
    220222    my $self = shift (@_);
    221223    my ($doc_obj) = @_;
    222224   
    223     my $doc_id = $doc_obj->get_OID();
    224     my $filename = $doc_id ? "docsql-".$doc_id.".xml" : "docsql.xml";
    225     return $filename;
    226 }
    227    
     225    return "docsql.xml";
     226}
     227
     228# overriding to store doc OID as attribute of top level element: <Archive docoid="oid">
     229sub output_xml_header {
     230    my $self = shift (@_);
     231    my ($outhandle, $doc_oid) = @_;
     232
     233    print $outhandle '<?xml version="1.0" encoding="utf-8" standalone="no"?>' . "\n";
     234    print $outhandle "<!DOCTYPE Archive SYSTEM \"http://greenstone.org/dtd/Archive/1.0/Archive.dtd\">\n";
     235    print $outhandle "<Archive docoid=\"$doc_oid\">\n";
     236}
     237 
    228238# TODO: check arc-inf.db for whether each entry is to be deleted/indexed/reindexed/been indexed
    229239sub saveas {
  • main/trunk/greenstone2/perllib/plugouts/GreenstoneXMLPlugout.pm

    r32536 r32542  
    190190    # only output the header if we have started a new doc
    191191    if (!$self->is_group() || $self->{'new_doc_dir'}) {
    192     $self->output_xml_header($outhandler);
     192    $self->output_xml_header($outhandler, $doc_obj->get_OID());
    193193    }
    194194 
     
    238238sub output_xml_header {
    239239    my $self = shift (@_);
    240     my ($outhandle) = @_;
     240    my ($outhandle, $doc_oid) = @_;
    241241
    242242    print $outhandle '<?xml version="1.0" encoding="utf-8" standalone="no"?>' . "\n";
Note: See TracChangeset for help on using the changeset viewer.