| iMatix home page | << | < | > | >> |
SFL Version 2.11 |
#include "sflxml.h" int xml_put_attr_ic ( XML_ITEM *item, const char *name, const char *value, Bool ignore_case)
Sets, modifies, or deletes an attribute for the specified item. The attribute name must be supplied. If the value is NULL, the first attribute with the specified name is deleted. Otherwise it is either created or modified accordingly. If the paramater 'ignore_case' is TRUE, the case of the attribute name is insignificant. Returns the number of attribute nodes created (- 1, 0, or 1).
{ int feedback = 0; XML_ATTR *attr; ASSERT (item); ASSERT (name); attr = xml attr ic (item, name, ignore_case); if (attr) if (value) /* Value specified - update attr */ { mem_free (attr-> value); attr-> value = mem_strdup (value); } else { xml free attr (attr); /* No value - delete attribute */ feedback = -1; } else if (value) /* Value specified - update attr */ { list_create (attr, sizeof (XML_ATTR)); if (attr) { attr-> name = mem_strdup (name); attr-> value = mem_strdup (value); attr-> parent = item; list_relink_before (attr, &item-> attrs); feedback = 1; } } return (feedback); }
| << | < | > | >> | Copyright © 1996-2000 iMatix Corporation |