From: Adam Dickmeiss Date: Mon, 8 Mar 2010 10:24:41 +0000 (+0100) Subject: CCL: Allow qualifier aliases to be defined in XML X-Git-Tag: v4.0.2~5 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=3f02a85787de9b5340914aec0738f9eb46e89d79;p=yaz-moved-to-github.git CCL: Allow qualifier aliases to be defined in XML ccl_xml_config may now read CCL qualifier aliases as well, eg: --- diff --git a/src/cclxmlconfig.c b/src/cclxmlconfig.c index 7d205bb..d6a8de5 100644 --- a/src/cclxmlconfig.c +++ b/src/cclxmlconfig.c @@ -15,6 +15,35 @@ #if YAZ_HAVE_XML2 +static int ccl_xml_config_combqual(WRBUF wrbuf, + const xmlNode *ptr, + const char **addinfo) +{ + struct _xmlAttr *attr; + const char *name = 0; + for (attr = ptr->properties; attr; attr = attr->next) + { + if (!xmlStrcmp(attr->name, BAD_CAST "name") && + attr->children && attr->children->type == XML_TEXT_NODE) + name = (const char *) attr->children->content; + else + { + *addinfo = "bad attribute for 'attr'. " + "Expecting 'type', 'value', or 'attrset'"; + return 1; + } + } + if (!name) + { + *addinfo = "missing attribute for 'name' for element 'qual'"; + return 1; + } + wrbuf_printf(wrbuf, "%s", name); + return 0; + + +} + static int ccl_xml_config_attr(const char *default_set, WRBUF wrbuf, const xmlNode *ptr, @@ -95,6 +124,13 @@ static int ccl_xml_config_qual(CCL_bibset bibset, const char *default_set, return r; wrbuf_printf(wrbuf, " "); } + else if (!xmlStrcmp(a_ptr->name, BAD_CAST "qual")) + { + int r = ccl_xml_config_combqual(wrbuf, a_ptr, addinfo); + if (r) + return r; + wrbuf_printf(wrbuf, " "); + } else { *addinfo = "bad element: expecting 'attr'";