| 1 | package PICA::Parser::PPXML; | ||||||||||||
| 2 | 8 | ▶ | use v5.14.1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | 8 | our $VERSION = '1.18'; | |||||||||||
| 5 | |||||||||||||
| 6 | 8 | ▶ | use parent 'PICA::Parser::XML'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | sub _next_record { | ||||||||||||
| 9 | 5 | ▶ | my ($self) = @_; | ||||||||||
|
Subroutine
_next_record: called CC=6 SCAR=17.9
| |||||||||||||
| 10 | |||||||||||||
| 11 | 5 | my $reader = $self->{xml_reader}; | |||||||||||
| 12 | return | ||||||||||||
| 13 | 5 | ▶ | unless $reader->nextElement('record', | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 14 | 'http://www.oclcpica.org/xmlns/ppxml-1.0'); | ||||||||||||
| 15 | |||||||||||||
| 16 | 4 | my @record; | |||||||||||
| 17 | |||||||||||||
| 18 | # get all field from PICA record; | ||||||||||||
| 19 | 4 | foreach | |||||||||||
| 20 | my $field ($reader->copyCurrentNode(1)->getElementsByLocalName('tag')) | ||||||||||||
| 21 | { | ||||||||||||
| 22 | 55 | my @field; | |||||||||||
| 23 | |||||||||||||
| 24 | # get field tag number | ||||||||||||
| 25 | 55 | my $tag = $field->getAttribute('id'); | |||||||||||
| 26 | 55 | ▶ | my $occ = $field->getAttribute('occ') // ''; | ||||||||||
|
Condition50%1/2
$field->getAttribute("occ") // ""
MC/DC0%0/1
$field->getAttribute("occ") // ""
$field->getAttribute("occ")
Truth table50%1/2
A
A= $field->getAttribute("occ")
| |||||||||||||
| 27 | 55 | ▶ | $occ = sprintf '%02d', $occ if $occ ne ''; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 28 | 55 | push(@field, ($tag, $occ)); | |||||||||||
| 29 | |||||||||||||
| 30 | # get all subfields | ||||||||||||
| 31 | 55 | foreach my $subfield ($field->getElementsByLocalName('subf')) { | |||||||||||
| 32 | 118 | my $subfield_code = $subfield->getAttribute('id'); | |||||||||||
| 33 | 118 | my $subfield_data = $subfield->textContent; | |||||||||||
| 34 | 118 | push(@field, ($subfield_code, $subfield_data)); | |||||||||||
| 35 | } | ||||||||||||
| 36 | 55 | push(@record, [@field]); | |||||||||||
| 37 | } | ||||||||||||
| 38 | |||||||||||||
| 39 | 4 | return \@record; | |||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | 8 | 1; | |||||||||||
| 43 | __END__ | ||||||||||||