From 9b7aa813e0a9291b10e370847c139d19bb4c57b0 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 15 May 2023 19:48:11 +0200 Subject: [PATCH] Change the salinity format in the xml output Replace the numeric type with a name (fresh or salt) and change the density value into an xml attribute. The type is the primary information here, while the density value is optional. --- examples/output_xml.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/output_xml.c b/examples/output_xml.c index 7489af6..7d06aae 100644 --- a/examples/output_xml.c +++ b/examples/output_xml.c @@ -450,8 +450,14 @@ dctool_xml_output_write (dctool_output_t *abstract, dc_parser_t *parser, const u } if (status != DC_STATUS_UNSUPPORTED) { - fprintf (output->ostream, "%.1f\n", - salinity.type, salinity.density); + const char *names[] = {"fresh", "salt"}; + if (salinity.density) { + fprintf (output->ostream, "%s\n", + salinity.density, names[salinity.type]); + } else { + fprintf (output->ostream, "%s\n", + names[salinity.type]); + } } // Parse the atmospheric pressure.