I am hitting a website that supports xml downloads.
here is a smple link:
I process this in the following method:
The loop seems to get stuck on the first element. I get a count of 20 "clinical_trial" elements back in the xmlDoc (which is correct) but in the Log.logInfo() I get the first study back 20 times.
Thoughts?
-pf
here is a smple link:
Code:
var url = http://clinicaltrials.gov/search?intr=Cetuximab&displayxml=true XMLTools.loadXML(url, "ctTool.parseXML(xmlDoc, xmlText)");
Code:
parseXML: function(xmlDoc, xmlText) {
if (xmlDoc == null) {
return;
}
var studies = XMLTools.selectNodes(xmlDoc, "//clinical_study");
Log.logInfo("Number of studies found: " + studies.length);
var trialList = [];
for (var i = 0; i < studies.length; i++) {
var study = studies[i];
var trial = new Object();
Log.logInfo("found study: " + XMLTools.selectString(study, "//nct_id"));
trial.NCTID = XMLTools.selectString(study, "//nct_id");
trial.title = XMLTools.selectString(study, "//title");
trial.url = XMLTools.selectString(study, "//url");
trialList[trialList.length] = trial;
}
}
Thoughts?
-pf
Comment