+ yaz_log(YLOG_FATAL, "Must specify name in metadata element");
+ return 0;
+ }
+ md->name = nmem_strdup(nmem, name);
+ if (brief)
+ {
+ if (!strcmp(brief, "yes"))
+ md->brief = 1;
+ else if (strcmp(brief, "no"))
+ {
+ yaz_log(YLOG_FATAL, "metadata/brief must be yes or no");
+ return 0;
+ }
+ }
+ else
+ md->brief = 0;
+
+ if (termlist)
+ {
+ if (!strcmp(termlist, "yes"))
+ md->termlist = 1;
+ else if (strcmp(termlist, "no"))
+ {
+ yaz_log(YLOG_FATAL, "metadata/termlist must be yes or no");
+ return 0;
+ }
+ }
+ else
+ md->termlist = 0;
+
+ if (type)
+ {
+ if (!strcmp(type, "generic"))
+ md->type = Metadata_type_generic;
+ else if (!strcmp(type, "integer"))
+ md->type = Metadata_type_integer;
+ else if (!strcmp(type, "year"))
+ md->type = Metadata_type_year;
+ else
+ {
+ yaz_log(YLOG_FATAL, "Unknown value for metadata/type: %s", type);
+ return 0;
+ }
+ }
+ md->type = Metadata_type_generic;
+
+ if (sortkey)
+ {
+ if (!strcmp(sortkey, "no"))
+ md->sortkey = Metadata_sortkey_no;
+ else if (!strcmp(sortkey, "numeric"))
+ md->sortkey = Metadata_sortkey_numeric;
+ else if (!strcmp(sortkey, "range"))
+ md->sortkey = Metadata_sortkey_range;
+ else if (!strcmp(sortkey, "skiparticle"))
+ md->sortkey = Metadata_sortkey_skiparticle;
+ else
+ {
+ yaz_log(YLOG_FATAL, "Unknown sortkey in metadata element: %s", sortkey);
+ return 0;
+ }