function tripal_pub_PMID_parse_journal_issue

2.x tripal_pub.PMID.inc tripal_pub_PMID_parse_journal_issue($xml, &$pub)
3.x tripal_chado.pub_importer_PMID.inc tripal_pub_PMID_parse_journal_issue($xml, &$pub)
1.x PMID.inc tripal_pub_PMID_parse_journal_issue($xml, &$pub)

Parses the section from the XML returned from PubMed that contains information about a journal issue

Parameters

$xml: The XML to parse

$pub: The publication object to which additional details will be added

Related topics

1 call to tripal_pub_PMID_parse_journal_issue()
tripal_pub_PMID_parse_journal in tripal_pub/includes/importers/tripal_pub.PMID.inc
Parses the section from the XML returned from PubMed that contains information about a journal

File

tripal_pub/includes/importers/tripal_pub.PMID.inc, line 798
This file provides support for importing and parsing of results from the NCBI PubMed database. The functions here are used by both the publication importer setup form and the publication importer.

Code

function tripal_pub_PMID_parse_journal_issue($xml, &$pub) {

  while ($xml->read()) {
    $element = $xml->name;

    if ($xml->nodeType == XMLReader::END_ELEMENT and $element == 'JournalIssue') {
      // if we're at the </JournalIssue> element then we're done
      return;
    }
    if ($xml->nodeType == XMLReader::ELEMENT) {
      switch ($element) {
        case 'Volume':
          $xml->read();
          $pub['Volume'] = $xml->value;
          break;
        case 'Issue':
          $xml->read();
          $pub['Issue'] = $xml->value;
          break;
        case 'PubDate':
          $date = tripal_pub_PMID_parse_date($xml, 'PubDate');
          $year = $date['year'];
          $month = array_key_exists('month', $date) ? $date['month'] : '';
          $day = array_key_exists('day', $date) ? $date['day'] : '';
          $medline = array_key_exists('medline', $date) ? $date['medline'] : '';

          $pub['Year'] = $year;
          if ($month and $day and $year) {
            $pub['Publication Date'] = "$year $month $day";
          }
          elseif ($month and !$day and $year) {
            $pub['Publication Date'] = "$year $month";
          }
          elseif (!$month and !$day and $year) {
            $pub['Publication Date'] = $year;
          }
          elseif ($medline) {
            $pub['Publication Date'] = $medline;
          }
          else {
            $pub['Publication Date'] = "Date Unknown";
          }
          break;
        default:
          break;
      }
    }
  }
}