Omit CVS Id. Update copyright year.
[idzebra-moved-to-github.git] / index / mod_dom.c
index 60cf180..76ba9ca 100644 (file)
@@ -1,22 +1,19 @@
-/* $Id: mod_dom.c,v 1.37 2007-05-19 19:44:14 adam Exp $
-   Copyright (C) 1995-2007
-   Index Data ApS
+/* This file is part of the Zebra server.
+   Copyright (C) 1995-2008 Index Data
 
-   This file is part of the Zebra server.
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
 
-   Zebra is free software; you can redistribute it and/or modify it under
-   the terms of the GNU General Public License as published by the Free
-   Software Foundation; either version 2, or (at your option) any later
-   version.
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
-   Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or
-   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-   for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 */
 
@@ -780,7 +777,7 @@ static void index_value_of(struct filter_info *tinfo,
 
                 recword->index_name = (const char *)index;
                 if (type && *type)
-                    recword->index_type = *type;
+                    recword->index_type = (const char *) type;
 
                 /* writing debug out */
                 if (extctr->flagShowRecords)
@@ -790,10 +787,6 @@ static void index_value_of(struct filter_info *tinfo,
                             type ? (const char *) type : "null", 
                             text ? (const char *) text : "null");
                 
-                /* actually indexing the text given */
-                recword->index_name = (const char *)index;
-                if (type && *type)
-                    recword->index_type = *type;
                 (extctr->tokenAdd)(recword);
 
                 /* eat whitespaces */
@@ -845,7 +838,6 @@ static void set_record_info(struct filter_info *tinfo,
         else
             dom_log(YLOG_WARN, tinfo, node, "bad @type value: %s", type_p);
         extctr->action = action;
-        yaz_log(YLOG_LOG, "In mod_dom.c: setting action to %d", action);
     }
 
     if (tinfo->record_info_invoked == 1)
@@ -1119,7 +1111,8 @@ static int convert_extract_doc(struct filter_info *tinfo,
     else
         xmlDocDumpMemory(store_doc ? store_doc : doc, &buf_out, &len_out);
 
-    (*p->setStoreData)(p, buf_out, len_out);
+    if (p->setStoreData)
+        (*p->setStoreData)(p, buf_out, len_out);
     xmlFree(buf_out);
 
     if (store_doc)
@@ -1305,6 +1298,9 @@ static int filter_extract(void *clientData, struct recExtractCtrl *p)
         return RECCTRL_EXTRACT_ERROR_GENERIC;
     
     odr_reset(tinfo->odr_record);
+
+    if (p->setStoreData == 0)
+        return extract_xml_full(tinfo, input, p);
     switch(input->type)
     {
     case DOM_INPUT_XMLREADER:
@@ -1360,6 +1356,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
     {
         p->diagnostic =
             YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
+        p->addinfo = odr_strdup(p->odr, esn);
         return 0;
     }