Story Line and XML

Jul 18, 2013

Hi ,

complete newbie here and I am trying to evaluate Storyline to see if I can use it to develop some courses. One aspect I would like to look at is the use of XML data to populate text boxes as a way of easily changing the content. Another useful feature would be the ability to link pictures frm an XML file with text content to a scene.

Is any of this possible using storyline?

If so any tutorials available om how it can be done.



6 Replies
Leslie McKerchie

Hi Mike and Welcome to E-Learning Heroes! There is nothing currently built into Storyline that allows you to do this. It would make a great feature request.  I will point you to this thread that has a solution from a community member that may or may not be what you are looking for, but it is worth a shot.  Thanks and have a great day!

Graeme  Nicholls

Hi Mike

I have been working on this for some time and I have manage to get some pretty good results. In most browsers you will not be able to see the xml unless you have loaded it to a server somewhere (preferably the same one where the interaction is. Here is a copy of my javascript.

 Declare the XML node variables globally,

declare the player, xmlDoc and the xmlhttp globally 

var comp0="";

var comp1="";

var name0="";

var name1="";

var desc0="";

var desc1="";

var package0="";

var package1="";

var player=GetPlayer();

var xmlDoc="";

var xmlhttp="";

/* Request the xml doc from the server using the get method, file name and set asychronous to false.

Send the request and assign the resonse to the xmlDoc */

xmlhttp=new XMLHttpRequest();"GET","SAG.xml",false);



/* select the first package node and scan it for < and replace it with and scan for / and replace it with /

This is done for each node retrieved. The final value is assigned to a variable pre-defined in the player.

The find and replace is done so that some formatting can be retrieved from the xml document since XSL/XSLT and CSS can't be used for formatting. */


var n=package0.replace(/</g,"

var x=n.replace(/>/g,">");

var y=x.replace(/./g,"/");



var n=package1.replace(/</g,"

var x=n.replace(/>/g,">");

var y=x.replace(///g,"/");



var n=comp0.replace(/</g,"

var x=n.replace(/>/g,">");

var y=x.replace(///g,"/");



var n=comp1.replace(/</g,"

var x=n.replace(/>/g,">");

var y=x.replace(///g,"/");



var n=name0.replace(/</g,"

var x=n.replace(/>/g,">");

var y=x.replace(///g,"/");



var n=name1.replace(/</g,"

var x=n.replace(/>/g,">");

var y=x.replace(///g,"/");



var n=desc0.replace(/</g,"

var x=n.replace(/>/g,">");

var y=x.replace(///g,"/");



var n=desc1.replace(/</g,"

var x=n.replace(/>/g,">");

var y=x.replace(///g,"/");


And attached is a copy of my XML file:



<b>Use Drawings, Schedules and Diagrams tested </b>

This unit covers the use of drawings, diagrams, cable schedules, standards, codes and specifications as they apply to the various electrotechnology work functions.<br />It encompasses:<br/>

<ul><li>the rudiments for communicating with schematic wiring and mechanical diagrams and equipment and cable/connection schedules manuals</li>

<li>site and architectural drawings and plans showing the location of services, apparatus, plant and machinery</li>

<li>understanding the use and format of compliance standards and job specifications.</li></ul>



<b>Contribute to health and safety of self and others (Release 1)</b>

This unit describes the performance outcomes, skills and knowledge required to participate in work health and safety (WHS) processes to protect own health and safety, and that of others.

Graeme  Nicholls

And here is a copy of the storyline file I used to test this in.

I threw the progress meter on the first slide just to make sure that the javascript had completed and all variables assigned before we started to use them in pages. One little querk I have noticed is that strange font sizes occur if you use auto size on the text box the xml is going into. Fix the size of the box and everything is fine.

XML is not suppose to have formatting as this is supposed to be done by XSL / XSLT  or XSL-FO documents attached to the xml file. Since these dont seem to want to do their job here (cause we are loading directly to a variable) I have simply used the escaped characters for the ", ">" (>), "/" (/). where I have needed to format things in the XML file. I have then pulled that data into a javascript variable and used the replace command to look for the escaped characters and replace them with the normal symbol. This puts back the normal html formatting. From experience I suggest you take a look at what is not in HTML-5 and steer clear of using those formatting commands. Things like

and the like cause things to go strange, specially in the HTML-5 output.

This has been a really useful for us as we need to produces templates then update the data for hundreds of different courses.

PS if there are winking smilly faces in the code it means I have used a semi colon ; and then a close bracket  )

This discussion is closed. You can start a new discussion or contact Articulate Support.