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.
This commit is contained in:
Jef Driesen 2023-05-15 19:48:11 +02:00
parent 63f5a4d652
commit 9b7aa813e0

View File

@ -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, "<salinity type=\"%u\">%.1f</salinity>\n",
salinity.type, salinity.density);
const char *names[] = {"fresh", "salt"};
if (salinity.density) {
fprintf (output->ostream, "<salinity density=\"%.1f\">%s</salinity>\n",
salinity.density, names[salinity.type]);
} else {
fprintf (output->ostream, "<salinity>%s</salinity>\n",
names[salinity.type]);
}
}
// Parse the atmospheric pressure.