In order to get information from the "extensions" node, you need to write a class that implements the IExtensionParser interface. This class will define methods for handling "extensions" data from all standard gpx entities (trk, rte, wpt). After you have implemented your class, you need to register it with the GPXParser:
GPXParser p = new GPXParser();
p.addExtensionParser(an instance of your parser class);
p.parseGPX("your gpx file");
if you need additional help, please post a fragment of a gpx file, so I may see the xml structure that needs to be parsed.
Here is a link with some explanation on how to use extension parsers:
Hi,
First, thank you for your job.
I need some help to create an ExtensionParser. I want to get nodes with
heart rate. In my GPX, this look like:
<trkpt lat="43.864633664488792" lon="-1.323068914934993">
<ele>-11.880000000000001</ele>
<extensions>
<gpxtpx:TrackPointExtension>
<gpxtpx:hr>85</gpxtpx:hr>
</gpxtpx:TrackPointExtension>
</extensions>
</trkpt>
How can i obtain the "85" ?
Thanks for your help
Fabien (France)
Hello,
In order to get information from the "extensions" node, you need to write a class that implements the IExtensionParser interface. This class will define methods for handling "extensions" data from all standard gpx entities (trk, rte, wpt). After you have implemented your class, you need to register it with the GPXParser:
if you need additional help, please post a fragment of a gpx file, so I may see the xml structure that needs to be parsed.
Here is a link with some explanation on how to use extension parsers:
http://gpxparser.alternativevision.ro/pages/extensionsHowTo.html
Last edit: Gheorghe Bot 2013-09-16
Thanks for your help. I created this topic via mail, so the XML structure is not visible.
Hello, this is how to add the extension parser:
This is a sample HeartrateExtensionParser:
~~~~~~~~~
import org.alternativevision.gpx.beans.GPX;
import org.alternativevision.gpx.beans.Route;
import org.alternativevision.gpx.beans.Track;
import org.alternativevision.gpx.beans.Waypoint;
import org.alternativevision.gpx.extensions.IExtensionParser;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
public class HeartrateExtensionParser implements IExtensionParser {
}
~~~~~~~
I made the extension parsing to a waypoint node, you will need to add node processing to the corresponding nodes from the gpx entities.
Cheers,
Ghita
Thanks ! I will try this.
Perfect, it's works, thanks !!
Great.