Possible compatibility problems with earlier versions marked with '*'.
+Handle user defined stylesheet for SRW/SRU.
+
--- 2.0.9-3 2004/01/06 Debian/Windows
Fix a bug with decoding of XML packed records.
* Copyright (c) 1995-2004, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.221 2004-01-06 13:38:39 adam Exp $
+ * $Id: client.c,v 1.222 2004-01-07 20:36:44 adam Exp $
*/
#include <stdio.h>
ret = z_soap_codec_enc(o, &p,
&gdu->u.HTTP_Request->content_buf,
&gdu->u.HTTP_Request->content_len, h,
- charset);
+ charset, 0);
if (z_GDU(out, &gdu, 0, 0))
{
* Copyright (c) 2002-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: soap.h,v 1.5 2003-12-09 12:51:16 adam Exp $
+ * $Id: soap.h,v 1.6 2004-01-07 20:36:44 adam Exp $
*/
#ifndef YAZ_SOAP_H
char **content_buf, int *content_len,
Z_SOAP_Handler *handlers);
YAZ_EXPORT int z_soap_codec_enc(ODR o, Z_SOAP **pp,
- char **content_buf, int *content_len,
- Z_SOAP_Handler *handlers, const char *encoding);
+ char **content_buf, int *content_len,
+ Z_SOAP_Handler *handlers, const char *encoding,
+ const char *stylesheet);
YAZ_EXPORT int z_soap_error(ODR o, Z_SOAP *p,
const char *fault_code, const char *fault_string,
* Copyright (c) 2002-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: srw.h,v 1.11 2004-01-05 09:34:42 adam Exp $
+ * $Id: srw.h,v 1.12 2004-01-07 20:36:44 adam Exp $
*/
#ifndef YAZ_SRW_H
typedef struct {
char *recordPacking;
char *database;
+ char *stylesheet;
} Z_SRW_explainRequest;
typedef struct {
* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.13 2004-01-05 09:34:42 adam Exp $
+ * $Id: seshigh.c,v 1.14 2004-01-07 20:36:44 adam Exp $
*/
/*
char *charset = 0;
Z_HTTP_Response *hres;
int keepalive = 1;
+ char *stylesheet = 0;
r = yaz_srw_decode(hreq, &sr, &soap_package, assoc->decode, &charset);
if (r == 2) /* not taken */
{
Z_SRW_PDU *res =
yaz_srw_get(assoc->encode, Z_SRW_searchRetrieve_response);
-
+
+ stylesheet = sr->u.request->stylesheet;
srw_bend_search(assoc, req, sr->u.request, res->u.response,
&http_code);
if (http_code == 200)
else if (sr->which == Z_SRW_explain_request)
{
Z_SRW_PDU *res = yaz_srw_get(o, Z_SRW_explain_response);
+ stylesheet = sr->u.explain_request->stylesheet;
srw_bend_explain(assoc, req, sr->u.explain_request,
res->u.explain_response, &http_code);
if (http_code == 200)
hres = p->u.HTTP_Response;
ret = z_soap_codec_enc(assoc->encode, &soap_package,
&hres->content_buf, &hres->content_len,
- soap_handlers, charset);
+ soap_handlers, charset, stylesheet);
hres->code = http_code;
strcpy(ctype, "text/xml");
assoc->init->implementation_name,
odr_prepend(assoc->encode, "GFS", resp->implementationName));
- version = odr_strdup(assoc->encode, "$Revision: 1.13 $");
+ version = odr_strdup(assoc->encode, "$Revision: 1.14 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
resp->implementationVersion = odr_prepend(assoc->encode,
/*
- * Copyright (c) 2002-2003, Index Data.
+ * Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: soap.c,v 1.4 2004-01-05 09:34:42 adam Exp $
+ * $Id: soap.c,v 1.5 2004-01-07 20:36:44 adam Exp $
*/
#include <yaz/soap.h>
static const char *soap_v1_2 = "http://www.w3.org/2001/06/soap-envelope";
int z_soap_codec_enc(ODR o, Z_SOAP **pp,
- char **content_buf, int *content_len,
- Z_SOAP_Handler *handlers,
- const char *encoding)
+ char **content_buf, int *content_len,
+ Z_SOAP_Handler *handlers,
+ const char *encoding,
+ const char *stylesheet)
{
if (o->direction == ODR_DECODE)
{
{
xmlDocSetRootElement(doc, body_ptr->children);
}
+ if (stylesheet)
+ {
+ char *content = odr_malloc(o, strlen(stylesheet) + 40);
+
+ xmlNodePtr pi, ptr = xmlDocGetRootElement(doc);
+ sprintf(content, "type=\"text/xsl\" href=\"%s\"", stylesheet);
+ pi = xmlNewPI("xml-stylesheet", content);
+ xmlAddPrevSibling(ptr, pi);
+ }
if (1)
{
xmlChar *buf_out;
#else
int z_soap_codec_enc(ODR o, Z_SOAP **pp,
char **content_buf, int *content_len,
- Z_SOAP_Handler *handlers, const char *encoding)
+ Z_SOAP_Handler *handlers, const char *encoding,
+ const char *stylesheet)
{
static char *err_xml =
"<?xml version=\"1.0\"?>\n"
char **content_buf, int *content_len,
Z_SOAP_Handler *handlers)
{
- return z_soap_codec_enc(o, pp, content_buf, content_len, handlers, 0);
+ return z_soap_codec_enc(o, pp, content_buf, content_len, handlers, 0, 0);
}
int z_soap_error(ODR o, Z_SOAP *p,
* Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: srw.c,v 1.14 2004-01-06 11:21:04 adam Exp $
+ * $Id: srw.c,v 1.15 2004-01-07 20:36:44 adam Exp $
*/
#include <yaz/srw.h>
req = (*p)->u.explain_request = odr_malloc(o, sizeof(*req));
req->recordPacking = 0;
req->database = 0;
+ req->stylesheet = 0;
for (; ptr; ptr = ptr->next)
{
if (match_xsd_string(ptr, "database", o,
&req->database))
;
+ else if (match_xsd_string(ptr, "stylesheet", o,
+ &req->stylesheet))
+ ;
else if (match_xsd_string(ptr, "recordPacking", o,
&req->recordPacking))
;
}
else if ((*p)->which == Z_SRW_explain_request)
{
+ Z_SRW_explainRequest *req = (*p)->u.explain_request;
xmlNodePtr ptr = xmlNewChild(pptr, 0, "explainRequest", 0);
ns_srw = xmlNewNs(ptr, ns, "zs");
xmlSetNs(ptr, ns_srw);
add_xsd_string(ptr, "version", (*p)->srw_version);
+ add_xsd_string(ptr, "recordPacking", req->recordPacking);
+ add_xsd_string(ptr, "stylesheet", req->stylesheet);
}
else if ((*p)->which == Z_SRW_explain_response)
{
/*
- * Copyright (c) 2002-2003, Index Data.
+ * Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: srwutil.c,v 1.5 2004-01-06 11:20:15 adam Exp $
+ * $Id: srwutil.c,v 1.6 2004-01-07 20:36:44 adam Exp $
*/
#include <yaz/srw.h>
const char *operation = 0;
char *query = 0;
char *pQuery = 0;
+ char *stylesheet = 0;
if (charset)
*charset = 0;
query = yaz_uri_val(p1, "query", decode);
pQuery = yaz_uri_val(p1, "pQuery", decode);
operation = yaz_uri_val(p1, "operation", decode);
+ stylesheet = yaz_uri_val(p1, "stylesheet", decode);
if (!operation)
operation = "explain";
if ((operation && !strcmp(operation, "searchRetrieve"))
}
sr->u.request->recordSchema = yaz_uri_val(p1, "recordSchema", decode);
sr->u.request->recordPacking = yaz_uri_val(p1, "recordPacking", decode);
+ sr->u.request->stylesheet = stylesheet;
+
if (!sr->u.request->recordPacking)
sr->u.request->recordPacking = "xml";
yaz_uri_val_int(p1, "maximumRecords", decode,
sr->u.explain_request->recordPacking = "xml";
sr->u.explain_request->database = db;
+ sr->u.explain_request->stylesheet = stylesheet;
+
(*soap_package) = odr_malloc(decode, sizeof(**soap_package));
(*soap_package)->which = Z_SOAP_generic;
odr_malloc(o, sizeof(*sr->u.explain_request));
sr->u.explain_request->recordPacking = 0;
sr->u.explain_request->database = 0;
+ sr->u.explain_request->stylesheet = 0;
break;
case Z_SRW_explain_response:
sr->u.explain_response = (Z_SRW_explainResponse *)
* Copyright (c) 2000-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: zoom-c.c,v 1.15 2003-12-30 00:29:53 adam Exp $
+ * $Id: zoom-c.c,v 1.16 2004-01-07 20:36:44 adam Exp $
*
* ZOOM layer for C, connections, result sets, queries.
*/
ZOOM_options_get(c->options, "implementationName"),
odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName));
- version = odr_strdup(c->odr_out, "$Revision: 1.15 $");
+ version = odr_strdup(c->odr_out, "$Revision: 1.16 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
ireq->implementationVersion = odr_prepend(c->odr_out,
ret = z_soap_codec_enc(o, &p,
&gdu->u.HTTP_Request->content_buf,
&gdu->u.HTTP_Request->content_len, h,
- c->charset);
+ c->charset, 0);
if (!z_GDU(c->odr_out, &gdu, 0, 0))
return zoom_complete;