Changed include/yaz/diagbib1.h and added include/yaz/diagsrw.h with
[yaz-moved-to-github.git] / src / srw.c
index d1916aa..414a475 100644 (file)
--- a/src/srw.c
+++ b/src/srw.c
@@ -1,8 +1,8 @@
 /*
- * Copyright (c) 2002-2005, Index Data.
+ * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: srw.c,v 1.30 2005-01-09 21:52:49 adam Exp $
+ * $Id: srw.c,v 1.34 2005-02-04 20:27:19 adam Exp $
  */
 /**
  * \file srw.c
@@ -95,7 +95,10 @@ static int match_xsd_string_n(xmlNodePtr ptr, const char *elem, ODR o,
 #endif
     ptr = ptr->children;
     if (!ptr || ptr->type != XML_TEXT_NODE)
-        return 0;
+    {
+       *val = "";
+        return 1;
+    }
     *val = odr_strdup(o, ptr->content);
     if (len)
         *len = strlen(ptr->content);
@@ -322,7 +325,7 @@ static int yaz_srw_diagnostics(ODR o, xmlNodePtr pptr, Z_SRW_diagnostic **recs,
     {
         int i;
        xmlNsPtr ns_diag =
-           xmlNewNs(pptr, "info:srw/schema/1/diagnostic-v1.1", 0);
+           xmlNewNs(pptr, "http://www.loc.gov/zing/srw/diagnostic/", 0);
         for (i = 0; i < *num; i++)
         {
            const char *std_diag = "info:srw/diagnostic/1/";
@@ -373,7 +376,7 @@ static int yaz_srw_term(ODR o, xmlNodePtr pptr, Z_SRW_scanTerm *term,
     {
        xmlNodePtr ptr = pptr;
        add_xsd_string(ptr, "value", term->value);
-       add_xsd_integer(ptr, "value", term->numberOfRecords);
+       add_xsd_integer(ptr, "numberOfRecords", term->numberOfRecords);
        add_xsd_string(ptr, "displayTerm", term->displayTerm);
        add_xsd_string(ptr, "whereInList", term->whereInList);
     }
@@ -625,6 +628,11 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data,
                else if (match_xsd_string(ptr, "scanClause", o,
                                     &req->scanClause.cql))
                    ;
+               else if (match_xsd_string(ptr, "pScanClause", o,
+                                         &req->scanClause.pqf))
+               {
+                   req->query_type = Z_SRW_query_type_pqf;
+               }
                else if (match_xsd_integer(ptr, "responsePosition", o,
                                           &req->responsePosition))
                    ;