From d6f82db2046a3add7e0c59321f15a63b233c434b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 16 Jun 2014 12:30:05 +0200 Subject: [PATCH] Supply marcxml as raw content Instead of having to create a (temporary) file. --- src/marcxml_raw.patch | 17 +++++++++++++++++ src/metaproxy_filter_xquery.cpp | 5 ++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/marcxml_raw.patch diff --git a/src/marcxml_raw.patch b/src/marcxml_raw.patch new file mode 100644 index 0000000..57fd0b0 --- /dev/null +++ b/src/marcxml_raw.patch @@ -0,0 +1,17 @@ +diff --git a/xbin/zorba3-0.xqy b/xbin/zorba3-0.xqy +index ba07c2e..481950f 100644 +--- a/xbin/zorba3-0.xqy ++++ b/xbin/zorba3-0.xqy +@@ -212,7 +212,11 @@ let $marcxml := + let $json := http:get($marcxmluri) + return parsexml:parse($json("body")("content"), ) + else +- let $raw-data as xs:string := file:read-text($marcxmluri) ++ let $raw-data := ++ if ( fn:starts-with($marcxmluri, "raw:" ) ) then ++ fn:substring($marcxmluri, 5) ++ else ++ file:read-text($marcxmluri) + let $mxml := parsexml:parse( + $raw-data, + diff --git a/src/metaproxy_filter_xquery.cpp b/src/metaproxy_filter_xquery.cpp index 994139f..51afacd 100644 --- a/src/metaproxy_filter_xquery.cpp +++ b/src/metaproxy_filter_xquery.cpp @@ -98,9 +98,8 @@ bool yf::XQuery::convert_one_record(const char *input_buf, lItem = lZorba->getItemFactory()->createString(it->second); lDynamicContext->setVariable(it->first, lItem); } - // TODO: Make tmp file here - lItem = lZorba->getItemFactory()->createString( - "/home/adam/proj/yaz/test/marc7.xml"); + std::string rec_content = "raw:" + std::string(input_buf, input_len); + lItem = lZorba->getItemFactory()->createString(rec_content); lDynamicContext->setVariable(zorba_record_variable, lItem); std::stringstream ss; -- 1.7.10.4