Add a root element to the xml output.

Without the root element the output isn't valid xml. Although the
output is supposed to provide a human readable representation for
internal use only, and thus never really intended for processing by
third-party applications, it doesn't hurt to turn it into valid xml
either.
This commit is contained in:
Jef Driesen 2013-05-09 10:27:15 +02:00
parent c550685bfc
commit b5f3e30de4

View File

@ -727,6 +727,10 @@ dowork (dc_context_t *context, dc_descriptor_t *descriptor, const char *devname,
// Open the output file.
divedata.fp = fopen (xmlfile, "w");
if (divedata.fp) {
fprintf (divedata.fp, "<device>\n");
}
// Download the dives.
message ("Downloading the dives.\n");
rc = dc_device_foreach (device, dive_cb, &divedata);
@ -738,6 +742,10 @@ dowork (dc_context_t *context, dc_descriptor_t *descriptor, const char *devname,
return rc;
}
if (divedata.fp) {
fprintf (divedata.fp, "</device>\n");
}
// Store the fingerprint data.
if (g_cachedir) {
fpwrite (divedata.fingerprint, g_cachedir, dc_device_get_type (device), devdata.devinfo.serial);