-/*
- * Copyright (C) 1995-2007, Index Data ApS
- * All rights reserved.
- *
- * $Id: cclxmlconfig.c,v 1.1 2007-01-08 13:20:58 adam Exp $
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2010 Index Data
+ * See the file LICENSE for details.
*/
/** \file cclxmlconfig.c
#if YAZ_HAVE_XML2
-static int ccl_xml_config_attr(CCL_bibset bibset, const char *default_set,
+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,
const char **addinfo)
{
if (!xmlStrcmp(a_ptr->name, BAD_CAST "attr"))
{
- int r = ccl_xml_config_attr(bibset, default_set, wrbuf,
+ int r = ccl_xml_config_attr(default_set, wrbuf,
a_ptr, addinfo);
if (r)
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'";
}
return 0;
}
-#else
-int ccl_xml_config(CCL_bibset bibset, const xmlNode *ptr, const char **addinfo)
-{
- *addinfo = "CCL XML configuration not supported. Libxml2 is disabled";
- return -1;
-}
#endif
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
+