The GPX definition allows to create empty objects like
final GPX gpx = GPX.builder()
.metadata(md -> {})
.addTrack(track -> {})
.addTrack(track -> track
.addSegment(segment -> {})
.addSegment(segment -> segment
.addPoint(wp -> wp.ele(12).lat(21).lon(23))))
.build();
GPX.write(gpx, System.out, " ");
This leads to empty elements in the serialized GPX file.
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="JPX - https://jenetics.github.io/jpx" xmlns="http://www.topografix.com/GPX/1/1">
<metadata></metadata>
<trk></trk>
<trk>
<trkseg></trkseg>
<trkseg>
<trkpt lat="21.0" lon="23.0">
<ele>12.0</ele>
</trkpt>
</trkseg>
</trk>
</gpx>
The files are valid, but empty elements doesn't add additional information. The library should omit empty objects when writing them into a file.
The GPX definition allows to create empty objects like
This leads to empty elements in the serialized GPX file.
The files are valid, but empty elements doesn't add additional information. The library should omit empty objects when writing them into a file.