vincentneo/CoreGPX

Writing to GPXExtension

andrijamilovanovic opened this issue · 2 comments

HI,
I'm trying to add extension with code:

trackpoint.extensions = GPXExtensions()
trackpoint.extensions?.append(at: "gpxtpx:TrackPointExtension", contents: ["gpxtpx:hr":"2"])

Unfortunately, as a result, I'm getting invalid XML where open and closed tags for extensions are not properly paired.

<trk>
	<trkseg>
		<trkpt lat="1.2345" lon="2.3456">
			<ele>31.92492</ele>
			<time>2019-11-14T00:23:45Z</time>
			<extensions>
					<gpxtpx:hr>60</gpxtpx:hr>
					</gpxtpx:hr>
				</gpxtpx:TrackPointExtension>
			</extensions>
		</trkpt>
	</trkseg>
</trk>

I was trying to add dummy attributes to force GPXExtensionsElement into properly generate open tag, but still, I was not able to implement a workaround.

Thanks,
A.

Hi @andrijamilovanovic,

Sorry that this didn't work as expected. The extensions system is still rather buggy. Hopefully when more people uses it, it will get better, as I tend to overlook at certain bugs.

I think that this has something to do with issue #61. If it was, I should be able to get a fix done within hours.

@andrijamilovanovic
Pull request #65 should fix things up!