annotate ape.js @ 669:c8eb821710fa

audioElement id's tracked from input to output for randomisation.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 10 Apr 2015 17:18:45 +0100
parents 6455bee85090
children 77c974fd7e60
rev   line source
n@656 1 /**
n@656 2 * ape.js
n@656 3 * Create the APE interface
n@656 4 */
n@656 5
n@656 6 /*
n@656 7 *
n@656 8 * WARNING!!!
n@656 9 *
n@656 10 * YOU ARE VIEWING THE DEV VERSION. THERE IS NO GUARANTEE THIS WILL BE FULLY FUNCTIONAL
n@656 11 *
n@656 12 * WARNING!!!
n@656 13 *
n@656 14 */
n@656 15
n@662 16 var currentState; // Keep track of the current state (pre/post test, which test, final test? first test?)
n@662 17 // preTest - In preTest state
n@662 18 // testRun-ID - In test running, test Id number at the end 'testRun-2'
n@662 19 // testRunPost-ID - Post test of test ID
n@662 20 // testRunPre-ID - Pre-test of test ID
n@662 21 // postTest - End of test, final submission!
n@662 22
n@656 23
n@656 24 // Once this is loaded and parsed, begin execution
n@656 25 loadInterface(projectXML);
n@656 26
n@656 27 function loadInterface(xmlDoc) {
n@656 28
n@656 29 // Get the dimensions of the screen available to the page
n@656 30 var width = window.innerWidth;
n@656 31 var height = window.innerHeight;
n@656 32
n@656 33 // The injection point into the HTML page
n@656 34 var insertPoint = document.getElementById("topLevelBody");
n@656 35 var testContent = document.createElement('div');
n@656 36 testContent.id = 'testContent';
n@656 37
n@656 38
n@656 39 // Decode parts of the xmlDoc that are needed
n@656 40 // xmlDoc MUST already be parsed by jQuery!
n@656 41 var xmlSetup = xmlDoc.find('setup');
n@656 42 // Should put in an error function here incase of malprocessed or malformed XML
n@656 43
n@658 44 // Extract the different test XML DOM trees
n@668 45 var audioHolders = xmlDoc.find('audioHolder');
n@668 46 audioHolders.each(function(index,element) {
n@668 47 var repeatN = element.attributes['repeatCount'].value;
n@668 48 for (var r=0; r<=repeatN; r++) {
n@668 49 testXMLSetups[testXMLSetups.length] = element;
n@668 50 }
n@668 51 });
n@668 52
n@668 53 // New check if we need to randomise the test order
n@669 54 var randomise = xmlSetup[0].attributes['randomiseOrder'];
n@669 55 if (randomise != undefined) {
n@668 56 randomise = Boolean(randomise.value);
n@668 57 } else {
n@668 58 randomise = false;
n@668 59 }
n@668 60 if (randomise)
n@668 61 {
n@668 62 // TODO: Implement Randomisation!!
n@668 63 }
n@668 64
n@658 65
n@656 66 // Create the top div for the Title element
n@656 67 var titleAttr = xmlSetup[0].attributes['title'];
n@656 68 var title = document.createElement('div');
n@656 69 title.className = "title";
n@656 70 title.align = "center";
n@656 71 var titleSpan = document.createElement('span');
n@656 72
n@656 73 // Set title to that defined in XML, else set to default
n@656 74 if (titleAttr != undefined) {
n@656 75 titleSpan.innerHTML = titleAttr.value;
n@656 76 } else {
n@656 77 titleSpan.innerHTML = 'APE Tool';
n@656 78 }
n@656 79 // Insert the titleSpan element into the title div element.
n@656 80 title.appendChild(titleSpan);
n@656 81
n@656 82 // Store the return URL path in global projectReturn
n@656 83 projectReturn = xmlSetup[0].attributes['projectReturn'].value;
n@656 84
n@656 85 // Create Interface buttons!
n@656 86 var interfaceButtons = document.createElement('div');
n@656 87 interfaceButtons.id = 'interface-buttons';
n@656 88
n@656 89 // MANUAL DOWNLOAD POINT
n@656 90 // If project return is null, this MUST be specified as the location to create the download link
n@656 91 var downloadPoint = document.createElement('div');
n@656 92 downloadPoint.id = 'download-point';
n@656 93
n@656 94 // Create playback start/stop points
n@656 95 var playback = document.createElement("button");
n@656 96 playback.innerHTML = 'Start';
n@656 97 // onclick function. Check if it is playing or not, call the correct function in the
n@656 98 // audioEngine, change the button text to reflect the next state.
n@656 99 playback.onclick = function() {
n@656 100 if (audioEngineContext.status == 0) {
n@656 101 audioEngineContext.play();
n@656 102 this.innerHTML = 'Stop';
n@656 103 } else {
n@656 104 audioEngineContext.stop();
n@656 105 this.innerHTML = 'Start';
n@656 106 }
n@656 107 };
n@656 108 // Create Submit (save) button
n@656 109 var submit = document.createElement("button");
n@656 110 submit.innerHTML = 'Submit';
n@667 111 submit.onclick = buttonSubmitClick;
n@656 112 // Append the interface buttons into the interfaceButtons object.
n@656 113 interfaceButtons.appendChild(playback);
n@656 114 interfaceButtons.appendChild(submit);
n@656 115 interfaceButtons.appendChild(downloadPoint);
n@656 116
n@656 117 // Now create the slider and HTML5 canvas boxes
n@656 118
n@656 119 // Create the div box to center align
n@656 120 var sliderBox = document.createElement('div');
n@656 121 sliderBox.className = 'sliderCanvasDiv';
n@656 122 sliderBox.id = 'sliderCanvasHolder';
n@656 123 sliderBox.align = 'center';
n@656 124
n@656 125 // Create the slider box to hold the slider elements
n@656 126 var canvas = document.createElement('div');
n@656 127 canvas.id = 'slider';
n@656 128 // Must have a known EXACT width, as this is used later to determine the ratings
n@656 129 canvas.style.width = width - 100 +"px";
n@656 130 canvas.align = "left";
n@656 131 sliderBox.appendChild(canvas);
n@656 132
n@656 133 // Global parent for the comment boxes on the page
n@656 134 var feedbackHolder = document.createElement('div');
n@658 135 feedbackHolder.id = 'feedbackHolder';
n@656 136
n@662 137 testContent.style.zIndex = 1;
n@662 138 insertPoint.innerHTML = null; // Clear the current schema
n@662 139
n@656 140 // Create pre and post test questions
n@662 141 var blank = document.createElement('div');
n@662 142 blank.className = 'testHalt';
n@656 143
n@662 144 var popupHolder = document.createElement('div');
n@662 145 popupHolder.id = 'popupHolder';
n@662 146 popupHolder.className = 'popupHolder';
n@662 147 popupHolder.style.position = 'absolute';
n@662 148 popupHolder.style.left = (window.innerWidth/2)-250 + 'px';
n@662 149 popupHolder.style.top = (window.innerHeight/2)-125 + 'px';
n@662 150 insertPoint.appendChild(popupHolder);
n@662 151 insertPoint.appendChild(blank);
n@662 152 hidePopup();
n@656 153
n@660 154 var preTest = xmlSetup.find('PreTest');
n@660 155 var postTest = xmlSetup.find('PostTest');
n@656 156 preTest = preTest[0];
n@656 157 postTest = postTest[0];
n@662 158
n@662 159 currentState = 'preTest';
n@656 160
n@656 161 // Create Pre-Test Box
n@656 162 if (preTest != undefined && preTest.children.length >= 1)
n@656 163 {
n@662 164 showPopup();
n@663 165 preTestPopupStart(preTest);
n@656 166 }
n@662 167
n@662 168 // Inject into HTML
n@662 169 testContent.appendChild(title); // Insert the title
n@662 170 testContent.appendChild(interfaceButtons);
n@662 171 testContent.appendChild(sliderBox);
n@662 172 testContent.appendChild(feedbackHolder);
n@662 173 insertPoint.appendChild(testContent);
n@656 174
n@660 175 // Load the full interface
n@663 176
n@656 177 }
n@656 178
n@663 179 function loadTest(id)
n@658 180 {
n@658 181 // Used to load a specific test page
n@663 182 var textXML = testXMLSetups[id];
n@658 183
n@658 184 var feedbackHolder = document.getElementById('feedbackHolder');
n@658 185 var canvas = document.getElementById('slider');
n@658 186 feedbackHolder.innerHTML = null;
n@658 187 canvas.innerHTML = null;
n@658 188
n@658 189 // Extract the hostURL attribute. If not set, create an empty string.
n@658 190 var hostURL = textXML.attributes['hostURL'];
n@658 191 if (hostURL == undefined) {
n@658 192 hostURL = "";
n@658 193 } else {
n@658 194 hostURL = hostURL.value;
n@658 195 }
n@658 196 // Extract the sampleRate. If set, convert the string to a Number.
n@658 197 var hostFs = textXML.attributes['sampleRate'];
n@658 198 if (hostFs != undefined) {
n@658 199 hostFs = Number(hostFs.value);
n@658 200 }
n@658 201
n@658 202 /// CHECK FOR SAMPLE RATE COMPATIBILITY
n@658 203 if (hostFs != undefined) {
n@658 204 if (Number(hostFs) != audioContext.sampleRate) {
n@658 205 var errStr = 'Sample rates do not match! Requested '+Number(hostFs)+', got '+audioContext.sampleRate+'. Please set the sample rate to match before completing this test.';
n@658 206 alert(errStr);
n@658 207 return;
n@658 208 }
n@658 209 }
n@669 210
n@669 211 var randomise = textXML.attributes['randomiseOrder'];
n@669 212 if (randomise != undefined) {randomise = randomise.value;}
n@669 213 else {randomise = false;}
n@669 214
n@658 215 var audioElements = $(textXML).find('audioElements');
n@658 216 audioElements.each(function(index,element){
n@669 217 // Find any blind-repeats
n@669 218 // Not implemented yet, but just incase
n@669 219 currentTrackOrder[index] = element;
n@669 220 });
n@669 221 if (randomise) {
n@669 222 // TODO: Randomise order
n@669 223 }
n@669 224
n@669 225 // Find all the audioElements from the audioHolder
n@669 226 $(currentTrackOrder).each(function(index,element){
n@658 227 // Find URL of track
n@658 228 // In this jQuery loop, variable 'this' holds the current audioElement.
n@658 229
n@658 230 // Now load each audio sample. First create the new track by passing the full URL
n@658 231 var trackURL = hostURL + this.attributes['url'].value;
n@658 232 audioEngineContext.newTrack(trackURL);
n@658 233 // Create document objects to hold the comment boxes
n@658 234 var trackComment = document.createElement('div');
n@661 235 trackComment.className = 'comment-div';
n@658 236 // Create a string next to each comment asking for a comment
n@658 237 var trackString = document.createElement('span');
n@658 238 trackString.innerHTML = 'Comment on track '+index;
n@658 239 // Create the HTML5 comment box 'textarea'
n@658 240 var trackCommentBox = document.createElement('textarea');
n@658 241 trackCommentBox.rows = '4';
n@658 242 trackCommentBox.cols = '100';
n@658 243 trackCommentBox.name = 'trackComment'+index;
n@658 244 trackCommentBox.className = 'trackComment';
n@658 245 var br = document.createElement('br');
n@658 246 // Add to the holder.
n@658 247 trackComment.appendChild(trackString);
n@658 248 trackComment.appendChild(br);
n@658 249 trackComment.appendChild(trackCommentBox);
n@658 250 feedbackHolder.appendChild(trackComment);
n@658 251
n@658 252 // Create a slider per track
n@658 253
n@658 254 var trackSliderObj = document.createElement('div');
n@658 255 trackSliderObj.className = 'track-slider';
n@658 256 trackSliderObj.id = 'track-slider-'+index;
n@658 257 // Distribute it randomnly
n@658 258 var w = window.innerWidth - 100;
n@658 259 w = Math.random()*w;
n@658 260 trackSliderObj.style.left = Math.floor(w)+50+'px';
n@658 261 trackSliderObj.innerHTML = '<span>'+index+'</span>';
n@658 262 trackSliderObj.draggable = true;
n@658 263 trackSliderObj.ondragend = dragEnd;
n@658 264
n@658 265 // Onclick, switch playback to that track
n@658 266 trackSliderObj.onclick = function() {
n@658 267 // Get the track ID from the object ID
n@658 268 var id = Number(this.id.substr(13,2)); // Maximum theoretical tracks is 99!
n@658 269 audioEngineContext.selectedTrack(id);
n@658 270 };
n@658 271
n@658 272 canvas.appendChild(trackSliderObj);
n@658 273 });
n@663 274
n@663 275 // Now process any pre-test commands
n@663 276
n@668 277 var preTest = $(testXMLSetups[id]).find('PreTest')[0];
n@663 278 if (preTest.children.length > 0)
n@663 279 {
n@663 280 currentState = 'testRunPre-'+id;
n@663 281 preTestPopupStart(preTest);
n@663 282 showPopup();
n@663 283 } else {
n@663 284 currentState = 'testRun-'+id;
n@663 285 }
n@663 286 }
n@663 287
n@663 288 function preTestPopupStart(preTest)
n@663 289 {
n@663 290 var popupHolder = document.getElementById('popupHolder');
n@663 291 popupHolder.innerHTML = null;
n@663 292 // Parse the first box
n@663 293 var preTestOption = document.createElement('div');
n@663 294 preTestOption.id = 'preTest';
n@663 295 preTestOption.style.marginTop = '25px';
n@663 296 preTestOption.align = "center";
n@663 297 var child = preTest.children[0];
n@663 298 if (child.nodeName == 'statement')
n@663 299 {
n@663 300 preTestOption.innerHTML = '<span>'+child.innerHTML+'</span>';
n@663 301 } else if (child.nodeName == 'question')
n@663 302 {
n@663 303 var questionId = child.attributes['id'].value;
n@663 304 var textHold = document.createElement('span');
n@663 305 textHold.innerHTML = child.innerHTML;
n@663 306 textHold.id = questionId + 'response';
n@663 307 var textEnter = document.createElement('textarea');
n@663 308 preTestOption.appendChild(textHold);
n@663 309 preTestOption.appendChild(textEnter);
n@663 310 }
n@663 311 var nextButton = document.createElement('button');
n@663 312 nextButton.className = 'popupButton';
n@663 313 nextButton.value = '0';
n@663 314 nextButton.innerHTML = 'Next';
n@663 315 nextButton.onclick = popupButtonClick;
n@663 316
n@663 317 popupHolder.appendChild(preTestOption);
n@663 318 popupHolder.appendChild(nextButton);
n@658 319 }
n@658 320
n@662 321 function popupButtonClick()
n@662 322 {
n@662 323 // Global call from the 'Next' button click
n@662 324 if (currentState == 'preTest')
n@662 325 {
n@662 326 // At the start of the preTest routine!
n@663 327 var xmlTree = projectXML.find('setup');
n@663 328 var preTest = xmlTree.find('PreTest')[0];
n@663 329 this.value = preTestButtonClick(preTest,this.value);
n@663 330 } else if (currentState.substr(0,10) == 'testRunPre')
n@663 331 {
n@663 332 //Specific test pre-test
n@663 333 var testId = currentState.substr(11,currentState.length-10);
n@668 334 var preTest = $(testXMLSetups[testId]).find('PreTest')[0];
n@663 335 this.value = preTestButtonClick(preTest,this.value);
n@666 336 } else if (currentState.substr(0,11) == 'testRunPost')
n@666 337 {
n@666 338 // Specific test post-test
n@666 339 var testId = currentState.substr(12,currentState.length-11);
n@668 340 var preTest = $(testXMLSetups[testId]).find('PostTest')[0];
n@666 341 this.value = preTestButtonClick(preTest,this.value);
n@665 342 } else if (currentState == 'postTest')
n@665 343 {
n@665 344 // At the end of the test, running global post test
n@665 345 var xmlTree = projectXML.find('setup');
n@665 346 var PostTest = xmlTree.find('PostTest')[0];
n@665 347 this.value = preTestButtonClick(PostTest,this.value);
n@662 348 }
n@662 349 }
n@662 350
n@663 351 function preTestButtonClick(preTest,index)
n@658 352 {
n@658 353 // Called on click of pre-test button
n@660 354 // Need to find and parse preTest again!
n@660 355 var preTestOption = document.getElementById('preTest');
n@660 356 // Check if current state is a question!
n@662 357 if (preTest.children[index].nodeName == 'question') {
n@662 358 var questionId = preTest.children[index].attributes['id'].value;
n@660 359 var questionHold = document.createElement('comment');
n@660 360 var questionResponse = document.getElementById(questionId + 'response');
n@660 361 questionHold.id = questionId;
n@660 362 questionHold.innerHTML = questionResponse.value;
n@667 363 if (currentState == 'preTest') {
n@667 364 preTestQuestions.appendChild(questionHold);
n@667 365 } else if (currentState = 'postTest') {
n@667 366 postTestQuestions.appendChild(questionHold);
n@667 367 }
n@660 368 }
n@662 369 index++;
n@662 370 if (index < preTest.children.length)
n@660 371 {
n@660 372 // More to process
n@662 373 var child = preTest.children[index];
n@660 374 if (child.nodeName == 'statement')
n@660 375 {
n@660 376 preTestOption.innerHTML = '<span>'+child.innerHTML+'</span>';
n@660 377 } else if (child.nodeName == 'question')
n@660 378 {
n@660 379 var textHold = document.createElement('span');
n@660 380 textHold.innerHTML = child.innerHTML;
n@660 381 var textEnter = document.createElement('textarea');
n@660 382 textEnter.id = child.attributes['id'].value + 'response';
n@660 383 var br = document.createElement('br');
n@660 384 preTestOption.innerHTML = null;
n@660 385 preTestOption.appendChild(textHold);
n@660 386 preTestOption.appendChild(br);
n@660 387 preTestOption.appendChild(textEnter);
n@660 388 }
n@660 389 } else {
n@660 390 // Time to clear
n@661 391 preTestOption.innerHTML = null;
n@667 392 if (currentState != 'postTest') {
n@667 393 hidePopup();
n@667 394 // Progress the state!
n@667 395 advanceState();
n@667 396 } else {
n@667 397 a = createProjectSave(projectReturn);
n@667 398 preTestOption.appendChild(a);
n@667 399 }
n@660 400 }
n@662 401 return index;
n@660 402 }
n@660 403
n@660 404 function showPopup()
n@660 405 {
n@661 406 var popupHolder = document.getElementById('popupHolder');
n@662 407 popupHolder.style.zIndex = 3;
n@661 408 popupHolder.style.visibility = 'visible';
n@661 409 var blank = document.getElementsByClassName('testHalt')[0];
n@661 410 blank.style.zIndex = 2;
n@661 411 blank.style.visibility = 'visible';
n@660 412 }
n@660 413
n@660 414 function hidePopup()
n@660 415 {
n@661 416 var popupHolder = document.getElementById('popupHolder');
n@661 417 popupHolder.style.zIndex = -1;
n@661 418 popupHolder.style.visibility = 'hidden';
n@661 419 var blank = document.getElementsByClassName('testHalt')[0];
n@661 420 blank.style.zIndex = -2;
n@661 421 blank.style.visibility = 'hidden';
n@658 422 }
n@658 423
n@656 424 function dragEnd(ev) {
n@656 425 // Function call when a div has been dropped
n@657 426 var slider = document.getElementById('slider');
n@656 427 if (ev.x >= 50 && ev.x < window.innerWidth-50) {
n@656 428 this.style.left = (ev.x)+'px';
n@656 429 } else {
n@656 430 if (ev.x<50) {
n@656 431 this.style.left = '50px';
n@656 432 } else {
n@656 433 this.style.left = window.innerWidth-50 + 'px';
n@656 434 }
n@656 435 }
n@656 436 }
n@656 437
n@663 438 function advanceState()
n@663 439 {
n@663 440 console.log(currentState);
n@663 441 if (currentState == 'preTest')
n@663 442 {
n@663 443 // End of pre-test, begin the test
n@663 444 loadTest(0);
n@663 445 } else if (currentState.substr(0,10) == 'testRunPre')
n@663 446 {
n@663 447 // Start the test
n@663 448 var testId = currentState.substr(11,currentState.length-10);
n@663 449 currentState = 'testRun-'+testId;
n@666 450 } else if (currentState.substr(0,11) == 'testRunPost')
n@666 451 {
n@668 452 var testId = currentState.substr(12,currentState.length-11);
n@666 453 testEnded(testId);
n@664 454 } else if (currentState.substr(0,7) == 'testRun')
n@664 455 {
n@664 456 var testId = currentState.substr(8,currentState.length-7);
n@664 457 // Check if we have any post tests to perform
n@668 458 var postXML = $(testXMLSetups[testId]).find('PostTest')[0];
n@664 459 if (postXML.children.length > 0)
n@664 460 {
n@666 461 currentState = 'testRunPost-'+testId;
n@666 462 showPopup();
n@666 463 preTestPopupStart(postXML);
n@664 464 }
n@666 465 else {
n@664 466
n@664 467
n@666 468 // No post tests, check if we have another test to perform instead
n@666 469 testEnded(testId);
n@664 470 }
n@663 471 }
n@663 472 console.log(currentState);
n@663 473 }
n@663 474
n@666 475 function testEnded(testId)
n@666 476 {
n@669 477 pageXMLSave(testId);
n@666 478 if (testXMLSetups.length-1 > testId)
n@666 479 {
n@666 480 // Yes we have another test to perform
n@668 481 testId = (Number(testId)+1);
n@668 482 currentState = 'testRun-'+testId;
n@668 483 loadTest(testId);
n@666 484 } else {
n@666 485 console.log('Testing Completed!');
n@666 486 currentState = 'postTest';
n@666 487 // Check for any post tests
n@666 488 var xmlSetup = projectXML.find('setup');
n@666 489 var postTest = xmlSetup.find('PostTest')[0];
n@666 490 showPopup();
n@666 491 preTestPopupStart(postTest);
n@666 492 }
n@666 493 }
n@666 494
n@664 495 function buttonSubmitClick()
n@664 496 {
n@664 497 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options
n@664 498 if (currentState.substr(0,7) == 'testRun')
n@664 499 {
n@664 500 advanceState();
n@664 501 }
n@664 502 }
n@664 503
n@668 504 function pageXMLSave(testId)
n@668 505 {
n@668 506 // Saves a specific test page
n@668 507 var xmlDoc = document.createElement("AudioHolder");
n@668 508 var testXML = testXMLSetups[testId];
n@668 509 xmlDoc.id = testXML.id;
n@668 510 xmlDoc.repeatCount = testXML.attributes['repeatCount'].value;
n@669 511 var trackSliderObjects = document.getElementsByClassName('track-slider');
n@669 512 var commentObjects = document.getElementsByClassName('comment-div');
n@669 513 var rateMin = 50;
n@669 514 var rateMax = window.innerWidth-50;
n@669 515 for (var i=0; i<trackSliderObjects.length; i++)
n@669 516 {
n@669 517 var audioElement = document.createElement('audioElement');
n@669 518 audioElement.id = currentTrackOrder[i].attributes['id'].value;
n@669 519 audioElement.url = currentTrackOrder[i].attributes['url'].value;
n@669 520 var value = document.createElement("value");
n@669 521 var rate = Number(trackSliderObjects[i].style.left.substr(0,trackSliderObjects[i].style.left.length-2));
n@669 522 rate = (rate-rateMin)/rateMax;
n@669 523 value.innerHTML = Math.floor(rate*100);
n@669 524 var comment = document.createElement("comment");
n@669 525 var question = document.createElement("question");
n@669 526 var response = document.createElement("response");
n@669 527 question.textContent = commentObjects[i].children[0].textContent;
n@669 528 response.textContent = commentObjects[i].children[2].value;
n@669 529 comment.appendChild(question);
n@669 530 comment.appendChild(response);
n@669 531 audioElement.appendChild(value);
n@669 532 audioElement.appendChild(comment);
n@669 533 xmlDoc.appendChild(audioElement);
n@669 534 }
n@669 535 testResultsHolders[testId] = xmlDoc;
n@668 536 }
n@668 537
n@656 538 // Only other global function which must be defined in the interface class. Determines how to create the XML document.
n@656 539 function interfaceXMLSave(){
n@656 540 // Create the XML string to be exported with results
n@656 541 var xmlDoc = document.createElement("BrowserEvaluationResult");
n@669 542 for (var i=0; i<testResultsHolders.length; i++)
n@656 543 {
n@669 544 xmlDoc.appendChild(testResultsHolders[i]);
n@656 545 }
n@656 546 // Append Pre/Post Questions
n@656 547 xmlDoc.appendChild(preTestQuestions);
n@656 548 xmlDoc.appendChild(postTestQuestions);
n@656 549
n@656 550 return xmlDoc;
n@656 551 }
n@656 552