{ "translatorID": "edd87d07-9194-42f8-b2ad-997c4c7deefd", "label": "MARCXML", "creator": "Sebastian Karcher", "target": "xml", "minVersion": "3.0", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 1, "browserSupport": "gcsv", "lastUpdated": "2014-03-12 21:40:16" } function detectImport() { var line; var i = 0; while ((line = Zotero.read()) !== false) { if (line != "") { if (line.match(/<(marc\:)?collection xmlns(\:marc)?=\"http:\/\/www\.loc\.gov\/MARC21\/slim\"/)) { return true; } else { if (i++ > 5) { return false; } } } } } function doImport() { var text = ""; var line; while (line = Zotero.read()) { text += line; } //call MARC translator var translator = Zotero.loadTranslator("import"); translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); translator.getTranslatorObject(function (marc) { var parser = new DOMParser(); var xml = parser.parseFromString(text, 'text/xml'); //define the marc namespace ns = { "marc": "http://www.loc.gov/MARC21/slim" }; var records = ZU.xpath(xml, '//marc:record', ns); for (var i in records) { //create one new item per record var record = new marc.record(); var newItem = new Zotero.Item(); var fields = ZU.xpath(records[i], "./marc:datafield", ns); for (var j in fields) { //go through every datafield (corresponds to a MARC field) var subfields = ZU.xpath(fields[j], "./marc:subfield", ns); for (var k in subfields) { //get the subfields and their codes... var code = ZU.xpathText(subfields[k], "./@code", ns) var sf = ZU.xpathText(subfields[k], "./text()", ns) //set tag to an empty string if this is the first subfield if (k == 0) var tag = ""; //concat all subfields in one datafield, with subfield delimiter and code between them tag = tag + marc.subfieldDelimiter + code + sf; } record.addField(ZU.xpathText(fields[j], "./@tag", ns), ZU.xpathText(fields[j], "./@ind1", ns) + ZU.xpathText(fields[j], "./@ind2"), tag); } record.translate(newItem); newItem.complete(); } }) //get Translator end } /** BEGIN TEST CASES **/ var testCases = [ { "type": "import", "input": "\n\n\n \n\t\t00925njm 22002777a 4500\n\t\t5637241\n\t\tDLC\n\t\t19920826084036.0\n\t\tsdubumennmplu\n\t\t910926s1957 nyuuun eng \n\t\t\n\t\t\t 91758335 \n\t\t\n\t\t\n\t\t\t1259\n\t\t\tAtlantic\n\t\t\n\t\t\n\t\t\tDLC\n\t\t\tDLC\n\t\t\n\t\t\n\t\t\tAtlantic 1259\n\t\t\n\t\t\n\t\t\tThe Great Ray Charles\n\t\t\t[sound recording].\n\t\t\n\t\t\n\t\t\tNew York, N.Y. :\n\t\t\tAtlantic,\n\t\t\t[1957?]\n\t\t\n\t\t\n\t\t\t1 sound disc :\n\t\t\tanalog, 33 1/3 rpm ;\n\t\t\t12 in.\n\t\t\n\t\t\n\t\t\tRay Charles, piano & celeste.\n\t\t\n\t\t\n\t\t\tThe Ray -- My melancholy baby -- Black coffee -- There's no you -- Doodlin' -- Sweet sixteen bars -- I surrender dear -- Undecided.\n\t\t\n\t\t\n\t\t\tBrief record.\n\t\t\n\t\t\n\t\t\tJazz\n\t\t\t1951-1960.\n\t\t\n\t\t\n\t\t\tPiano with jazz ensemble.\n\t\t\n\t\t\n\t\t\tCharles, Ray,\n\t\t\t1930-\n\t\t\tprf\n\t\t\n\t\n\t\n\t\t01832cmma 2200349 a 4500\n\t\t12149120\n\t\t20001005175443.0\n\t\tcr |||\n\t\t000407m19949999dcu g m eng d\n\t\t\n\t\t\t0\n\t\t\tibc\n\t\t\tcopycat\n\t\t\t1\n\t\t\tncip\n\t\t\t20\n\t\t\ty-gencompf\n\t\t\n\t\t\n\t\t\tundetermined\n\t\t\tweb preservation project (wpp)\n\t\t\n\t\t\n\t\t\tvb07 (stars done) 08-19-00 to HLCD lk00; AA3s lk29 received for subject Aug 25, 2000; to DEWEY 08-25-00; aa11 08-28-00\n\t\t\n\t\t\n\t\t\t 00530046 \n\t\t\n\t\t\n\t\t\t(OCoLC)ocm44279786\n\t\t\n\t\t\n\t\t\tIEU\n\t\t\tIEU\n\t\t\tN@F\n\t\t\tDLC\n\t\t\n\t\t\n\t\t\tlccopycat\n\t\t\n\t\t\n\t\t\tn-us-dc\n\t\t\tn-us---\n\t\t\n\t\t\n\t\t\tF204.W5\n\t\t\n\t\t\n\t\t\t975.3\n\t\t\t13\n\t\t\n\t\t\n\t\t\tThe White House\n\t\t\t[computer file].\n\t\t\n\t\t\n\t\t\tComputer data.\n\t\t\n\t\t\n\t\t\tWashington, D.C. :\n\t\t\tWhite House Web Team,\n\t\t\t1994-\n\t\t\n\t\t\n\t\t\tMode of access: Internet.\n\t\t\n\t\t\n\t\t\tTitle from home page as viewed on Aug. 19, 2000.\n\t\t\n\t\t\n\t\t\tFeatures the White House. Highlights the Executive Office of the President, which includes senior policy advisors and offices responsible for the President's correspondence and communications, the Office of the Vice President, and the Office of the First Lady. Posts contact information via mailing address, telephone and fax numbers, and e-mail. Contains the Interactive Citizens' Handbook with information on health, travel and tourism, education and training, and housing. Provides a tour and the history of the White House. Links to White House for Kids.\n\t\t\n\t\t\n\t\t\tWhite House (Washington, D.C.)\n\t\t\n\t\t\n\t\t\tUnited States.\n\t\t\tExecutive Office of the President.\n\t\t\n\t\t\n\t\t\tUnited States.\n\t\t\tOffice of the Vice President.\n\t\t\n\t\t\n\t\t\tUnited States.\n\t\t\tOffice of the First Lady.\n\t\t\n\t\t\n\t\t\tWhite House Web Team.\n\t\t\n\t\t\n\t\t\thttp://www.whitehouse.gov\n\t\t\n\t\t\n\t\t\thttp://lcweb.loc.gov/staff/wpp/whitehouse.html\n\t\t\tWeb site archive\n\t\t\n\t\n", "items": [ { "itemType": "book", "creators": [ { "firstName": "Ray", "lastName": "Charles", "creatorType": "editor" } ], "notes": [ { "note": "Brief record" }, { "note": "The Ray -- My melancholy baby -- Black coffee -- There's no you -- Doodlin' -- Sweet sixteen bars -- I surrender dear -- Undecided" } ], "tags": [ "Jazz", "1951-1960", "Piano with jazz ensemble" ], "seeAlso": [], "attachments": [], "title": "The Great Ray Charles", "place": "New York, N.Y", "publisher": "Atlantic", "date": "1957", "numPages": "1", "callNumber": "Atlantic 1259", "medium": "sound recording" }, { "itemType": "book", "creators": [ { "lastName": "White House Web Team", "fieldMode": true } ], "notes": [ { "note": "Title from home page as viewed on Aug. 19, 2000" }, { "note": "Features the White House. Highlights the Executive Office of the President, which includes senior policy advisors and offices responsible for the President's correspondence and communications, the Office of the Vice President, and the Office of the First Lady. Posts contact information via mailing address, telephone and fax numbers, and e-mail. Contains the Interactive Citizens' Handbook with information on health, travel and tourism, education and training, and housing. Provides a tour and the history of the White House. Links to White House for Kids" } ], "tags": [], "seeAlso": [], "attachments": [], "title": "The White House", "place": "Washington, D.C", "publisher": "White House Web Team", "date": "1994", "callNumber": "F204.W5", "medium": "computer file" } ] }, { "type": "import", "input": "\n\n\n 441828\n \n 9789279215070\n \n \n 468303\n \n \n ILO\n ILO\n \n \n 14.07.1\n ilot\n \n \n WWW ACCESS ONLY\n \n \n Active ageing and solidarity between generations\n [electronic resource] :\n a statistical portrait of the European Union 2012 /\n European Commission, Eurostat.\n \n \n 2012 ed.\n \n \n Luxembourg :\n Publications Office of the European Union,\n 2012.\n \n \n 141 p. :\n statistics\n \n \n Statistical books\n \n \n Theme: Population and social conditions\n \n \n Mode of access : World Wide Web (available in electronic format only).\n \n \n Description based on the Internet version on the World Wide Web.\n \n \n References.\n \n \n Provides details in relation to population ageing and setting the scene as regards the dynamics of demographic change, and details the past, present and projected future structure of the EU's population. Presents information in relation to the demand for healthcare services, as well as the budgetary implications facing governments as their populations continue to age. Contains information relating to the active participation of older generations within society, with a particular focus on inter-generational issues and also includes information on the leisure pursuits and social activities undertaken by older persons.\n \n \n older people\n ilot\n \n \n older worker\n ilot\n \n \n retired worker\n ilot\n \n \n ageing population\n ilot\n \n \n employment opportunity\n ilot\n \n \n social security\n ilot\n \n \n quality of life\n ilot\n \n \n EU countries\n ilot\n \n \n statistical table\n ilot\n \n \n EU pub\n ilot\n \n \n personnes âgées\n tbit\n \n \n travailleur âgé\n tbit\n \n \n travailleur retraité\n tbit\n \n \n vieillissement de la population\n tbit\n \n \n possibilités d'emploi\n tbit\n \n \n sécurité sociale\n tbit\n \n \n qualité de la vie\n tbit\n \n \n pays de l'UE\n tbit\n \n \n tableau statistique\n tbit\n \n \n pub UE\n tbit\n \n \n personas de edad avanzada\n toit\n \n \n trabajador de edad avanzada\n toit\n \n \n jubilado\n toit\n \n \n envejecimiento de la población\n toit\n \n \n oportunidades de empleo\n toit\n \n \n seguridad social\n toit\n \n \n calidad de la vida\n toit\n \n \n países de la UE\n toit\n \n \n cuadros estadísticos\n toit\n \n \n pub UE\n toit\n \n \n Statistical Office of the European Communities.\n \n \n Full text\n http://www.ilo.org/public/libdoc/igo/2011/468303.pdf\n \n \n statistical table\n \n \n EU pub\n \n \n tableau statistique\n \n \n pub UE\n \n \n cuadros estadísticos\n \n \n pub UE\n \n \n older people\n \n \n older worker\n \n \n retired worker\n \n \n ageing population\n \n \n employment opportunity\n \n \n social security\n \n \n quality of life\n \n \n EU countries\n \n \n personnes âgées\n \n \n travailleur âgé\n \n \n travailleur retraité\n \n \n vieillissement de la population\n \n \n possibilités d'emploi\n \n \n sécurité sociale\n \n \n qualité de la vie\n \n \n pays de l'UE\n \n \n personas de edad avanzada\n \n \n trabajador de edad avanzada\n \n \n jubilado\n \n \n envejecimiento de la población\n \n \n oportunidades de empleo\n \n \n seguridad social\n \n \n calidad de la vida\n \n \n países de la UE\n \n \n EU countries\n \n \n biblio\n 2012-02-20\n \n \n cdc\n \n \n cs\n 2012-02-02\n \n \n M680057\n nocirc\n WWW ACCESS ONLY\n Electronic documents\n HQ Library - Geneva\n \n \n LABORDOC-468303\n \n \n 04089cam a2201045 a 4500\n \n \n 20120220060113.0\n \n \n 120119s2012 lu d sb 000 0 eng d\n \n \n am\n \n \n 2012\n \n \n eng\n \n\n", "items": [ { "itemType": "book", "creators": [ { "lastName": "Statistical Office of the European Communities", "fieldMode": true } ], "notes": [ { "note": "Theme: Population and social conditions Mode of access : World Wide Web (available in electronic format only) Description based on the Internet version on the World Wide Web" }, { "note": "Provides details in relation to population ageing and setting the scene as regards the dynamics of demographic change, and details the past, present and projected future structure of the EU's population. Presents information in relation to the demand for healthcare services, as well as the budgetary implications facing governments as their populations continue to age. Contains information relating to the active participation of older generations within society, with a particular focus on inter-generational issues and also includes information on the leisure pursuits and social activities undertaken by older persons" } ], "tags": [ "EU countries", "EU pub", "ageing population", "calidad de la vida", "cuadros estadísticos", "employment opportunity", "envejecimiento de la población", "jubilado", "older people", "older worker", "oportunidades de empleo", "países de la UE", "pays de l'UE", "personas de edad avanzada", "personnes âgées", "possibilités d'emploi", "pub UE", "pub UE", "qualité de la vie", "quality of life", "retired worker", "seguridad social", "sécurité sociale", "social security", "statistical table", "tableau statistique", "trabajador de edad avanzada", "travailleur âgé", "travailleur retraité", "vieillissement de la population" ], "seeAlso": [], "attachments": [], "ISBN": "9789279215070", "edition": "2012 ed", "place": "Luxembourg", "numPages": "141", "series": "Statistical books", "callNumber": "WWW ACCESS ONLY", "url": "http://www.ilo.org/public/libdoc/igo/2011/468303.pdf", "title": "Active ageing and solidarity between generations a statistical portrait of the European Union 2012", "publisher": "Publications Office of the European Union", "date": "2012" } ] } ] /** END TEST CASES **/