comparison js/core.js @ 2687:66a24a6a0358

#180. specification now holds processAttribute as private function. Schema is also set-once and hold
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Sat, 11 Mar 2017 08:48:04 +0000
parents 0a72855de078
children f4a146282ef5
comparison
equal deleted inserted replaced
2686:a005429f575b 2687:66a24a6a0358
191 // Load the project document from the given URL, decode the XML and instruct audioEngine to get audio data 191 // Load the project document from the given URL, decode the XML and instruct audioEngine to get audio data
192 // If url is null, request client to upload project XML document 192 // If url is null, request client to upload project XML document
193 var xmlhttp = new XMLHttpRequest(); 193 var xmlhttp = new XMLHttpRequest();
194 xmlhttp.open("GET", 'xml/test-schema.xsd', true); 194 xmlhttp.open("GET", 'xml/test-schema.xsd', true);
195 xmlhttp.onload = function () { 195 xmlhttp.onload = function () {
196 schemaXSD = xmlhttp.response; 196 specification.processSchema(xmlhttp.response);
197 var parse = new DOMParser();
198 specification.schema = parse.parseFromString(xmlhttp.response, 'text/xml');
199 var r = new XMLHttpRequest(); 197 var r = new XMLHttpRequest();
200 r.open('GET', url, true); 198 r.open('GET', url, true);
201 r.onload = function () { 199 r.onload = function () {
202 loadProjectSpecCallback(r.response); 200 loadProjectSpecCallback(r.response);
203 }; 201 };
250 // document is a specification 248 // document is a specification
251 249
252 // Perform XML schema validation 250 // Perform XML schema validation
253 var Module = { 251 var Module = {
254 xml: response, 252 xml: response,
255 schema: schemaXSD, 253 schema: specification.getSchemaString(),
256 arguments: ["--noout", "--schema", 'test-schema.xsd', 'document.xml'] 254 arguments: ["--noout", "--schema", 'test-schema.xsd', 'document.xml']
257 }; 255 };
258 projectXML = responseDocument; 256 projectXML = responseDocument;
259 var xmllint = validateXML(Module); 257 var xmllint = validateXML(Module);
260 console.log(xmllint); 258 console.log(xmllint);