X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ztest%2Fread-marc.c;h=487d9abe108f9b2a51ab4458dd370d4df34f4af0;hp=b11b6973ae8076e8119c1c5a4e70c3e2999a93ac;hb=2a7d35ce3d1bad977c9cf4f8d586e3699b4d20b3;hpb=bb6ad257696a3b58e1f7f141b37e7471a6e91968 diff --git a/ztest/read-marc.c b/ztest/read-marc.c index b11b697..487d9ab 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -1683,6 +1683,26 @@ char *dummy_xml_record(int num, ODR odr, const char *esn) return 0; } +char *dummy_json_record(int num, ODR odr, const char *esn) +{ + if (!esn || !strcmp(esn, "marcinjson")) + { + char *rec = dummy_marc_record(num, odr); + if (rec) + { + WRBUF w = wrbuf_alloc(); + yaz_marc_t mt = yaz_marc_create(); + yaz_marc_xml(mt, YAZ_MARC_JSON); + yaz_marc_decode_wrbuf(mt, rec, -1, w); + rec = odr_strdup(odr, wrbuf_cstr(w)); + yaz_marc_destroy(mt); + wrbuf_destroy(w); + return rec; + } + } + return 0; +} + /* * Local variables: * c-basic-offset: 4