21. Generierung eines C3+-XML-Resultstrings und Konvertierung nach PICA+
Kapitel hinzufügen

JavaScript zur Erzeugung eines C3+-XML-Resultstrings und Konvertierung der Datei in das PICA+-Format. Das Script ist Bestandteil von BCS-2 V6 Professional. Sie finden es unter dem Dateinamen generate_c3_plus_xml.js im folgenden Verzeichnis: C:\ProgramData\ImageWareComponents\BCS2_V6_64\js.

//
// computes the complete C3+ Results for all Pages...
//


//
// separate Lists for iterating over
//
var cl           = job.c3PlusResults();
var languages    = [];
var titles       = [];
var sub_titles   = [];
var abstracts    = [];
var page_numbers = [];
var authors      = [];

// ut.notifyUser('#TOC-Items:', cl.length);

for (i = 0; i < cl.length; i++) {

    //
    // TOC-Item
    //
    ti = cl[i];

    language = ti['languages'];
    languages.push(language);

    title_map = ti['title'];
    title     = title_map['lang_default'];
    titles.push(title);

    sub_title_map = ti['sub_title'];
    sub_title     = sub_title_map['lang_default'];
    sub_titles.push(sub_title);

    abstract_map = ti['abstract'];
    abstract     = abstract_map['lang_default'];
    abstracts.push(abstract);

    authors_map = ti['authors'];
    author      = authors_map['lang_default'];
    authors.push(author);

    page_num_map = ti['page_number'];
    page_num     = page_num_map['lang_default'];
    page_numbers.push(page_num);

} // for i...

// ut.notifyUser('#Titles', titles.length);
// ut.notifyUser('#Sub-Titles', sub_titles.length);
// ut.notifyUser('#Abstracts', abstracts.length);
// ut.notifyUser('#Pagenumbers', page_numbers.length);
// ut.notifyUser('#Authors', authors.length);

var aut_list;
var aut_map;
var aut;

//
// create Root Element
//
xr.initGenericDoc ("workitem");
xr.xmlAddAttribute ("C3ID", job.keyMap['ME_Order_ID']);

//
// Meta-Data-Header
//
xr.xmlPush ("ILL_MAIL");
xr.xmlPush ("workitem");

//
// c3id ist entweder BCS-2 Jobnummer oder ME-Auftragsnummer
//
xr.xmlAddChild("c3id", job.keyMap['ME_Order_ID']);

//
// transaction_group_qualifier (ILL-Item: transaction-group-qualifier): ISIL der Bibliothel (Lieferant)
//
xr.xmlAddChild("transaction_group_qualifier", job.index1);

//
// network_id: Verbund-ID, also ppn, oder HT-Nummer oder b3katnummer, etc.
//
xr.xmlAddChild("network_id", job.index2);


//
// zdbid: ID der Zeitschrift in der ZDB
//
xr.xmlAddChild("zdbid", job.index3);

//
// issue: Heftnummer
//
xr.xmlAddChild("issue", job.index4);

//
// volume: Band der Zeitschrift
//
xr.xmlAddChild("volume", job.index5);

//
// placeofpublication: Erscheinungsort
//
xr.xmlAddChild("placeofpublication", job.index6);

//
// publisher: Verlag
//
xr.xmlAddChild("publisher", job.index7);

//
// classificationcode: Kennung (SSG oder FID)
//
xr.xmlAddChild("classificationcode", job.index8);

//
// ISSN: ISSN der Zeitschrift
//
xr.xmlAddChild("issn", job.index9);

//
// ISBN: ISBN des Mediums
//
xr.xmlAddChild("isbn", job.index10);

//
// ISBN: ISBN des Mediums
//
xr.xmlAddChild("isbn", job.index11);

//
// recall_mark: Abrufkennzeichen: Nachbearbeitungskennzeichen
//
xr.xmlAddChild("recall_mark", job.index12);


//
// add further meta-data-items here...
//

xr.xmlPop();
xr.xmlPop();

//
// # of Articles...
//
xr.xmlAddChild("ARTICLE_COUNT", authors.length);

//
// loop over Articles...
//

for (i = 0; i < authors.length; i++) {

    aut_list  = authors[i];
    language  = ut.trimmed(languages[i]);
    title     = ut.trimmed(titles[i]);
    sub_title = ut.trimmed(sub_titles[i]);
    abstract  = ut.trimmed(abstracts[i]);
    pg        = ut.trimmed(page_numbers[i]);
    sl        = ut.split(pg, "-");
    pg_from   = "";
    pg_to     = "";

    if (2 == sl.length) {
        pg_from = ut.trimmed(sl[0]);
        pg_to   = ut.trimmed(sl[1]);
    }

    xr.xmlPush ("ARTICLE");

      if (pg_from.length && pg_to.length) {
         xr.xmlAddChild("PAGE_FROM", pg_from);
          xr.xmlAddChild("PAGE_TO", pg_to);
      } else xr.xmlAddChild("PAGE_FROM", pg);

      for (j = 0; j < aut_list.length; j++) {

         aut_map  = aut_list[j];
         aut_name = aut_map["name"];
         aut_id   = aut_map["gnd_id"];

         xr.xmlAddChild("AUTHOR", aut_name);

          if (aut_id.length)
              xr.xmlAddAttribute("gnd_id", aut_id);

      } // for j...

      if (language.length)
         xr.xmlAddChild("LANGUAGE", language);

      if (title.length)
         xr.xmlAddChild("TITLE", title);

      if (sub_title.length)
         xr.xmlAddChild("SUB_TITLE", sub_title);

      if (abstract.length)
         xr.xmlAddChild("ABSTRACT", abstract);

    xr.xmlPop(); // ARTICLE

} // for i...

//
// Store XML Result in Job's KeyMap
//
job.setKeyValue("C3_PLUS_XML", xr.genericXmlString());

//
// return XML result
//
c3_xml = xr.genericXmlString();

// ut.notifyUser('C3 XML', c3_xml);

//
// nun Pica+ erzeugen...
//
pica_plus_string = ut.xml2Pica(c3_xml);
job.setKeyValue("PICA_PLUS", pica_plus_string);
// ut.notifyUser('Pica+', pica_plus_string);

pica_plus_string;