Changeset 8740
- Timestamp:
- 2004-12-06T13:57:52+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/METSPlug.pm
r8514 r8740 108 108 109 109 #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 } 126 112 my $outhandle = $self->{'outhandle'}; 127 113 print $outhandle "METSPlug: processing $self->{'file'}\n" if $self->{'verbosity'} > 1; 128 114 } 129 115 116 sub xml_end_document { 117 } 118 119 sub xml_doctype { 120 } 121 130 122 sub xml_start_tag { 131 123 my $self = shift(@_); … … 133 125 134 126 $self->{'element'} = $element; 135 #print STDERR "###METS Element=$element\n";136 127 137 128 #**deal with dmdSection 138 129 if ($element eq "mets:dmdSec" || $element eq "gsdl3:Metadata"){ 139 130 $self->xml_dmd_start_tag (@_); 131 } elsif ($element eq "mets:file") { 132 $_{'ID'} =~ m/FILE(.*)/; 133 $self->{'file_Id'} = $1; 140 134 } elsif ($element eq "mets:FLocat"){ 141 135 #***deal with fileSection 142 $self->xml_file _start_tag (@_);136 $self->xml_fileloc_start_tag (@_); 143 137 } elsif ($element eq "mets:div"){ 144 138 #***deal with StrucMap Section … … 160 154 } 161 155 162 sub xml_file _start_tag {156 sub xml_fileloc_start_tag { 163 157 my $self = shift (@_); 164 158 my ($expat, $element) = @_; 165 159 166 160 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'}; 168 163 169 164 return if (!defined $section_num); … … 190 185 my $content_list = $self->{'fileSec_table'}->{"$section_num"}; 191 186 push (@$content_list, $section_content); 192 #print STDERR "###Adding the content=$xml_content\n";193 187 } 194 188 } … … 199 193 my ($expat, $element) = @_; 200 194 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"){ 204 199 if ($self->{'section_level'}==0) { 205 200 $self->open_document(); … … 211 206 $self->{'section_level'}++; 212 207 213 208 #***Add metadata from dmdSection 214 209 my $md_list = $self->{'dmdSec_table'}->{"$section_num"}; 215 210 … … 220 215 } 221 216 222 217 #*** Add content from fileSection 223 218 my $content_list = $self->{'fileSec_table'}->{"$section_num"}; 224 219 225 220 foreach my $section_content (@$content_list){ 226 221 my $content = $section_content->{'section_content'}; 227 222 $self->{'doc_obj'}->add_utf8_text($self->{'section'},$content); 228 } 223 } 229 224 } 230 225 } … … 248 243 $self->{'metadata_name'} = ""; 249 244 $self->{'metadata_value'} = ""; 250 } 245 } elsif ($element eq "mets:file"){ 246 $self->{'file_id'} = ""; 247 } 248 251 249 252 250 #*** StrucMap Section
Note:
See TracChangeset
for help on using the changeset viewer.