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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-11-06 10:34:19 -08:00
parent 9aefaa1ec8
commit d6b4109409
3 changed files with 45 additions and 2 deletions

View file

@ -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, " <extradata");
show_utf8(b, ed->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, " <surfacetime>", " min</surfacetime>\n");
save_extra_data(b, dc->extra_data);
save_events(b, dc->events);
save_samples(b, dc->samples, dc->sample);