b@2264
|
1 <html lang="en">
|
nicholas@2538
|
2
|
nicholas@2538
|
3 <head>
|
nicholas@2538
|
4 <meta charset="utf-8" />
|
nicholas@2538
|
5 <script type="text/javascript">
|
nicholas@2538
|
6 function getXML() {
|
nicholas@2538
|
7 var XMLHttp = new XMLHttpRequest();
|
nicholas@2538
|
8 XMLHttp.open("GET", "comment_parser.php?format=XML", true);
|
nicholas@2538
|
9 XMLHttp.onload = function() {
|
nicholas@2538
|
10 // Now we have the XML data, extract
|
nicholas@2538
|
11 var parse = new DOMParser();
|
nicholas@2538
|
12 var ajax = parse.parseFromString(XMLHttp.response, 'text/xml');
|
nicholas@2538
|
13
|
nicholas@2538
|
14 var parent = document.createElement("div");
|
nicholas@2538
|
15 parent.appendChild(ajax.children[0]);
|
nicholas@2538
|
16 var file = [parent.innerHTML];
|
nicholas@2538
|
17 var bb = new Blob(file, {
|
nicholas@2538
|
18 type: 'application/xml'
|
nicholas@2538
|
19 });
|
nicholas@2538
|
20 generateLink(bb, ".xml");
|
b@2264
|
21 }
|
nicholas@2538
|
22 XMLHttp.send();
|
nicholas@2538
|
23 }
|
nicholas@2538
|
24
|
nicholas@2538
|
25 function getJSON() {
|
nicholas@2538
|
26 var XMLHttp = new XMLHttpRequest();
|
nicholas@2538
|
27 XMLHttp.open("GET", "comment_parser.php?format=JSON", true);
|
nicholas@2538
|
28 XMLHttp.onload = function() {
|
nicholas@2538
|
29 // Now we have the XML data, extract
|
nicholas@2538
|
30 var file = [XMLHttp.response];
|
nicholas@2538
|
31 var bb = new Blob(file, {
|
nicholas@2538
|
32 type: 'application/json'
|
nicholas@2538
|
33 });
|
nicholas@2538
|
34 generateLink(bb, ".json");
|
b@2264
|
35 }
|
nicholas@2538
|
36 XMLHttp.send();
|
nicholas@2538
|
37 }
|
nicholas@2538
|
38
|
nicholas@2538
|
39 function getCSV() {
|
nicholas@2538
|
40 var XMLHttp = new XMLHttpRequest();
|
nicholas@2538
|
41 XMLHttp.open("GET", "comment_parser.php?format=CSV", true);
|
nicholas@2538
|
42 XMLHttp.onload = function() {
|
nicholas@2538
|
43 // Now we have the XML data, extract
|
nicholas@2538
|
44 var file = [XMLHttp.response];
|
nicholas@2538
|
45 var bb = new Blob(file, {
|
nicholas@2538
|
46 type: 'text/csv'
|
nicholas@2538
|
47 });
|
nicholas@2538
|
48 generateLink(bb, ".csv");
|
b@2264
|
49 }
|
nicholas@2538
|
50 XMLHttp.send();
|
nicholas@2538
|
51 }
|
nicholas@2538
|
52
|
nicholas@2538
|
53 function generateLink(blobfile, fmt) {
|
nicholas@2538
|
54 var dnlk = window.URL.createObjectURL(blobfile);
|
nicholas@2538
|
55 var a = document.createElement("a");
|
nicholas@2538
|
56 a.hidden = '';
|
nicholas@2538
|
57 a.href = dnlk;
|
nicholas@2538
|
58 a.download = "save" + fmt;
|
nicholas@2538
|
59 a.textContent = "Save File";
|
nicholas@2538
|
60 document.getElementById("download").appendChild(a);
|
nicholas@2538
|
61 }
|
nicholas@2538
|
62
|
nicholas@2538
|
63 </script>
|
nicholas@2538
|
64 </head>
|
nicholas@2538
|
65
|
nicholas@2538
|
66 <body>
|
nicholas@2538
|
67 <h1>WAET Test Results Analysis</h1>
|
nicholas@2538
|
68 <h2>Comment Extraction</h2>
|
nicholas@2538
|
69 <p>All of the XMLs in the server 'saves/' directory are automatically parsed and downloaded, extracting only the comments. Simply select the comments you wish to extract below and your desired data format.</p>
|
nicholas@2538
|
70 <div id="download"></div>
|
nicholas@2538
|
71 <div>
|
nicholas@2538
|
72 <button onclick="getXML();">XML</button>
|
nicholas@2538
|
73 <button onclick="getJSON();">JSON</button>
|
nicholas@2538
|
74 <button onclick="getCSV();">CSV</button>
|
nicholas@2538
|
75 </div>
|
nicholas@2538
|
76 </body>
|
nicholas@2538
|
77
|
nicholas@2538
|
78 </html>
|