1 // suck in what we need
2 log_stdout('------------------------------LOAD---------------------------------------');
3 load_lib('xmlhttprequest.js');
5 log_stdout('------------------------------START---------------------------------------');
7 log_stdout("recordID is",params.recordID);
9 // xpath namespace resolver
10 var ns_res = new XPathNamespaceResolver(
11 { marc : "http://www.loc.gov/MARC21/slim",
12 mods : "http://www.loc.gov/mods/v3" }
15 // xmlhttprequest uses the perl xml parser to get the xml doc from
16 var x = new XMLHttpRequest();
17 x.open('POST','http://dev.gapines.org/restgateway');
18 x.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
19 x.send('service=open-ils.storage&method=open-ils.storage.direct.biblio.record_entry.retrieve¶m=' + params.recordID);
22 // use the DOM to parse the marc record
23 var marc = DOMImplementation.parseString(x.responseXML.evaluate('//marc/text()').singleNodeValue.data);
27 // and then get the title
28 var res = marc.evaluate(
29 "/marc:record/marc:datafield[@tag='245']/marc:subfield[@code='a']/text()",
34 // print the title we just grabbed
35 log_stdout(res.singleNodeValue.data);
37 log_stdout('------------------------------END---------------------------------------');