function tripal_pub_remote_search_AGL_get_subfield

2.x tripal_pub.AGL.inc tripal_pub_remote_search_AGL_get_subfield($xml)
3.x tripal_chado.pub_importer_AGL.inc tripal_pub_remote_search_AGL_get_subfield($xml)
1.x AGL.inc tripal_pub_remote_search_AGL_get_subfield($xml)
2 calls to tripal_pub_remote_search_AGL_get_subfield()
tripal_pub_AGL_parse_pubxml in tripal_pub/includes/importers/AGL.inc
tripal_pub_remote_search_AGL_get_author in tripal_pub/includes/importers/AGL.inc

File

tripal_pub/includes/importers/AGL.inc, line 827

Code

function tripal_pub_remote_search_AGL_get_subfield($xml) {
  $codes = array();
  while ($xml->read()) {
    $sub_element = $xml->name;
    // when we've reached the end of the datafield element then break out of the while loop
    if ($xml->nodeType == XMLReader::END_ELEMENT and $sub_element == 'datafield') {
      return $codes;
    }
    // if inside the subfield element then get the code
    if ($xml->nodeType == XMLReader::ELEMENT and $sub_element == 'subfield') {
      $code = $xml->getAttribute('code');
      $xml->read();
      $value = $xml->value;
      $codes[$code] = $value;
    }
  }
  return $codes;
}