Bug #1616
Cannot read xml files from analysis.html
Status: | Resolved | Start date: | 2016-02-21 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | - | |||
Target version: | - |
Description
I guess it has been abandoned by now, anyhoewI was having these weird errors when accessing analytics.html: the file was retrieved but the XML was not parsed.:
xmlhttp.overrideMimeType('text/xml');
As suggested here http://stackoverflow.com/questions/3781387/responsexml-always-null
I went through many other edits of the file and eventually got rid of all the errors, but I did not get any visualization.
diff file below:
diff -r 26b9c01ad2cc analyse.html --- a/analyse.html Sun Feb 21 03:35:27 2016 +0000 +++ b/analyse.html Sun Feb 21 09:06:29 2016 +0000 @@ -24,7 +24,7 @@ xmlFileFolder = "saves"; // array of XML files // THIS IS WHERE YOU SPECIFY RESULT XML FILES TO ANALYSE - var xmlFiles = ['test-0.xml','test-1.xml','test-2.xml','test-3.xml']; + var xmlFiles = ['test-2.xml']; //TODO: make retrieval of file names automatic / drag files on here @@ -284,6 +284,7 @@ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET",xmlFileName,false); + xmlhttp.overrideMimeType('text/xml'); xmlhttp.send(); return xmlhttp.responseXML; } @@ -300,11 +301,11 @@ fileNameArray.push(xmlFiles[fileIndex]); // get root of XML file - root = xml.getElementsByTagName('browserevaluationresult')[0]; + root = xml.getElementsByTagName('waetresult')[0]; // get subject ID, add to array if not already there - pretest = root.getElementsByTagName('pretest')[0]; - subjectID = pretest.getElementsByTagName('comment')[0]; + pretestSurveyResult = root.getElementsByTagName('surveyresult')[0]; + subjectID = pretestSurveyResult.getElementsByTagName('comment')[0]; if (subjectID){ if (subjectID.getAttribute('id')!='sessionId') { // warning in console when not available console.log(xmlFiles[fileIndex]+': no SessionID available'); @@ -378,7 +379,7 @@ // which songs did they do if (xml != null) { // if file exists // get root of XML file - root = xml.getElementsByTagName('browserevaluationresult')[0]; + root = xml.getElementsByTagName('waetresult')[0]; // go over all audioholders // document.getElementById('div_survey_'+xmlFileName).innerHTML += '<strong>Audioholders: </strong>'; // audioholderNodes = root.getElementsByTagName('audioholder'); @@ -415,7 +416,7 @@ function makePlots() { //TODO: split into different functions // TEMPORARY - makeTimeline(xmlFileFolder+"/"+xmlFiles[7]); + makeTimeline(xmlFileFolder+"/"+xmlFiles[0]); // create value array var ratings = []; // 3D matrix of ratings (audioholder, audioelement, subject) @@ -432,7 +433,7 @@ xml = readXML(xmlFileName); if (xml != null) { // if file exists // get root of XML file - root = xml.getElementsByTagName('browserevaluationresult')[0]; + root = xml.getElementsByTagName('waetresult')[0]; // go over all audioholders audioholderNodes = root.getElementsByTagName('audioholder'); for (audioholderIndex = 0; audioholderIndex < audioholderNodes.length; audioholderIndex++) { @@ -594,7 +595,7 @@ return; // do nothing; exit function } // get root of XML file - root = xml.getElementsByTagName('browserevaluationresult')[0]; + root = xml.getElementsByTagName('waetresult')[0]; audioholder_time = 0; previous_audioholder_time = 0; // time spent before current audioholder
History
#1 Updated by Nicholas Jillings almost 9 years ago
I think the page may get replaced anyway by a python & PHP implementations. This was built on the previous specification (where <page> nodes were called <audioHolders>).
#2 Updated by Nicholas Jillings over 8 years ago
- Status changed from New to Resolved