retrieval: only one <backend> section allowed
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 24 Feb 2012 13:46:02 +0000 (14:46 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 24 Feb 2012 13:46:02 +0000 (14:46 +0100)
src/retrieval.c
test/test_retrieval.c

index f82f8c7..65c1098 100644 (file)
@@ -180,6 +180,14 @@ static int conf_retrieval(yaz_retrieval_t p, const xmlNode *ptr)
 
         else {
 
+            if (el->record_conv)
+            {
+                wrbuf_printf(p->wr_error, "Element <retrieval>: "
+                             "only one <backend> allowed");
+                yaz_record_conv_destroy(el->record_conv);
+                return -1;
+            }
+
             /* parsing attributees */
             struct _xmlAttr *attr;
             for (attr = ptr->properties; attr; attr = attr->next){
index 2b971df..a374159 100644 (file)
@@ -262,6 +262,25 @@ static void tst_configure(void)
                                   "Element <marc inputformat='not-existent'>:  Unsupported"
                                   " input format defined by attribute value", 0));
 
+
+    YAZ_CHECK(conv_configure_test("<retrievalinfo>"
+                                  "<retrieval syntax=\"usmarc\">"
+                                  "<backend syntax=\"xml\" name=\"dc\">"
+                                  "<xslt stylesheet=\"test_record_conv.xsl\"/>"
+                                  "<marc"
+                                  " inputcharset=\"utf-8\""
+                                  " outputcharset=\"marc-8\""
+                                  " inputformat=\"xml\""
+                                  " outputformat=\"marc\""
+                                  "/>"
+                                  "</backend>"
+                                  "<backend/>"
+                                  "</retrieval>"
+                                  "</retrievalinfo>",
+                                  "Element <retrieval>: "
+                                  "only one <backend> allowed", 0));
+
+
     YAZ_CHECK(conv_configure_test("<retrievalinfo>"
                                   "<retrieval syntax=\"usmarc\">"
                                   "<backend syntax=\"xml\" name=\"dc\">"