From d6b410940975c7ccaf63c3509eda4ff25d16190f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 6 Nov 2014 10:34:19 -0800 Subject: Load and save extra data in Subsurface XML format Includes test dive to test missing attributes and the overall syntax. Signed-off-by: Dirk Hohndel --- save-xml.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'save-xml.c') diff --git a/save-xml.c b/save-xml.c index dc85d328b..a128cf04d 100644 --- a/save-xml.c +++ b/save-xml.c @@ -301,6 +301,19 @@ static void save_tags(struct membuffer *b, struct tag_entry *entry) } } +static void save_extra_data(struct membuffer *b, struct extra_data *ed) +{ + while (ed) { + if (ed->key && ed->value) { + put_string(b, " key, " key='", "'", 1); + show_utf8(b, ed->value, " value='", "'", 1); + put_string(b, " />\n"); + } + ed = ed->next; + } +} + static void show_date(struct membuffer *b, timestamp_t when) { struct tm tm; @@ -341,7 +354,7 @@ static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer save_airpressure(b, dc); save_salinity(b, dc); put_duration(b, dc->surfacetime, " ", " min\n"); - + save_extra_data(b, dc->extra_data); save_events(b, dc->events); save_samples(b, dc->samples, dc->sample); -- cgit v1.2.3-70-g09d2