vincentneo / CoreGPX

A library for parsing and creation of GPX location files. Purely Swift.
https://www.vincent-neo.com
MIT License
261 stars 57 forks source link

Link element not populating link property with GPXLink #67

Closed davetroy closed 4 years ago

davetroy commented 4 years ago

Hi, I'm attempting to import a file full of waypoints that look like this:

<wpt lat="39.497486" lon="-76.232724">
  <name><![CDATA[State Of Maryland]]></name>
  <cmt><![CDATA[Near John F. Kennedy Memorial Highway (Interstate 95) , near Aberdeen, (In the median)]]></cmt>
  <desc><![CDATA[General Washington resigned his commission at Annapolis, December 23, 1783. American Revolution officially ended by Congress meeting in Annapolis, January 14, 1783. District of Columbia given to Nation, 1791. Francis Scott Key wrote "The Star-Spangled Banner," Baltimore, September, 1814. Nation's first national highway, railroad, and telegraph established in Maryland.]]></desc>
  <link href="https://www.hmdb.org/m.asp?m=25"></link>
  <sym>Waypoint</sym>
</wpt>

When I do this, the waypoint's link property is nil, while other properties are populated. Any idea what might be causing this? I would expect link to be a GPXLink and for link.href to be equal to https://www.hmdb.org/m.asp?m=25. Thanks in advance!

vincentneo commented 4 years ago

I’ll take a look at this issue, later today. I think it probably has something to do with the XML parser

vincentneo commented 4 years ago

@davetroy, so sorry! It was a silly mistake when I did the implementation of the XML parser: I ignored the link tag when parsing all waypoint types!

Commit https://github.com/vincentneo/CoreGPX/commit/b777c7585e3c454306fb84ec79fae7d6d9f69f17 should fix this. Do update me if successful, or if some unexpected behaviour occurs.

davetroy commented 4 years ago

That did the trick, thanks so much for the quick fix!