From 40ce69590ee4d5c574c3c39ab78b49c06b58657c Mon Sep 17 00:00:00 2001 From: Matt Burton Date: Sun, 22 Feb 2009 19:05:15 +0000 Subject: [PATCH] Addresses #1305, fixes fail on single items, fail on search is result of funky URL handling, needs some thorough investigation --- translators/Library Catalog (Dynix).js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/translators/Library Catalog (Dynix).js b/translators/Library Catalog (Dynix).js index 3141307664..125520f988 100644 --- a/translators/Library Catalog (Dynix).js +++ b/translators/Library Catalog (Dynix).js @@ -33,7 +33,7 @@ function doWeb(doc, url) { if(detailsRe.test(uri)) { uris.push(uri+'&fullmarc=true'); } else { - var items = Zotero.Utilities.getItemArray(doc, doc, "ipac\.jsp\?.*uri=(?:full|link)=[0-9]|^javascript:buildNewList\\('.*uri%3Dfull%3D[0-9]"); + var items = Zotero.Utilities.getItemArray(doc, doc, "ipac\.jsp\?.*uri=(?:full|link)=[0-9]|^javascript:buildNewList\\('.*uri%3Dfull%3D[0-9]", "Show details"); items = Zotero.selectItems(items); if(!items) { @@ -76,7 +76,14 @@ function doWeb(doc, url) { var record = new marc.record(); while(elmt = elmts.iterateNext()) { var field = Zotero.Utilities.superCleanString(newDoc.evaluate('./TD[1]/A[1]/text()[1]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue); - var value = newDoc.evaluate('./TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/A[1]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; + var value = newDoc.evaluate('./TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/A[1]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); + + // value = null for non-marc table entries w/ that xpath + if (!value) { + value = ''; + } else { + value = value.textContent; + } if(field == "LDR") { record.leader = value;