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

 

xml_save

#include "sflxmll.h"
int
xml_save (
    XML_ITEM   *item,
    const char *filename)

Synopsis

Saves an XML tree to the specified file. Returns the number of items saved, or -1 if there was an error.

Source Code - (sflxmll.c)

{
    FILE
        *xmlfile;                       /*  XML output stream                */
    XML_ITEM
        *child;
    int
        count;                          /*  How many symbols did we save?    */

    ASSERT (item);
    ASSERT (filename);
    init_charmaps ();                   /*  Initialise character maps        */

    if ((xmlfile = file open (filename, 'w')) == NULL)
        return (-1);                    /*  No permission to write file      */

    /*  Write XML file header                                                */
    fprintf (xmlfile, "<?XML VERSION=\"1.0\"?>\n");

    /*  Output children of XML root                                          */
    count = 0;
    FORCHILDREN (child, item)
        count += xml_save_item (xmlfile, child);

    file close (xmlfile);
    return (count);
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation