Skip to content
Snippets Groups Projects
Commit 11c99a06 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- improved get_files()

parent 718b2e19
No related branches found
No related tags found
No related merge requests found
......@@ -274,7 +274,7 @@ sub check_if_db_conform ($$) {
my $str_local_reps = 'mets:techMD/mets:mdWrap/mets:xmlData/*[local-name()=\'dnx\']/*[local-name()=\'section\']/*[local-name()=\'record\']/*[local-name()=\'key\' and @id=\'label\']';
my $compiled_xpath_localreps = XML::LibXML::XPathExpression->new( $str_local_reps);
my $compiled_xpath_localreps2 = XML::LibXML::XPathExpression->new('/mets:mets/mets:amdSec/mets:techMD/mets:mdWrap/mets:xmlData/dnx/section/record/key[@id=\'label\']=\'LOCAL\'');
my $compiled_xpath_filegrps = XML::LibXML::XPathExpression->new('/mets:mets/mets:fileSec/mets:fileGrp');
my $compiled_xpath_filesec = XML::LibXML::XPathExpression->new('/mets:mets/mets:fileSec');
my $compiled_xpath_flocat = XML::LibXML::XPathExpression->new('mets:file/mets:FLocat');
my $compiled_xpath_id = XML::LibXML::XPathExpression->new('@ID');
my $compiled_xpath_admid = XML::LibXML::XPathExpression->new('@ADMID');
......@@ -347,18 +347,9 @@ sub check_if_db_conform ($$) {
my $xp = shift;
my $filename = shift;
my $repid = shift;
my @files;
my $filegrpnodes = $xp->find($compiled_xpath_filegrps);
foreach my $filegrpnode ($filegrpnodes->get_nodelist) {
if ($filegrpnode->findvalue($compiled_xpath_admid) eq $repid) {
my $filesnodes = $filegrpnode->find($compiled_xpath_flocat);
foreach my $filesnode ($filesnodes->get_nodelist) {
my $value = $filesnode->findvalue($compiled_xpath_xlinhref);
check_if_db_conform($value, $filename);
push @files, sprintf("%s", $value);
}
}
}
my $files_nodes = $xp->find("mets:mets/mets:fileSec/mets:fileGrp[\@ADMID='$repid']/mets:file/mets:FLocat/\@xlin:href");
my @files = map { $_->nodeValue} $files_nodes->get_nodelist();
return @files;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment