| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 1.91

 

xml_new

#include "sflxml.h"
XML_ITEM *
xml_new (
    XML_ITEM   *parent,
    const char *name,
    const char *value)

Synopsis

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.

Source Code - (sflxml.c)

{
    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);
}

| << | < | > | >> iMatix Copyright © 1996-98 iMatix