/[drupal]/contributions/modules/biblio/crossref_unixref_parser.inc
ViewVC logotype

Diff of /contributions/modules/biblio/crossref_unixref_parser.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.6, Mon Apr 20 21:14:38 2009 UTC revision 1.1.2.7, Mon Jun 1 01:33:31 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: crossref_unixref_parser.inc,v 1.1.2.5 2009/04/17 02:01:40 rjerome Exp $  // $Id: crossref_unixref_parser.inc,v 1.4 2009/06/01 01:31:41 rjerome Exp $
3  function unixref_startElement($parser, $name, $attrs) {  function unixref_startElement($parser, $name, $attrs) {
4    global $node, $element,  $attribute, $auth_category, $contrib_count, $org_count;    global $node, $element,  $attribute, $auth_category, $contrib_count, $org_count;
5    switch ($name) {    switch ($name) {
# Line 16  function unixref_startElement($parser, $ Line 16  function unixref_startElement($parser, $
16      case 'sa_component':      case 'sa_component':
17        $node['biblio_type'] = _unixref_type_map($name);        $node['biblio_type'] = _unixref_type_map($name);
18        break;        break;
19        case 'journal_article':
20        case 'conference_paper':
21        case 'content_item':
22        case 'report-paper_metadata':
23        case 'standard_metadata':
24        case 'database_date':
25        case 'component':
26          $node['year'] = '';
27          $node['doi']  = '';
28          break;
29      case 'person_name' :      case 'person_name' :
30        $auth_category = _unixref_get_contributor_category($attrs['contributor_role']);        $auth_category = _unixref_get_contributor_category($attrs['contributor_role']);
31        if (!isset($contrib_count))        if (!isset($contrib_count))
# Line 36  function unixref_startElement($parser, $ Line 46  function unixref_startElement($parser, $
46    }    }
47    $element = $name;    $element = $name;
48  }  }
49    function unixref_decode(&$item, $key) {
50      $item = html_entity_decode($item, NULL, 'UTF-8');
51      print $key.' = '. $item . "\n";
52    }
53  function unixref_endElement($parser, $name) {  function unixref_endElement($parser, $name) {
54    global $node, $nids, $element, $attribute, $terms, $batch_proc, $session_id, $save_node, $auth_category, $contrib_count, $org_count;    global $node, $nids, $element, $attribute, $terms, $batch_proc, $session_id, $save_node, $auth_category, $contrib_count, $org_count;
55    switch ($name) {    switch ($name) {
56      case 'doi_record' :      case 'doi_record' :
57          array_walk_recursive($node,'unixref_decode' );
58        $nids[] = biblio_save_node($node, $batch, $session_id, $save_node);        $nids[] = biblio_save_node($node, $batch, $session_id, $save_node);
59        break;        break;
60      case 'person_name' :      case 'person_name' :
# Line 76  function unixref_endElement($parser, $na Line 91  function unixref_endElement($parser, $na
91      case 'database_date':      case 'database_date':
92      case 'component':      case 'component':
93        $node['biblio_year'] = $node['year'];        $node['biblio_year'] = $node['year'];
94          $node['biblio_doi']  = $node['doi'];
95        break;        break;
96      case 'issn':      case 'issn':
97        if($attribute == 'issn_print') $node['biblio_issn'] = $node['issn'];        if($attribute == 'issn_print') $node['biblio_issn'] = $node['issn'];
98          $node['issn'] = '';
99        break;        break;
100      case 'isbn':      case 'isbn':
101        if($attribute == 'isbn_print') $node['biblio_isbn'] = $node['isbn'];        if($attribute == 'isbn_print') $node['biblio_isbn'] = $node['isbn'];
102          $node['isbn'] = '';
103        break;        break;
104      default :      default :
105    }    }
# Line 90  function unixref_endElement($parser, $na Line 108  function unixref_endElement($parser, $na
108  }  }
109  function unixref_characterData($parser, $data) {  function unixref_characterData($parser, $data) {
110    global $node, $element, $auth_category, $contrib_count, $org_count;    global $node, $element, $auth_category, $contrib_count, $org_count;
111      $data = htmlspecialchars_decode($data);
112    if (trim($data)) {    if (trim($data)) {
113      switch ($element) {      switch ($element) {
114        case 'surname' :        case 'surname' :
# Line 138  function _unixref_field_map($field) { Line 157  function _unixref_field_map($field) {
157        'issue'               => 'biblio_issue',        'issue'               => 'biblio_issue',
158        'edition_number'      => 'biblio_edition',        'edition_number'      => 'biblio_edition',
159        'section'             => 'biblio_section',        'section'             => 'biblio_section',
160        'doi'                 => 'biblio_doi',        'doi'                 => 'doi',
161        'title'               => 'title',        'title'               => 'title',
162        'isbn'                => 'isbn',        'isbn'                => 'isbn',
163        'issn'                => 'issn',        'issn'                => 'issn',

Legend:
Removed from v.1.1.2.6  
changed lines
  Added in v.1.1.2.7

  ViewVC Help
Powered by ViewVC 1.1.2