From b5f3e30de482eb17d86139958ee108e1c3424801 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 9 May 2013 10:27:15 +0200 Subject: [PATCH] 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. --- examples/universal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/universal.c b/examples/universal.c index 0f85592..51d1044 100644 --- a/examples/universal.c +++ b/examples/universal.c @@ -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, "\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, "\n"); + } + // Store the fingerprint data. if (g_cachedir) { fpwrite (divedata.fingerprint, g_cachedir, dc_device_get_type (device), devdata.devinfo.serial);