Mercurial > hg > webaudioevaluationtool
changeset 2575:249a1152e525
Merge branch 'master' into Dev_main
# Conflicts:
# interfaces/AB.js
# js/core.js
# js/specification.js
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 18 Oct 2016 15:49:58 +0100 |
parents | b6bc57a2a681 (diff) 9b536838a962 (current diff) |
children | d002a342cfaf |
files | interfaces/AB.js js/core.js js/specification.js tests/examples/project.xml |
diffstat | 9 files changed, 719 insertions(+), 470 deletions(-) [+] |
line wrap: on
line diff
--- a/interfaces/timeline.js Tue Oct 18 10:33:17 2016 +0100 +++ b/interfaces/timeline.js Tue Oct 18 15:49:58 2016 +0100 @@ -506,7 +506,7 @@ break; } if (checkState == false) { - canContinue == false; + canContinue = false; } } if (!canContinue) {
--- a/js/core.js Tue Oct 18 10:33:17 2016 +0100 +++ b/js/core.js Tue Oct 18 15:49:58 2016 +0100 @@ -922,6 +922,33 @@ console.log("Checkbox: " + node.specification.statement); var inputs = this.popupResponse.getElementsByTagName('input'); node.response = []; + var numChecked = 0; + for (var i = 0; i < node.specification.options.length; i++) { + if (inputs[i].checked) { + numChecked++; + } + } + if (node.specification.min != undefined) { + if (node.specification.max == undefined) { + if (numChecked < node.specification.min) { + var msg = "You must select at least " + node.specification.min + " option"; + if (node.specification.min > 1) { + msg += "s"; + } + interfaceContext.lightbox.post("Error", msg); + return; + } + } else { + if (numChecked < node.specification.min || numChecked > node.specification.max) { + if (node.specification.min == node.specification.max) { + interfaceContext.lightbox.post("Error", "You must only select " + node.specification.min); + } else { + interfaceContext.lightbox.post("Error", "You must select between " + node.specification.min + " and " + node.specification.max); + } + return; + } + } + } for (var i = 0; i < node.specification.options.length; i++) { node.response.push({ name: node.specification.options[i].name, @@ -1695,21 +1722,20 @@ }; this.setSynchronousLoop = function () { - // Pads the signals so they are all exactly the same length - // Get the length of the longest signal. - var length = 0; + // Pads the signals so they are all exactly the same duration + // Get the duration of the longest signal. + var duration = 0; var maxId; for (var i = 0; i < this.audioObjects.length; i++) { - if (length < this.audioObjects[i].buffer.buffer.length) { - length = this.audioObjects[i].buffer.buffer.length; + if (duration < this.audioObjects[i].buffer.buffer.duration) { + duration = this.audioObjects[i].buffer.buffer.duration; maxId = i; } } // Extract the audio and zero-pad for (var ao of this.audioObjects) { - var lengthDiff = length - ao.buffer.buffer.length; - if (lengthDiff > 0) { - ao.buffer.buffer = ao.buffer.copyBuffer(0, samplesToSeconds(lengthDiff, ao.buffer.buffer.sampleRate)); + if (ao.buffer.buffer.duration !== duration) { + ao.buffer.buffer = ao.buffer.copyBuffer(0, duration - ao.buffer.buffer.duration); } } }; @@ -3245,8 +3271,10 @@ break; case "radio": var child = this.parent.document.createElement('response'); - child.setAttribute('name', node.response.name); - child.textContent = node.response.text; + if (node.response !== null) { + child.setAttribute('name', node.response.name); + child.textContent = node.response.text; + } surveyresult.appendChild(child); break; case "checkbox":
--- a/js/specification.js Tue Oct 18 10:33:17 2016 +0100 +++ b/js/specification.js Tue Oct 18 15:49:58 2016 +0100 @@ -1,12 +1,12 @@ function Specification() { - // Handles the decoding of the project specification XML into a simple JavaScript Object. - + // Handles the decoding of the project specification XML into a simple JavaScript Object. + // <setup> attributes - this.interface = null; - this.projectReturn = null; + this.interface = null; + this.projectReturn = null; this.returnURL = null; - this.randomiseOrder = null; - this.poolSize = null; + this.randomiseOrder = null; + this.poolSize = null; this.loudness = null; this.sampleRate = null; this.calibration = null; @@ -14,32 +14,31 @@ this.preSilence = null; this.postSilence = null; this.playOne = null; - + // nodes this.metrics = null; this.preTest = undefined; this.postTest = undefined; - this.pages = []; - this.interfaces = null; - this.errors = []; - this.schema = null; + this.pages = []; + this.interfaces = null; + this.errors = []; + this.schema = null; this.exitText = "Thank you."; - - this.processAttribute = function(attribute,schema,schemaRoot) - { - // attribute is the string returned from getAttribute on the XML - // schema is the <xs:attribute> node - if (schema.getAttribute('name') == undefined && schema.getAttribute('ref') != undefined) - { - schema = schemaRoot.getAllElementsByName(schema.getAttribute('ref'))[0]; - } - var defaultOpt = schema.getAttribute('default'); - if (attribute == null) { - attribute = defaultOpt; - } - var dataType = schema.getAttribute('type'); - if (typeof dataType == "string") { dataType = dataType.substr(3);} - else { + + this.processAttribute = function (attribute, schema, schemaRoot) { + // attribute is the string returned from getAttribute on the XML + // schema is the <xs:attribute> node + if (schema.getAttribute('name') == undefined && schema.getAttribute('ref') != undefined) { + schema = schemaRoot.getAllElementsByName(schema.getAttribute('ref'))[0]; + } + var defaultOpt = schema.getAttribute('default'); + if (attribute == null) { + attribute = defaultOpt; + } + var dataType = schema.getAttribute('type'); + if (typeof dataType == "string") { + dataType = dataType.substr(3); + } else { var rest = schema.getAllElementsByTagName("xs:restriction").concat(schema.getAllElementsByTagName("xs:enumeration")); if (rest.length > 0) { dataType = rest[0].getAttribute("base"); @@ -52,129 +51,122 @@ dataType = "string"; } } - if (attribute == null) - { - return attribute; - } - switch(dataType) - { - case "boolean": - if (attribute == 'true'){attribute = true;}else{attribute=false;} - break; - case "negativeInteger": - case "positiveInteger": - case "nonNegativeInteger": - case "nonPositiveInteger": - case "integer": - case "decimal": - case "short": - attribute = Number(attribute); - break; - case "string": - default: - attribute = String(attribute); - break; - } - return attribute; - }; - - this.decode = function(projectXML) { - this.errors = []; - // projectXML - DOM Parsed document - this.projectXML = projectXML.childNodes[0]; - var setupNode = projectXML.getElementsByTagName('setup')[0]; - var schemaSetup = this.schema.getAllElementsByName('setup')[0]; - // First decode the attributes - var attributes = schemaSetup.getAllElementsByTagName('xs:attribute'); - for (var i=0; i<attributes.length; i++) - { - var attributeName = attributes[i].getAttribute('name') || attributes[i].getAttribute('ref'); - var projectAttr = setupNode.getAttribute(attributeName); - projectAttr = this.processAttribute(projectAttr,attributes[i],this.schema); - switch(typeof projectAttr) - { - case "number": - case "boolean": - eval('this.'+attributeName+' = '+projectAttr); - break; - case "string": - eval('this.'+attributeName+' = "'+projectAttr+'"'); - break; - } - - } - + if (attribute == null) { + return attribute; + } + switch (dataType) { + case "boolean": + if (attribute == 'true') { + attribute = true; + } else { + attribute = false; + } + break; + case "negativeInteger": + case "positiveInteger": + case "nonNegativeInteger": + case "nonPositiveInteger": + case "integer": + case "decimal": + case "short": + attribute = Number(attribute); + break; + case "string": + default: + attribute = String(attribute); + break; + } + return attribute; + }; + + this.decode = function (projectXML) { + this.errors = []; + // projectXML - DOM Parsed document + this.projectXML = projectXML.childNodes[0]; + var setupNode = projectXML.getElementsByTagName('setup')[0]; + var schemaSetup = this.schema.getAllElementsByName('setup')[0]; + // First decode the attributes + var attributes = schemaSetup.getAllElementsByTagName('xs:attribute'); + for (var i = 0; i < attributes.length; i++) { + var attributeName = attributes[i].getAttribute('name') || attributes[i].getAttribute('ref'); + var projectAttr = setupNode.getAttribute(attributeName); + projectAttr = this.processAttribute(projectAttr, attributes[i], this.schema); + switch (typeof projectAttr) { + case "number": + case "boolean": + eval('this.' + attributeName + ' = ' + projectAttr); + break; + case "string": + eval('this.' + attributeName + ' = "' + projectAttr + '"'); + break; + } + + } + var exitTextNode = setupNode.getElementsByTagName('exitText'); if (exitTextNode.length == 1) { this.exitText = exitTextNode[0].textContent; } - - this.metrics = new this.metricNode(); - - this.metrics.decode(this,setupNode.getElementsByTagName('metric')[0]); - - // Now process the survey node options - var survey = setupNode.getElementsByTagName('survey'); - for (var i=0; i<survey.length; i++){ - var location = survey[i].getAttribute('location'); - switch(location) - { + + this.metrics = new this.metricNode(); + + this.metrics.decode(this, setupNode.getElementsByTagName('metric')[0]); + + // Now process the survey node options + var survey = setupNode.getElementsByTagName('survey'); + for (var i = 0; i < survey.length; i++) { + var location = survey[i].getAttribute('location'); + switch (location) { case 'pre': case 'before': - this.preTest = new this.surveyNode(this); - this.preTest.decode(this,survey[i]); + this.preTest = new this.surveyNode(this); + this.preTest.decode(this, survey[i]); break; case 'post': case 'after': this.postTest = new this.surveyNode(this); - this.postTest.decode(this,survey[i]); + this.postTest.decode(this, survey[i]); break; } - } - - var interfaceNode = setupNode.getElementsByTagName('interface'); - if (interfaceNode.length > 1) - { - this.errors.push("Only one <interface> node in the <setup> node allowed! Others except first ingnored!"); - } - this.interfaces = new this.interfaceNode(this); - if (interfaceNode.length != 0) - { - interfaceNode = interfaceNode[0]; - this.interfaces.decode(this,interfaceNode,this.schema.getAllElementsByName('interface')[1]); - } - - // Page tags - var pageTags = projectXML.getElementsByTagName('page'); - var pageSchema = this.schema.getAllElementsByName('page')[0]; - for (var i=0; i<pageTags.length; i++) - { - var node = new this.page(this); - node.decode(this,pageTags[i],pageSchema); - this.pages.push(node); - } - }; - - this.encode = function() - { - var RootDocument = document.implementation.createDocument(null,"waet"); - var root = RootDocument.firstChild; - root.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"); - root.setAttribute("xsi:noNamespaceSchemaLocation","test-schema.xsd"); - // Build setup node + } + + var interfaceNode = setupNode.getElementsByTagName('interface'); + if (interfaceNode.length > 1) { + this.errors.push("Only one <interface> node in the <setup> node allowed! Others except first ingnored!"); + } + this.interfaces = new this.interfaceNode(this); + if (interfaceNode.length != 0) { + interfaceNode = interfaceNode[0]; + this.interfaces.decode(this, interfaceNode, this.schema.getAllElementsByName('interface')[1]); + } + + // Page tags + var pageTags = projectXML.getElementsByTagName('page'); + var pageSchema = this.schema.getAllElementsByName('page')[0]; + for (var i = 0; i < pageTags.length; i++) { + var node = new this.page(this); + node.decode(this, pageTags[i], pageSchema); + this.pages.push(node); + } + }; + + this.encode = function () { + var RootDocument = document.implementation.createDocument(null, "waet"); + var root = RootDocument.firstChild; + root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); + root.setAttribute("xsi:noNamespaceSchemaLocation", "test-schema.xsd"); + // Build setup node var setup = RootDocument.createElement("setup"); var schemaSetup = this.schema.getAllElementsByName('setup')[0]; // First decode the attributes var attributes = schemaSetup.getAllElementsByTagName('xs:attribute'); - for (var i=0; i<attributes.length; i++) - { + for (var i = 0; i < attributes.length; i++) { var name = attributes[i].getAttribute("name"); if (name == undefined) { name = attributes[i].getAttribute("ref"); } - if(eval("this."+name+" != undefined") || attributes[i].getAttribute("use") == "required") - { - eval("setup.setAttribute('"+name+"',this."+name+")"); + if (eval("this." + name + " != undefined") || attributes[i].getAttribute("use") == "required") { + eval("setup.setAttribute('" + name + "',this." + name + ")"); } } root.appendChild(setup); @@ -188,73 +180,71 @@ setup.appendChild(this.postTest.encode(RootDocument)); setup.appendChild(this.metrics.encode(RootDocument)); setup.appendChild(this.interfaces.encode(RootDocument)); - for (var page of this.pages) - { + for (var page of this.pages) { root.appendChild(page.encode(RootDocument)); } - return RootDocument; - }; - - this.surveyNode = function(specification) { - this.location = null; - this.options = []; + return RootDocument; + }; + + this.surveyNode = function (specification) { + this.location = null; + this.options = []; this.parent = null; - this.schema = specification.schema.getAllElementsByName('survey')[0]; + this.schema = specification.schema.getAllElementsByName('survey')[0]; this.specification = specification; - - this.OptionNode = function(specification) { - this.type = undefined; - this.schema = specification.schema.getAllElementsByName('surveyentry')[0]; - this.id = undefined; + + this.OptionNode = function (specification) { + this.type = undefined; + this.schema = specification.schema.getAllElementsByName('surveyentry')[0]; + this.id = undefined; this.name = undefined; - this.mandatory = undefined; - this.statement = undefined; - this.boxsize = undefined; - this.options = []; - this.min = undefined; - this.max = undefined; - this.step = undefined; + this.mandatory = undefined; + this.statement = undefined; + this.boxsize = undefined; + this.options = []; + this.min = undefined; + this.max = undefined; + this.step = undefined; this.conditions = []; - - this.decode = function(parent,child) - { - var attributeMap = this.schema.getAllElementsByTagName('xs:attribute'); - for (var i in attributeMap){ - if(isNaN(Number(i)) == true){break;} - var attributeName = attributeMap[i].getAttribute('name') || attributeMap[i].getAttribute('ref'); - var projectAttr = child.getAttribute(attributeName); - projectAttr = parent.processAttribute(projectAttr,attributeMap[i],parent.schema); - switch(typeof projectAttr) - { - case "number": - case "boolean": - eval('this.'+attributeName+' = '+projectAttr); - break; - case "string": - eval('this.'+attributeName+' = "'+projectAttr+'"'); - break; - } - } - this.statement = child.getElementsByTagName('statement')[0].textContent; - if (this.type == "checkbox" || this.type == "radio") { - var children = child.getElementsByTagName('option'); - if (children.length == null) { - console.log('Malformed' +child.nodeName+ 'entry'); - this.statement = 'Malformed' +child.nodeName+ 'entry'; - this.type = 'statement'; - } else { - this.options = []; - for (var i=0; i<children.length; i++) - { - this.options.push({ - name: children[i].getAttribute('name'), - text: children[i].textContent - }); - } - } - } + + this.decode = function (parent, child) { + var attributeMap = this.schema.getAllElementsByTagName('xs:attribute'); + for (var i in attributeMap) { + if (isNaN(Number(i)) == true) { + break; + } + var attributeName = attributeMap[i].getAttribute('name') || attributeMap[i].getAttribute('ref'); + var projectAttr = child.getAttribute(attributeName); + projectAttr = parent.processAttribute(projectAttr, attributeMap[i], parent.schema); + switch (typeof projectAttr) { + case "number": + case "boolean": + eval('this.' + attributeName + ' = ' + projectAttr); + break; + case "string": + eval('this.' + attributeName + ' = "' + projectAttr + '"'); + break; + } + } + this.statement = child.getElementsByTagName('statement')[0].textContent; + if (this.type == "checkbox" || this.type == "radio") { + var children = child.getElementsByTagName('option'); + if (children.length == null) { + console.log('Malformed' + child.nodeName + 'entry'); + this.statement = 'Malformed' + child.nodeName + 'entry'; + this.type = 'statement'; + } else { + this.options = []; + for (var i = 0; i < children.length; i++) { + this.options.push({ + name: children[i].getAttribute('name'), + text: children[i].textContent + }); + } + } + } var conditionElements = child.getElementsByTagName("conditional"); - for (var i=0; i<conditionElements.length; i++) { + for (var i = 0; i < conditionElements.length; i++) { var condition = conditionElements[i]; var obj = { check: condition.getAttribute("check"), @@ -264,185 +254,215 @@ } this.conditions.push(obj); } - }; - - this.exportXML = function(doc) - { - var node = doc.createElement('surveyentry'); - node.setAttribute('type',this.type); - var statement = doc.createElement('statement'); - statement.textContent = this.statement; - node.appendChild(statement); + }; + + this.exportXML = function (doc) { + var node = doc.createElement('surveyentry'); + node.setAttribute('type', this.type); + var statement = doc.createElement('statement'); + statement.textContent = this.statement; + node.appendChild(statement); node.id = this.id; - if (this.name != undefined) { node.setAttribute("name",this.name);} - if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);} + if (this.name != undefined) { + node.setAttribute("name", this.name); + } + if (this.mandatory != undefined) { + node.setAttribute("mandatory", this.mandatory); + } node.id = this.id; - if (this.name != undefined) {node.setAttribute("name",this.name);} - switch(this.type) - { + if (this.name != undefined) { + node.setAttribute("name", this.name); + } + switch (this.type) { case "checkbox": + if (this.min != undefined) { + node.setAttribute("min", this.min); + } else { + node.setAttribute("min", "0"); + } + if (this.max != undefined) { + node.setAttribute("max", this.max); + } else { + node.setAttribute("max", "undefined"); + } case "radio": - for (var i=0; i<this.options.length; i++) - { + for (var i = 0; i < this.options.length; i++) { var option = this.options[i]; var optionNode = doc.createElement("option"); - optionNode.setAttribute("name",option.name); + optionNode.setAttribute("name", option.name); optionNode.textContent = option.text; node.appendChild(optionNode); } + break; case "number": - if (this.min != undefined) {node.setAttribute("min", this.min);} - if (this.max != undefined) {node.setAttribute("max", this.max);} + if (this.min != undefined) { + node.setAttribute("min", this.min); + } + if (this.max != undefined) { + node.setAttribute("max", this.max); + } + break; case "question": - if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);} - if (this.mandatory != undefined) {node.setAttribute("mandatory",this.mandatory);} + if (this.boxsize != undefined) { + node.setAttribute("boxsize", this.boxsize); + } + if (this.mandatory != undefined) { + node.setAttribute("mandatory", this.mandatory); + } + break; + case "video": + if (this.mandatory != undefined) { + node.setAttribute("mandatory", this.mandatory); + } + case "youtube": + if (this.url != undefined) { + node.setAttribute("url", this.url); + } + break; default: break; } for (var condition of this.conditions) { var conditionDOM = doc.createElement("conditional"); - conditionDOM.setAttribute("check",condition.check); - conditionDOM.setAttribute("value",condition.value); - conditionDOM.setAttribute("jumpToOnPass",condition.jumpToOnPass); - conditionDOM.setAttribute("jumpToOnFail",condition.jumpToOnFail); + conditionDOM.setAttribute("check", condition.check); + conditionDOM.setAttribute("value", condition.value); + conditionDOM.setAttribute("jumpToOnPass", condition.jumpToOnPass); + conditionDOM.setAttribute("jumpToOnFail", condition.jumpToOnFail); node.appendChild(conditionDOM); } - return node; - }; - }; - this.decode = function(parent,xml) { + return node; + }; + }; + this.decode = function (parent, xml) { this.parent = parent; - this.location = xml.getAttribute('location'); - if (this.location == 'before'){this.location = 'pre';} - else if (this.location == 'after'){this.location = 'post';} + this.location = xml.getAttribute('location'); + if (this.location == 'before') { + this.location = 'pre'; + } else if (this.location == 'after') { + this.location = 'post'; + } var children = xml.getAllElementsByTagName('surveyentry'); - for (var i=0; i<children.length; i++) - { - var node = new this.OptionNode(this.specification); - node.decode(parent,children[i]); - this.options.push(node); - } + for (var i = 0; i < children.length; i++) { + var node = new this.OptionNode(this.specification); + node.decode(parent, children[i]); + this.options.push(node); + } if (this.options.length == 0) { console.log("Empty survey node"); console.log(this); } - }; - this.encode = function(doc) { - var node = doc.createElement('survey'); - node.setAttribute('location',this.location); - for (var i=0; i<this.options.length; i++) - { - node.appendChild(this.options[i].exportXML(doc)); - } - return node; - }; - }; - - this.interfaceNode = function(specification) - { - this.title = null; - this.name = null; - this.options = []; - this.scales = []; - this.schema = specification.schema.getAllElementsByName('interface')[1]; - - this.decode = function(parent,xml) { - this.name = xml.getAttribute('name'); - var titleNode = xml.getElementsByTagName('title'); - if (titleNode.length == 1) - { - this.title = titleNode[0].textContent; - } - var interfaceOptionNodes = xml.getElementsByTagName('interfaceoption'); - // Extract interfaceoption node schema - var interfaceOptionNodeSchema = this.schema.getAllElementsByName('interfaceoption')[0]; - var attributeMap = interfaceOptionNodeSchema.getAllElementsByTagName('xs:attribute'); - for (var i=0; i<interfaceOptionNodes.length; i++) - { - var ioNode = interfaceOptionNodes[i]; - var option = {}; - for (var j=0; j<attributeMap.length; j++) - { - var attributeName = attributeMap[j].getAttribute('name') || attributeMap[j].getAttribute('ref'); - var projectAttr = ioNode.getAttribute(attributeName); - if(parent.processAttribute) { + }; + this.encode = function (doc) { + var node = doc.createElement('survey'); + node.setAttribute('location', this.location); + for (var i = 0; i < this.options.length; i++) { + node.appendChild(this.options[i].exportXML(doc)); + } + return node; + }; + }; + + this.interfaceNode = function (specification) { + this.title = null; + this.name = null; + this.options = []; + this.scales = []; + this.schema = specification.schema.getAllElementsByName('interface')[1]; + + this.decode = function (parent, xml) { + this.name = xml.getAttribute('name'); + var titleNode = xml.getElementsByTagName('title'); + if (titleNode.length == 1) { + this.title = titleNode[0].textContent; + } + var interfaceOptionNodes = xml.getElementsByTagName('interfaceoption'); + // Extract interfaceoption node schema + var interfaceOptionNodeSchema = this.schema.getAllElementsByName('interfaceoption')[0]; + var attributeMap = interfaceOptionNodeSchema.getAllElementsByTagName('xs:attribute'); + for (var i = 0; i < interfaceOptionNodes.length; i++) { + var ioNode = interfaceOptionNodes[i]; + var option = {}; + for (var j = 0; j < attributeMap.length; j++) { + var attributeName = attributeMap[j].getAttribute('name') || attributeMap[j].getAttribute('ref'); + var projectAttr = ioNode.getAttribute(attributeName); + if (parent.processAttribute) { parent.processAttribute(projectAttr, attributeMap[j], parent.schema) } else { parent.parent.processAttribute(projectAttr, attributeMap[j], parent.parent.schema) } - switch(typeof projectAttr) - { - case "number": - case "boolean": - eval('option.'+attributeName+' = '+projectAttr); - break; - case "string": - eval('option.'+attributeName+' = "'+projectAttr+'"'); - break; - } - } - this.options.push(option); - } - - // Now the scales nodes - var scaleParent = xml.getElementsByTagName('scales'); - if (scaleParent.length == 1) { - scaleParent = scaleParent[0]; + switch (typeof projectAttr) { + case "number": + case "boolean": + eval('option.' + attributeName + ' = ' + projectAttr); + break; + case "string": + eval('option.' + attributeName + ' = "' + projectAttr + '"'); + break; + } + } + this.options.push(option); + } + + // Now the scales nodes + var scaleParent = xml.getElementsByTagName('scales'); + if (scaleParent.length == 1) { + scaleParent = scaleParent[0]; var scalelabels = scaleParent.getAllElementsByTagName('scalelabel'); - for (var i=0; i<scalelabels.length; i++) { - this.scales.push({ - text: scalelabels[i].textContent, - position: Number(scalelabels[i].getAttribute('position')) - }); - } - } - }; - - this.encode = function(doc) { - var node = doc.createElement("interface"); + for (var i = 0; i < scalelabels.length; i++) { + this.scales.push({ + text: scalelabels[i].textContent, + position: Number(scalelabels[i].getAttribute('position')) + }); + } + } + }; + + this.encode = function (doc) { + var node = doc.createElement("interface"); if (typeof name == "string") - node.setAttribute("name",this.name); + node.setAttribute("name", this.name); if (typeof this.title == "string") { var titleNode = doc.createElement("title"); titleNode.textContent = this.title; node.appendChild(titleNode); } - for (var option of this.options) - { + for (var option of this.options) { var child = doc.createElement("interfaceoption"); - child.setAttribute("type",option.type); - child.setAttribute("name",option.name); + child.setAttribute("type", option.type); + child.setAttribute("name", option.name); node.appendChild(child); } if (this.scales.length != 0) { var scales = doc.createElement("scales"); - for (var scale of this.scales) - { + for (var scale of this.scales) { var child = doc.createElement("scalelabel"); - child.setAttribute("position",scale.position); + child.setAttribute("position", scale.position); child.textContent = scale.text; scales.appendChild(child); } node.appendChild(scales); } return node; - }; - }; - - this.metricNode = function() { + }; + }; + + this.metricNode = function () { this.enabled = []; - this.decode = function(parent, xml) { + this.decode = function (parent, xml) { var children = xml.getElementsByTagName('metricenable'); - for (var i in children) { - if (isNaN(Number(i)) == true){break;} + for (var i in children) { + if (isNaN(Number(i)) == true) { + break; + } this.enabled.push(children[i].textContent); } } - this.encode = function(doc) { + this.encode = function (doc) { var node = doc.createElement('metric'); - for (var i in this.enabled) - { - if (isNaN(Number(i)) == true){break;} + for (var i in this.enabled) { + if (isNaN(Number(i)) == true) { + break; + } var child = doc.createElement('metricenable'); child.textContent = this.enabled[i]; node.appendChild(child); @@ -450,30 +470,30 @@ return node; } } - - this.page = function(specification) { - this.presentedId = undefined; - this.id = undefined; + + this.page = function (specification) { + this.presentedId = undefined; + this.id = undefined; this.title = undefined; - this.hostURL = undefined; - this.randomiseOrder = undefined; - this.loop = undefined; - this.outsideReference = null; - this.loudness = null; + this.hostURL = undefined; + this.randomiseOrder = undefined; + this.loop = undefined; + this.outsideReference = null; + this.loudness = null; this.label = null; - this.preTest = null; - this.postTest = null; - this.interfaces = []; + this.labelStart = ""; + this.preTest = null; + this.postTest = null; + this.interfaces = []; this.playOne = null; - this.commentBoxPrefix = "Comment on track"; - this.audioElements = []; - this.commentQuestions = []; - this.schema = specification.schema.getAllElementsByName("page")[0]; + this.commentBoxPrefix = "Comment on track"; + this.audioElements = []; + this.commentQuestions = []; + this.schema = specification.schema.getAllElementsByName("page")[0]; this.specification = specification; this.parent = null; - - this.decode = function(parent,xml) - { + + this.decode = function (parent, xml) { this.parent = parent; var attributeMap = this.schema.getAllElementsByTagName('xs:attribute'); for (var i=0; i<attributeMap.length; i++) @@ -559,139 +579,129 @@ var AHNode = root.createElement("page"); // First decode the attributes var attributes = this.schema.getAllElementsByTagName('xs:attribute'); - for (var i=0; i<attributes.length; i++) - { + for (var i = 0; i < attributes.length; i++) { var name = attributes[i].getAttribute("name"); if (name == undefined) { name = attributes[i].getAttribute("ref"); } - if(eval("this."+name+" != undefined") || attributes[i].getAttribute("use") == "required") - { - eval("AHNode.setAttribute('"+name+"',this."+name+")"); + if (eval("this." + name + " != undefined") || attributes[i].getAttribute("use") == "required") { + eval("AHNode.setAttribute('" + name + "',this." + name + ")"); } } - if(this.loudness != null) {AHNode.setAttribute("loudness",this.loudness);} + if (this.loudness != null) { + AHNode.setAttribute("loudness", this.loudness); + } // <commentboxprefix> var commentboxprefix = root.createElement("commentboxprefix"); commentboxprefix.textContent = this.commentBoxPrefix; AHNode.appendChild(commentboxprefix); - - for (var i=0; i<this.interfaces.length; i++) - { - AHNode.appendChild(this.interfaces[i].encode(root)); - } - - for (var i=0; i<this.audioElements.length; i++) { - AHNode.appendChild(this.audioElements[i].encode(root)); - } - // Create <CommentQuestion> - for (var i=0; i<this.commentQuestions.length; i++) - { - AHNode.appendChild(this.commentQuestions[i].encode(root)); - } - - AHNode.appendChild(this.preTest.encode(root)); + + for (var i = 0; i < this.interfaces.length; i++) { + AHNode.appendChild(this.interfaces[i].encode(root)); + } + + for (var i = 0; i < this.audioElements.length; i++) { + AHNode.appendChild(this.audioElements[i].encode(root)); + } + // Create <CommentQuestion> + for (var i = 0; i < this.commentQuestions.length; i++) { + AHNode.appendChild(this.commentQuestions[i].encode(root)); + } + + AHNode.appendChild(this.preTest.encode(root)); AHNode.appendChild(this.postTest.encode(root)); - return AHNode; - }; - - this.commentQuestionNode = function(specification) { - this.id = null; + return AHNode; + }; + + this.commentQuestionNode = function (specification) { + this.id = null; this.name = undefined; - this.type = undefined; - this.options = []; - this.statement = undefined; - this.schema = specification.schema.getAllElementsByName('commentquestion')[0]; - this.decode = function(parent,xml) - { - this.id = xml.id; + this.type = undefined; + this.options = []; + this.statement = undefined; + this.schema = specification.schema.getAllElementsByName('commentquestion')[0]; + this.decode = function (parent, xml) { + this.id = xml.id; this.name = xml.getAttribute('name'); - this.type = xml.getAttribute('type'); - this.statement = xml.getElementsByTagName('statement')[0].textContent; - var optNodes = xml.getElementsByTagName('option'); - for (var i=0; i<optNodes.length; i++) - { - var optNode = optNodes[i]; - this.options.push({ - name: optNode.getAttribute('name'), - text: optNode.textContent - }); - } - }; - - this.encode = function(root) - { - var node = root.createElement("commentquestion"); + this.type = xml.getAttribute('type'); + this.statement = xml.getElementsByTagName('statement')[0].textContent; + var optNodes = xml.getElementsByTagName('option'); + for (var i = 0; i < optNodes.length; i++) { + var optNode = optNodes[i]; + this.options.push({ + name: optNode.getAttribute('name'), + text: optNode.textContent + }); + } + }; + + this.encode = function (root) { + var node = root.createElement("commentquestion"); node.id = this.id; - node.setAttribute("type",this.type); - if (this.name != undefined){node.setAttribute("name",this.name);} + node.setAttribute("type", this.type); + if (this.name != undefined) { + node.setAttribute("name", this.name); + } var statement = root.createElement("statement"); statement.textContent = this.statement; node.appendChild(statement); - for (var option of this.options) - { + for (var option of this.options) { var child = root.createElement("option"); - child.setAttribute("name",option.name); + child.setAttribute("name", option.name); child.textContent = option.text; node.appendChild(child); } return node; - }; - }; - - this.audioElementNode = function(specification) { - this.url = null; - this.id = null; + }; + }; + + this.audioElementNode = function (specification) { + this.url = null; + this.id = null; this.name = null; - this.parent = null; - this.type = null; - this.marker = null; - this.enforce = false; - this.gain = 0.0; + this.parent = null; + this.type = null; + this.marker = null; + this.enforce = false; + this.gain = 0.0; this.label = null; this.startTime = undefined; this.stopTime = undefined; - this.schema = specification.schema.getAllElementsByName('audioelement')[0];; - this.parent = null; - this.decode = function(parent,xml) - { - this.parent = parent; - var attributeMap = this.schema.getAllElementsByTagName('xs:attribute'); - for (var i=0; i<attributeMap.length; i++) - { - var attributeName = attributeMap[i].getAttribute('name') || attributeMap[i].getAttribute('ref'); - var projectAttr = xml.getAttribute(attributeName); - projectAttr = parent.parent.processAttribute(projectAttr,attributeMap[i],parent.parent.schema); - switch(typeof projectAttr) - { - case "number": - case "boolean": - eval('this.'+attributeName+' = '+projectAttr); - break; - case "string": - eval('this.'+attributeName+' = "'+projectAttr+'"'); - break; - } - } - - }; - this.encode = function(root) - { - var AENode = root.createElement("audioelement"); - var attributes = this.schema.getAllElementsByTagName('xs:attribute'); - for (var i=0; i<attributes.length; i++) - { + this.schema = specification.schema.getAllElementsByName('audioelement')[0];; + this.parent = null; + this.decode = function (parent, xml) { + this.parent = parent; + var attributeMap = this.schema.getAllElementsByTagName('xs:attribute'); + for (var i = 0; i < attributeMap.length; i++) { + var attributeName = attributeMap[i].getAttribute('name') || attributeMap[i].getAttribute('ref'); + var projectAttr = xml.getAttribute(attributeName); + projectAttr = parent.parent.processAttribute(projectAttr, attributeMap[i], parent.parent.schema); + switch (typeof projectAttr) { + case "number": + case "boolean": + eval('this.' + attributeName + ' = ' + projectAttr); + break; + case "string": + eval('this.' + attributeName + ' = "' + projectAttr + '"'); + break; + } + } + + }; + this.encode = function (root) { + var AENode = root.createElement("audioelement"); + var attributes = this.schema.getAllElementsByTagName('xs:attribute'); + for (var i = 0; i < attributes.length; i++) { var name = attributes[i].getAttribute("name"); if (name == undefined) { name = attributes[i].getAttribute("ref"); } - if(eval("this."+name+" != undefined") || attributes[i].getAttribute("use") == "required") - { - eval("AENode.setAttribute('"+name+"',this."+name+")"); + if (eval("this." + name + " != undefined") || attributes[i].getAttribute("use") == "required") { + eval("AENode.setAttribute('" + name + "',this." + name + ")"); } } - return AENode; - }; - }; - }; + return AENode; + }; + }; + }; }
--- a/python/generate_report.py Tue Oct 18 10:33:17 2016 +0100 +++ b/python/generate_report.py Tue Oct 18 15:49:58 2016 +0100 @@ -116,9 +116,10 @@ # generate images for later use if render_figures: - subprocess.call("python timeline_view_movement.py '"+folder_name+"'", shell=True) - subprocess.call("python score_parser.py '"+folder_name+"'", shell=True) - subprocess.call("python score_plot.py '"+folder_name+"ratings/'", shell=True) + script_path = os.path.dirname(os.path.realpath(__file__)) # where is generate_report.py? + subprocess.call("python " +script_path+"/timeline_view_movement.py '"+folder_name+"'", shell=True) + subprocess.call("python " +script_path+"/score_parser.py '"+folder_name+"'", shell=True) + subprocess.call("python " +script_path+"/score_plot.py '"+folder_name+"ratings/'", shell=True) # make array of text and array of dates body_array = []
--- a/python/timeline_view_movement.py Tue Oct 18 10:33:17 2016 +0100 +++ b/python/timeline_view_movement.py Tue Oct 18 15:49:58 2016 +0100 @@ -124,9 +124,10 @@ stop_times_global = [] listen_events = audioelement.findall("./metric/metricresult/[@name='elementListenTracker']/event") for event in listen_events: - # get testtime: start and stop - start_times_global.append(float(event.find('testtime').get('start')))#-time_offset) - stop_times_global.append(float(event.find('testtime').get('stop')))#-time_offset) + if event.find('testtime') is not None: + # get testtime: start and stop + start_times_global.append(float(event.find('testtime').get('start')))#-time_offset) + stop_times_global.append(float(event.find('testtime').get('stop')))#-time_offset) # display fragment name at start plt.text(0,initial_position+0.02,audio_id,color=colormap[increment%len(colormap)]) #,rotation=45 @@ -289,12 +290,35 @@ plt.ylabel('Rating') # default plt.ylim(0, 1) # rating between 0 and 1 - # TO DO: - # Y axis title and tick labels as specified in 'setup' for corresponding page + # Y axis title and tick labels as specified in 'setup' + # for corresponding page + page_setup = root.find("./waet/page[@id='"+page_name+"']") + # 'ref' of page is 'id' in page setup + # Different plots for different axes + interfaces = page_setup.findall("./interface") + interface_title = interfaces[0].find("./title") + scales = interfaces[0].findall("./scales") # get first interface by default + scalelabels = scales[0].findall("./scalelabel") # get first scale by default + + labelpos = [] # array of scalelabel positions + labelstr = [] # array of strings at labels + for scalelabel in scalelabels: + labelpos.append(float(scalelabel.get('position'))/100.0) + labelstr.append(scalelabel.text) + + # use interface name as Y axis label + if interface_title is not None: + plt.ylabel(interface_title.text) + else: + plt.ylabel('Rating') # default + + if len(labelpos): + plt.yticks(labelpos, labelstr) #plt.show() # uncomment to show plot; comment when just saving #exit() + # save as PDF plt.savefig(timeline_folder+subject_id+"-"+page_name+".pdf", bbox_inches='tight') plt.close()
--- a/test_create/attributes.json Tue Oct 18 10:33:17 2016 +0100 +++ b/test_create/attributes.json Tue Oct 18 15:49:58 2016 +0100 @@ -27,5 +27,9 @@ "postSilence": "Post Silence", "poolSize": "Pool Size", "alwaysInclude": "Always Include", - "crossFade": "Cross Fade" + "crossFade": "Cross Fade", + "check": "Check", + "value": "Value", + "jumpToOnPass": "Jump To ID On Pass", + "jumpToOnFail": "Jump To ID On Fail" }
--- a/test_create/test_core.js Tue Oct 18 10:33:17 2016 +0100 +++ b/test_create/test_core.js Tue Oct 18 15:49:58 2016 +0100 @@ -855,7 +855,62 @@ maximumEntry.value = this.option.max; this.dynamic.appendChild(maximum); break; + case "video": + case "youtube": + this.dynamic.appendChild(id); + + var mandatory = document.createElement("div"); + var mandatoryInput = document.createElement("input"); + var mandatoryText = document.createElement("span"); + mandatoryText.textContent = "Mandatory: "; + mandatory.appendChild(mandatoryText); + mandatory.appendChild(mandatoryInput); + mandatory.className = "survey-entry-attribute"; + mandatoryInput.type = "checkbox"; + if (this.option.mandatory) {mandatoryInput.checked = true;} else {mandatoryInput.checked = false;} + mandatoryInput.setAttribute("name","mandatory"); + mandatoryInput.addEventListener("change",this,false); + this.dynamic.appendChild(mandatory); + + var url = document.createElement("div"); + var urlInput = document.createElement("input"); + var urlText = document.createElement("span"); + urlText.textContent = "URL: "; + url.appendChild(urlText); + url.appendChild(urlInput); + url.className = "survey-entry-attribute"; + urlInput.type = "text"; + if (this.option.mandatory) {urlInput.value = this.option.mandatory;} else {urlInput.value = "";} + urlInput.setAttribute("name","url"); + urlInput.addEventListener("change",this,false); + this.dynamic.appendChild(url); + break; case "checkbox": + var minimum = document.createElement("div"); + var minimumEntry = document.createElement("input"); + var minimumText = document.createElement("span"); + minimumText.textContent = "Minimum: "; + minimum.appendChild(minimumText); + minimum.appendChild(minimumEntry); + minimum.className = "survey-entry-attribute"; + minimumEntry.type = "number"; + minimumEntry.setAttribute("name","min"); + minimumEntry.addEventListener("change",this,false); + minimumEntry.value = this.option.min; + this.dynamic.appendChild(minimum); + + var maximum = document.createElement("div"); + var maximumEntry = document.createElement("input"); + var maximumText = document.createElement("span"); + maximumText.textContent = "Maximum: "; + maximum.appendChild(maximumText); + maximum.appendChild(maximumEntry); + maximum.className = "survey-entry-attribute"; + maximumEntry.type = "number"; + maximumEntry.setAttribute("name","max"); + maximumEntry.addEventListener("change",this,false); + maximumEntry.value = this.option.max; + this.dynamic.appendChild(maximum); case "radio": this.dynamic.appendChild(id); var optionHolder = document.createElement("div"); @@ -938,7 +993,7 @@ this.dynamic.appendChild(optionHolder); } } - this.handleEvent = function() + this.handleEvent = function(event) { var name = event.currentTarget.getAttribute("name"); var nodeName = event.currentTarget.nodeName; @@ -1888,6 +1943,8 @@ var max = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("max")[0]); this.attributeDOM.appendChild(id.holder); this.attributes.push(id); + this.attributeDOM.appendChild(mandatory.holder); + this.attributes.push(mandatory); this.attributeDOM.appendChild(min.holder); this.attributes.push(min); this.attributeDOM.appendChild(max.holder); @@ -1896,8 +1953,14 @@ case "checkbox": this.titleDOM.textContent = "Checkbox"; var id = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("id")[0]); + var min = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("min")[0]); + var max = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("max")[0]); this.attributeDOM.appendChild(id.holder); this.attributes.push(id); + this.attributeDOM.appendChild(min.holder); + this.attributes.push(min); + this.attributeDOM.appendChild(max.holder); + this.attributes.push(max); break; case "radio": this.titleDOM.textContent = "Radio"; @@ -1905,10 +1968,122 @@ this.attributeDOM.appendChild(id.holder); this.attributes.push(id); break; + case "video": + this.titleDOM.textContent = "Video"; + var id = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("id")[0]); + this.attributeDOM.appendChild(id.holder); + this.attributes.push(id); + var mandatory = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("mandatory")[0]); + var url = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("url")[0]); + this.attributeDOM.appendChild(mandatory.holder); + this.attributes.push(mandatory); + this.attributeDOM.appendChild(url.holder); + this.attributes.push(url); + break; + case "youtube": + this.titleDOM.textContent = "YouTube"; + var id = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("id")[0]); + this.attributeDOM.appendChild(id.holder); + this.attributes.push(id); + var mandatory = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("mandatory")[0]); + var url = convert.convertAttributeToDOM(this.specification,specification.schema.getAllElementsByName("url")[0]); + this.attributeDOM.appendChild(mandatory.holder); + this.attributes.push(mandatory); + this.attributeDOM.appendChild(url.holder); + this.attributes.push(url); + break; } } this.build(); + var Conditional = function(parent, rootObject) { + this.type = "surveyEntryConditionalNode"; + this.rootDOM = document.createElement("div"); + this.titleDOM = document.createElement("span"); + this.attributeDOM = document.createElement("div"); + this.attributes = []; + this.childrenDOM = document.createElement("div"); + this.children = []; + this.buttonDOM = document.createElement("div"); + this.parent = parent; + this.specification = rootObject; + this.schema = specification.schema.getAllElementsByName("conditional")[0]; + + this.rootDOM.className = "node"; + this.rootDOM.style.minWidth = "50%"; + + var titleDiv = document.createElement('div'); + titleDiv.className = "node-title"; + this.titleDOM.className = "node-title"; + titleDiv.appendChild(this.titleDOM); + + this.attributeDOM.className = "node-attributes"; + this.childrenDOM.className = "node-children"; + this.buttonDOM.className = "node-buttons"; + + this.rootDOM.appendChild(titleDiv); + this.rootDOM.appendChild(this.attributeDOM); + this.rootDOM.appendChild(this.childrenDOM); + this.rootDOM.appendChild(this.buttonDOM); + + var attributeList = this.schema.getAllElementsByTagName("xs:attribute"); + + for (var i=0; i<attributeList.length; i++) { + var attributeName = attributeList[i].getAttribute("name"); + var attribute = convert.convertAttributeToDOM(this.specification,this.schema.getAllElementsByName(attributeName)[0]); + this.attributes.push(attribute); + this.attributeDOM.appendChild(attribute.holder); + } + + this.build = function() { + } + + this.deleteNode = { + root: document.createElement("button"), + parent: this, + handleEvent: function(event) { + this.parent.parent.childrenDOM.removeChild(this.parent.rootDOM); + this.parent.parent.addConditional.root.disabled = false; + var index = this.parent.parent.children.findIndex(function(element){ + if (this == element) {return true;} return false; + },this.parent); + if (index >= 0) { + this.parent.parent.children.splice(index,1); + } + index = this.parent.parent.specification.conditions.findIndex(function(element){ + if (this == element) {return true;} return false; + },this.parent.specification); + if (index >= 0) { + this.parent.parent.specification.conditions.splice(index); + } + } + } + this.deleteNode.root.textContent = "Delete"; + this.deleteNode.root.addEventListener("click",this.deleteNode); + + this.buttonDOM.appendChild(this.deleteNode.root); + } + + this.addConditional = { + root: document.createElement("button"), + parent: this, + handleEvent: function(event) { + var spec = { + check: null, + value: null, + jumpToOnPass: null, + jumpToOnFail: null + }; + this.parent.specification.conditions.push(spec); + var condition = new Conditional(this.parent,spec); + this.parent.children.push(condition); + this.parent.childrenDOM.appendChild(condition.rootDOM); + } + } + this.addConditional.root.addEventListener("click",this.addConditional); + this.addConditional.root.textContent = "Add Condition"; + this.buttonDOM.appendChild(this.addConditional.root); + this.editNode = { root: document.createElement("button"), parent: this, @@ -2017,6 +2192,12 @@ this.moveButtons.root_down.textContent = "Move Down"; this.buttonDOM.appendChild(this.moveButtons.root_up); this.buttonDOM.appendChild(this.moveButtons.root_down); + + for (var condition of this.specification.conditions) { + var newNode = new Conditional(this,condition); + this.children.push(newNode); + this.childrenDOM.appendChild(newNode.rootDOM); + } } this.addNode = { root: document.createElement("button"),
--- a/tests/examples/project.xml Tue Oct 18 10:33:17 2016 +0100 +++ b/tests/examples/project.xml Tue Oct 18 15:49:58 2016 +0100 @@ -6,7 +6,7 @@ <statement>Please enter your name.</statement> <conditional check="equals" value="John" jumpToOnPass="test-intro" jumpToOnFail="checkboxtest"/> </surveyentry> - <surveyentry type="checkbox" id="checkboxtest" mandatory="true"> + <surveyentry type="checkbox" id="checkboxtest" mandatory="true" min="2" max="4"> <statement>Please select with which activities you have any experience (example checkbox question)</statement> <option name="musician">Playing a musical instrument</option> <option name="soundengineer">Recording or mixing audio</option>
--- a/xml/test-schema.xsd Tue Oct 18 10:33:17 2016 +0100 +++ b/xml/test-schema.xsd Tue Oct 18 15:49:58 2016 +0100 @@ -26,8 +26,8 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - - <xs:attribute name="playOne" type="xs:boolean" default="false"/> + + <xs:attribute name="playOne" type="xs:boolean" default="false" /> <!-- define complex elements--> <xs:element name="waet"> @@ -96,6 +96,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> + <xs:attribute name="labelStart" use="optional" type="xs:string" default="" /> <xs:attribute ref="poolSize" /> <xs:attribute ref="alwaysInclude" /> <xs:attribute ref="preSilence" /> @@ -254,16 +255,16 @@ <xs:attribute name="check" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> - <xs:enumeration value="equals"/> - <xs:enumeration value="lessThan"/> - <xs:enumeration value="greaterThan"/> - <xs:enumeration value="stringContains"/> + <xs:enumeration value="equals" /> + <xs:enumeration value="lessThan" /> + <xs:enumeration value="greaterThan" /> + <xs:enumeration value="stringContains" /> </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute name="value" type="xs:string" use="optional"/> - <xs:attribute name="jumpToOnPass" type="xs:string" use="optional"/> - <xs:attribute name="jumpToOnFail" type="xs:string" use="optional"/> + <xs:attribute name="value" type="xs:string" use="optional" /> + <xs:attribute name="jumpToOnPass" type="xs:string" use="optional" /> + <xs:attribute name="jumpToOnFail" type="xs:string" use="optional" /> </xs:complexType> </xs:element> </xs:sequence> @@ -295,7 +296,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute name="url" type="xs:string" use="optional"/> + <xs:attribute name="url" type="xs:string" use="optional" default="" /> </xs:complexType> </xs:element> </xs:sequence>