# HG changeset patch # User Nicholas Jillings # Date 1479203536 0 # Node ID ae5e8818eff03e960befbd0e7c94167f106cc126 # Parent 4c04933c15ede3b80c17827f54b3af9448f7f2c8 #101. Updated specification.js diff -r 4c04933c15ed -r ae5e8818eff0 js/specification.js --- a/js/specification.js Tue Nov 15 09:45:42 2016 +0000 +++ b/js/specification.js Tue Nov 15 09:52:16 2016 +0000 @@ -781,6 +781,8 @@ this.label = null; this.startTime = undefined; this.stopTime = undefined; + this.sampleRate = undefined; + this.alternatives = []; this.schema = specification.schema.getAllElementsByName('audioelement')[0];; this.parent = null; this.decode = function (parent, xml) { @@ -800,6 +802,17 @@ break; } } + // Get the alternative nodes + var child = xml.firstElementChild; + while (child) { + if (child.nodeName == "alternative") { + this.alternatives.push({ + 'url': child.getAttribute("url"), + 'sampleRate': child.getAttribute("sampleRate") + }); + } + child = child.nextElementSibling; + } }; this.encode = function (root) { @@ -814,6 +827,12 @@ eval("AENode.setAttribute('" + name + "',this." + name + ")"); } } + this.alternatives.forEach(function (alt) { + var node = root.createElement("alternative"); + node.setAttribute("url", alt.url); + node.setAttribute("sampleRate", alt.sampleRate); + AENode.appendChild(node); + }); return AENode; }; };