| iMatix home page | << | < | > | >> |
![]() Version 1.91 |
#include "sflxml.h" XML_ITEM * xml_new ( XML_ITEM *parent, const char *name, const char *value)
Creates and initialises a new XML_ITEM item. The item is set to link to itself, and its sublists are initialised to be empty. Returns the address of the created XML_ITEM item or NULL if there was not enough memory. Sets the new item's name and value as specified; either of these arguments may be null. If the parent argument is not null, attaches the new item to the end of the parent item list.
{ XML_ITEM *item; list_create (item, sizeof (XML_ITEM)); if (item) { list_reset (&item-> attrs); list_reset (&item-> children); item-> parent = parent; item-> name = mem_strdup (name); item-> value = mem_strdup (value); if (parent) list_relink_before (item, &parent-> children); return (item); } else return (NULL); }
| << | < | > | >> |
![]() |