xml_write
)
and the other writes just the content of the element (xml_writecontent
).
void xml_write (FILE * file, XML * xml) { ATTR * attr; ELEMENTLIST * list; |
if (xml->name == NULL) { fprintf (file, "%s", xml->attrs->value); return; } |
fprintf (file, "<%s", xml->name); attr = xml->attrs; while (attr != NULL) { fprintf (file, " %s=\"%s\"", attr->name, attr->value); attr = attr->next; } |
if (xml->children == NULL) { fprintf (file, "/>"); return; } else fprintf (file, ">"); |
xml_writecontent (file, xml); |
fprintf (file, "</%s>", xml->name); } |
void xml_writecontent (FILE * file, XML * xml) { ELEMENTLIST * list; list = xml->children; while (list) { xml_write (file, list->element); list = list->next; } } |
This code and documentation are released under the terms of the GNU license. They are additionally copyright (c) 2000, Vivtek. All rights reserved except those explicitly granted under the terms of the GNU license. This presentation was created using LPML. |