| 1 | package HTTP::OAI::Metadata::METS; | ||
| 2 | |||
| 3 | 1 | ▶ | use XML::LibXML; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use XML::LibXML::XPathContext; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | @ISA = qw( HTTP::OAI::Metadata ); | |
| 7 | |||
| 8 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | our $VERSION = '4.13'; | |
| 11 | |||
| 12 | 1 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 13 | 1 | my $class = shift; | |
| 14 | 1 | my $self = $class->SUPER::new(@_); | |
| 15 | 1 | my %args = @_; | |
| 16 | 1 | $self; | |
| 17 | } | ||
| 18 | |||
| 19 | sub _xc | ||
| 20 | 5 | ▶ | { |
|
Subroutine
_xc: called CC=1 SCAR=0.0
| |||
| 21 | 5 | my $xc = XML::LibXML::XPathContext->new( @_ ); | |
| 22 | 5 | $xc->registerNs( 'oai_dc', HTTP::OAI::OAI_NS ); | |
| 23 | 5 | $xc->registerNs( 'mets', 'http://www.loc.gov/METS/' ); | |
| 24 | 5 | $xc->registerNs( 'xlink', 'http://www.w3.org/1999/xlink' ); | |
| 25 | 5 | return $xc; | |
| 26 | } | ||
| 27 | |||
| 28 | sub files | ||
| 29 | 1 | ▶ | { |
|
Subroutine
files: called CC=4 SCAR=13.9
Pod
undocumented
| |||
| 30 | 1 | my $self = shift; | |
| 31 | 1 | my $dom = $self->dom; | |
| 32 | |||
| 33 | 1 | my $xc = _xc($dom); | |
| 34 | |||
| 35 | 1 | my @files; | |
| 36 | 1 | foreach my $file ($xc->findnodes( '*//mets:file' )) | |
| 37 | { | ||
| 38 | 4 | my $f = {}; | |
| 39 | 4 | foreach my $attr ($file->attributes) | |
| 40 | { | ||
| 41 | 28 | $f->{ $attr->nodeName } = $attr->nodeValue; | |
| 42 | } | ||
| 43 | 4 | $file = _xc($file); | |
| 44 | 4 | foreach my $locat ($file->findnodes( 'mets:FLocat' )) | |
| 45 | { | ||
| 46 | 4 | $f->{ url } = $locat->getAttribute( 'xlink:href' ); | |
| 47 | } | ||
| 48 | 4 | push @files, $f; | |
| 49 | } | ||
| 50 | |||
| 51 | 1 | return @files; | |
| 52 | } | ||
| 53 | |||
| 54 | 1 | 1; | |
| 55 | |||
| 56 | __END__ | ||