Function icu_chain_xml_config allows certain obsolete elements.
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 25 Dec 2008 14:20:45 +0000 (15:20 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 25 Dec 2008 14:20:45 +0000 (15:20 +0100)
Function icu_chain_xml_config allows certain obsolete elements which
was present in first version of ICU wrapper made for Pazpar2. The
elements 'index' and 'sortkey' are ignored and a warning is issued. The
element 'normalize' behaves as 'transform' but a warning is issued.

src/icu_I18N.c

index d3f8a4b..b2119b6 100644 (file)
@@ -914,14 +914,31 @@ struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node,
         else if (!strcmp((const char *) node->name, "display"))
             step = icu_chain_insert_step(chain, ICU_chain_step_type_display, 
                                          (const uint8_t *) "", status);
+        else if (!strcmp((const char *) node->name, "normalize"))
+        {
+            yaz_log(YLOG_WARN, "Element %s is deprecated. "
+                    "Use transform instead", node->name);
+            step = icu_chain_insert_step(chain, ICU_chain_step_type_normalize, 
+                                         (const uint8_t *) xml_rule, status);
+        }
+        else if (!strcmp((const char *) node->name, "index")
+                 || !strcmp((const char *) node->name, "sortkey"))
+        {
+            yaz_log(YLOG_WARN, "Element %s is no longer needed. "
+                    "Remove it from the configuration", node->name);
+        }
+        else
+        {
+            yaz_log(YLOG_WARN, "Unknown element %s", node->name);
+            icu_chain_destroy(chain);
+            return 0;
+        }
         xmlFree(xml_rule);
-        if (!step || U_FAILURE(*status))
+        if (step && U_FAILURE(*status))
         {
             icu_chain_destroy(chain);
             return 0;
         }
-        
-
     }
     return chain;
 }