Closed tstanis closed 6 years ago
I'll quote from README.md
:
WARNING: The only part of the GPX standard which is not completely implemented are GPX extensions. The API for GPX extensions will change in future versions!!!
I was thinking on a customizable extensions helper which need to specify a serializer and underializer functions to user's own custom object. Then, those will be executed during parsing or .to_xml()
.
Everything not (de)serialized with this serialized will be in the existing extensions
map. This will not break the existing versions.
Unfortunately, at the moment I don't have the time to implement that :( But, if somebody is willing to implement this, I'm willing to help/discuss/merge.
For example, consider these extensions:
The problem is that GPXExtensionField assumes that all extensions are simple values, and doesn't parse the children:
https://github.com/tkrajina/gpxpy/blob/master/gpxpy/gpxfield.py#L254
I think the fix is to make the extensions into objects, but this breaks API compatibility as some users are expecting that extensions['myextension'] returns a string value, not an object. One way to deal with this would be to have extensions have a new field called subExtensions that contains the children.
What do you think?