I am interfacing with an existing API (from Garmin) that is very poorly documented and I need some help. The function I am calling is expecting a parameter that I don't know how to initialize properly.
The code in the API looks like this, where activities
is the parameter I supply:
if (activities != null && activities.length > 0) {
var activityDom = activities[0].getAttribute('dom');
var gpxNode = activityDom.ownerDocument.getElementsByTagName('gpx');
if (gpxNode.length > 0) {
// grab creator information from the dom if possible
var creatorStr = gpxNode[0].getAttribute('creator');
The parameter activities
is an array of Activity
objects, so far so good.
But what should I set as value for activities[0].getAttribute('dom')
? I understand that it is probably some XML object, but how do I define it so that the above code can parse it?
In case it is of interest, here is the source code for the produceString function from which the above snippet comes from (slightly simplified).
Source for the class Activity.