function tripal_pub_PMID_parse_journal

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

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

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()
tripal_pub_PMID_parse_article in tripal_pub/includes/importers/tripal_pub.PMID.inc
Parses the section from the XML returned from PubMed that contains information about an article.

File

tripal_pub/includes/importers/tripal_pub.PMID.inc, line 745
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($xml, &$pub) {

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

    if ($xml->nodeType == XMLReader::END_ELEMENT and $element == 'Journal') {
      return;
    }
    if ($xml->nodeType == XMLReader::ELEMENT) {
      switch ($element) {
        case 'ISSN':
          $issn_type = $xml->getAttribute('IssnType');
          $xml->read();
          $issn = $xml->value;
          $pub['ISSN'] = $issn;
          if ($issn_type == 'Electronic') {
            $pub['eISSN'] = $issn;
          }
          if ($issn_type == 'Print') {
            $pub['pISSN'] = $issn;
          }
          break;
        case 'JournalIssue':
          // valid values of cited_medium are 'Internet' and 'Print'
          $cited_medium = $xml->getAttribute('CitedMedium');
          tripal_pub_PMID_parse_journal_issue($xml, $pub);
          break;
        case 'Title':
          $xml->read();
          $pub['Journal Name'] = $xml->value;
          break;
        case 'ISOAbbreviation':
          $xml->read();
          $pub['Journal Abbreviation'] = $xml->value;
          break;
        default:
          break;
      }
    }
  }
}