X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsrw.c;h=31c14188816a86a37aa57fcbbb86865a82abc00d;hp=f4a645369c1bd60345ac86866e6544cf71a1d83a;hb=323805b6779bcf1befdc7cdd7f10c23b06885e0d;hpb=5350317640042c3507172d28d14279595eb7a49f diff --git a/src/srw.c b/src/srw.c index f4a6453..31c1418 100644 --- a/src/srw.c +++ b/src/srw.c @@ -308,7 +308,7 @@ static Z_FacetField *yaz_sru_proxy_decode_facet_field(ODR odr, xmlNodePtr ptr) const char* name = yaz_element_attribute_value_get(ptr, "facet", "code"); yaz_log(YLOG_DEBUG, "sru-proxy facet type: %s", name); - list = yaz_use_attribute_create(odr, name); + list = zget_AttributeList_use_string(odr, name); for (node = ptr->children; node; node = node->next) { if (yaz_match_xsd_element(node, "facetvalue")) num_terms++; @@ -554,6 +554,30 @@ static int yaz_srw_terms(ODR o, xmlNodePtr pptr, Z_SRW_scanTerm **terms, return 0; } +static void encode_echoed_args(xmlNodePtr ptr, Z_SRW_PDU *p, const char *name) +{ + Z_SRW_extra_arg *ea = p->extra_args; + if (ea) + { + xmlNode *p1 = xmlNewChild(ptr, 0, BAD_CAST name, 0); + xmlNode *p2 = 0; + for (; ea; ea = ea->next) + { + if (ea->name && ea->name[0] == 'x' && ea->name[1] == '-') + { + /* not really according to XSD as of July 2014 */ + if (!p2) + p2 = xmlNewChild(p1, 0, + BAD_CAST "extraRequestData", 0); + /* skip +2: "x-" in element */ + add_xsd_string(p2, ea->name + 2, ea->value); + } + else + add_xsd_string(p1, ea->name, ea->value); + } + } +} + int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, void *client_data, const char *ns) { @@ -657,6 +681,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, else if (yaz_match_xsd_string(ptr, "facetSort", o, (char**) &facetSort)) ; + else + ; } if (!req->query) { @@ -983,6 +1009,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, } add_xsd_integer(ptr, "nextRecordPosition", res->nextRecordPosition); + encode_echoed_args(ptr, *p, "echoedSearchRetrieveRequest"); if (res->num_diagnostics) { xmlNodePtr rptr = xmlNewChild(ptr, 0, BAD_CAST "diagnostics", @@ -1041,6 +1068,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, yaz_srw_record(o, ptr1, &res->record, &res->extra_record, client_data, version2); } + encode_echoed_args(ptr, *p, "echoedExplainRequest"); if (res->num_diagnostics) { xmlNodePtr rptr = xmlNewChild(ptr, 0, BAD_CAST "diagnostics",