24 struct _xmlAttr *attr;
26 for (attr = ptr->properties; attr; attr = attr->next)
28 if (!xmlStrcmp(attr->name, BAD_CAST
"name") &&
29 attr->children && attr->children->type == XML_TEXT_NODE)
30 name = (
const char *) attr->children->content;
33 *addinfo =
"bad attribute for 'attr'. "
34 "Expecting 'type', 'value', or 'attrset'";
40 *addinfo =
"missing attribute for 'name' for element 'qual'";
54 struct _xmlAttr *attr;
56 const char *value = 0;
57 const char *attrset = default_set;
58 for (attr = ptr->properties; attr; attr = attr->next)
60 if (!xmlStrcmp(attr->name, BAD_CAST
"type") &&
61 attr->children && attr->children->type == XML_TEXT_NODE)
62 type = (
const char *) attr->children->content;
63 else if (!xmlStrcmp(attr->name, BAD_CAST
"value") &&
64 attr->children && attr->children->type == XML_TEXT_NODE)
65 value = (
const char *) attr->children->content;
66 else if (!xmlStrcmp(attr->name, BAD_CAST
"attrset") &&
67 attr->children && attr->children->type == XML_TEXT_NODE)
68 attrset = (
const char *) attr->children->content;
71 *addinfo =
"bad attribute for 'attr'. "
72 "Expecting 'type', 'value', or 'attrset'";
78 *addinfo =
"missing attribute for 'type' for element 'attr'";
83 *addinfo =
"missing attribute for 'value' for element 'attr'";
98 struct _xmlAttr *attr;
100 const xmlNode *a_ptr = ptr->children;
101 for (attr = ptr->properties; attr; attr = attr->next)
103 if (!xmlStrcmp(attr->name, BAD_CAST
"name") &&
104 attr->children && attr->children->type == XML_TEXT_NODE)
105 name = (
const char *) attr->children->content;
108 *addinfo =
"bad attribute for 'qual'. Expecting 'name' only";
114 *addinfo =
"missing attribute 'name' for 'qual' element";
117 for (; a_ptr; a_ptr = a_ptr->next)
119 if (a_ptr->type == XML_ELEMENT_NODE)
121 if (!xmlStrcmp(a_ptr->name, BAD_CAST
"attr"))
129 else if (!xmlStrcmp(a_ptr->name, BAD_CAST
"qual"))
138 *addinfo =
"bad element: expecting 'attr'";
148 const char **addinfo)
150 struct _xmlAttr *attr;
151 const char *
name = 0;
152 const char *value = 0;
153 for (attr = ptr->properties; attr; attr = attr->next)
155 if (!xmlStrcmp(attr->name, BAD_CAST
"name") &&
156 attr->children && attr->children->type == XML_TEXT_NODE)
157 name = (
const char *) attr->children->content;
158 else if (!xmlStrcmp(attr->name, BAD_CAST
"value") &&
159 attr->children && attr->children->type == XML_TEXT_NODE)
160 value = (
const char *) attr->children->content;
163 *addinfo =
"bad attribute for 'diretive'. "
164 "Expecting 'name' or 'value'";
170 *addinfo =
"missing attribute 'name' for 'directive' element";
175 *addinfo =
"missing attribute 'name' for 'value' element";
184 if (ptr && ptr->type == XML_ELEMENT_NODE &&
185 !xmlStrcmp(ptr->name, BAD_CAST
"cclmap"))
187 const xmlNode *c_ptr;
189 struct _xmlAttr *attr;
190 for (attr = ptr->properties; attr; attr = attr->next)
192 if (!xmlStrcmp(attr->name, BAD_CAST
"defaultattrset") &&
193 attr->children && attr->children->type == XML_TEXT_NODE)
194 set = (
const char *) attr->children->content;
197 *addinfo =
"bad attribute for 'cclmap'. "
198 "expecting 'defaultattrset'";
202 for (c_ptr = ptr->children; c_ptr; c_ptr = c_ptr->next)
204 if (c_ptr->type == XML_ELEMENT_NODE)
206 if (!xmlStrcmp(c_ptr->name, BAD_CAST
"qual"))
210 wrbuf, c_ptr, addinfo);
215 else if (!xmlStrcmp(c_ptr->name, BAD_CAST
"directive"))
223 *addinfo =
"bad element for 'cclmap'. "
224 "expecting 'directive' or 'qual'";
Header for CCL + XML stuff.
void ccl_qual_fitem(CCL_bibset bibset, const char *cp, const char *qual_name)
void ccl_qual_add_special(CCL_bibset bibset, const char *n, const char *cp)
int ccl_xml_config_directive(CCL_bibset bibset, const xmlNode *ptr, const char **addinfo)
static int ccl_xml_config_attr(const char *default_set, WRBUF wrbuf, const xmlNode *ptr, const char **addinfo)
static int ccl_xml_config_qual(CCL_bibset bibset, const char *default_set, WRBUF wrbuf, const xmlNode *ptr, const char **addinfo)
int ccl_xml_config(CCL_bibset bibset, const xmlNode *ptr, const char **addinfo)
configures CCL bibset using XML configuration
static int ccl_xml_config_combqual(WRBUF wrbuf, const xmlNode *ptr, const char **addinfo)
void wrbuf_destroy(WRBUF b)
destroy WRBUF and its buffer
WRBUF wrbuf_alloc(void)
construct WRBUF
void wrbuf_printf(WRBUF b, const char *fmt,...)
writes printf result to WRBUF
const char * wrbuf_cstr(WRBUF b)
returns WRBUF content as C-string