diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-07-01 12:30:33 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-01 12:38:40 -0700 |
commit | f7b7d4c2df7fb82421588c69b3aa34e702dcbfdb (patch) | |
tree | f56dddfb867eb64232858b0e8bec2b0f4be80fea /save-xml.c | |
parent | 6e81677d89591099266c1d94e06afbf54dbb6358 (diff) | |
download | subsurface-f7b7d4c2df7fb82421588c69b3aa34e702dcbfdb.tar.gz |
Geo taxonomy: save and load the taxonomy data with XML
If taxonomy data are available we are switching a dive site entry from
single item with attributes to an item that has children. This is
backwards compatible and older versions will simply ignore the children.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r-- | save-xml.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/save-xml.c b/save-xml.c index 988ede1bf..a81d4258d 100644 --- a/save-xml.c +++ b/save-xml.c @@ -539,7 +539,20 @@ void save_dives_buffer(struct membuffer *b, const bool select_only) } show_utf8(b, ds->description, " description='", "'", 1); show_utf8(b, ds->notes, " notes='", "'", 1); - put_format(b, "/>\n"); + if (prefs.geocoding.enable_geocoding && ds->taxonomy.nr) { + put_format(b, ">\n"); + for (int j = 0; j < ds->taxonomy.nr; j++) { + struct taxonomy *t = &ds->taxonomy.category[j]; + if (t->category != NONE) { + put_format(b, "<geo cat='%d'", t->category); + put_format(b, " origin='%d'", t->origin); + show_utf8(b, t->value, " value='", "'/>\n", 1); + } + } + put_format(b, "</site>\n"); + } else { + put_format(b, "/>\n"); + } } put_format(b, "</divesites>\n<dives>\n"); for (trip = dive_trip_list; trip != NULL; trip = trip->next) |