georust / gpx

Rust read/write support for GPS Exchange Format (GPX)
https://crates.io/crates/gpx
MIT License
98 stars 44 forks source link

Waypoint name can be an empty string #70

Closed cedeber closed 2 years ago

cedeber commented 2 years ago

Hello.

I found out that I have a GPX file with a waypoint name which is empty:

<wpt lat="47.940954" lon="7.158881">
  <ele>0</ele>
  <name><![CDATA[]]></name>
  <desc><![CDATA[]]></desc>
  <sym>3</sym>
</wpt>

Looking at the GPX spec: http://www.topografix.com/GPX/1/1/#type_wptType this seems to be valid.

GPX does not place restrictions on the length of this field or the characters contained in it.

But this crate makes it mandatory (allow_empty: false here): https://github.com/georust/gpx/blob/fec2051078dac099500ca1a033acaf3a27d7d16b/src/parser/waypoint.rs#L78

I believe we should allow it empty, don't you think? Thanks

lnicola commented 2 years ago

Sounds good, do you want to file a PR?

cedeber commented 2 years ago

Here we go. I didn't find any test specific for the waypoint. Do you already have something or do I add one?

lnicola commented 2 years ago

I'm not sure, I'm not from around :sweat_smile:.