This will probably be a good start for anyone else trying to do this.
It will only work in HTML5 output for me, and as another user has mentioned, you can't set t/f variables properly in HTML5, which is a pain. So I'm using 0/1.
var player = GetPlayer(); var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false"; xmlDoc.load("checklist.xml"); xmlObj=xmlDoc.documentElement; var tag = xmlDoc.getElementsByTagName("PART")[0].attributes.getNamedItem("Checked").value;
for (var t = 0; t < parts.length; t++) { player.SetVar(someVar, parts[0].attributes.getNamedItem("Tag").value);
}
That will set someVar to the value of the first parts Tag value.
So looking at my XML, someVar would equal Lights.
-----
You can put the XML file anywhere, you just need to specify the address, somewhere online or within the folder structure, within the xmldoc.load function.
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();
xmlhttp.open("GET","SAG.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
/* 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. */
<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>
BSB07
BSBWHS201A
<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.
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.
Ok - I get how this works with the XML but I am missing a basic piece of knoweldge to call that file up that I am hoping somebody can help me with.
I was able to get it to work on ONLY FF from my desktop. Not chome, not IE. Then, I loaded it up to a server. XML doesn't appear on any browser so this tells me I have done something wrong or need to reference it somewhere.
I think what I am missing is in here. Do I need to add the file location on the server in one of these commands somewhere? If so, where do I do that? If someone can show me what i'm doing wrong, I think I can really use this. Thanks!
/* 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 */
This is not something supported by Articulate. Hopefully someone will be able to chime in and assist you here. Looks like Graeme solution helped the other users here, but I doubt he's subscribed 3 years later, even though I am :)
Hi I am new to strotyline. I saw this post and i am trying to pull data from xml (for the transcript )into storyline text. Can anyone tell me where to keep .xml file in the folder structure?
Also it would be very helpful if some one provide me the working file if anyone has tried it before.
Are you looking to use the translation feature of Storyline? That would allow you to export text that you currently have, and modify it to import in a new copy using the updated XML file.
As Leslie mentioned earlier, the other method is not something we could support.
The reply from Graeme above is a bit dated and I'm not sure that the user is still subscribed to the forums here. You are certainly welcome to reach out to the user directly via the 'Contact Me' option on the user profile if you do not hear back soon.
Hi I am new to strotyline. I saw this post and i am trying to pull data from xml (for the transcript )into storyline text. Can anyone tell me where to keep .xml file in the folder structure?
Also it would be very helpful if some one provide me the working file if anyone has tried it before.
I have the same problem. I can't find where to upload the xml file in file structure...
28 Replies
Hey Bort, welcome to the forums!
There isn't anything built into Storyline that let's you do this currently, but if you find a way, you'd be a very popular person around here
You may want to request it as a future feature...
Thanks, and welcome again!
This will probably be a good start for anyone else trying to do this.
It will only work in HTML5 output for me, and as another user has mentioned, you can't set t/f variables properly in HTML5, which is a pain. So I'm using 0/1.
var player = GetPlayer();
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("checklist.xml");
xmlObj=xmlDoc.documentElement;
var tag = xmlDoc.getElementsByTagName("PART")[0].attributes.getNamedItem("Checked").value;
if(tag === "True")
{
player.SetVar("variable", 1);
}
else
{
player.SetVar("variable", 0);
}
It's working for what I need it to do, and hopefully will help others.
edit: Here's an example of the XML to help anyone trying to work this out
<THING>
<PART Checked="True" />
<PART Checked="False" />
<PART Checked="True" />
</THING>
Awesome!
Thanks so much for sharing that. I'm sure others will find it helpful
Has anyone got Bort Bort's setup to work?
I get no results from this in my story, or in Firebug console logs.
Disregard... i created a Number variable named "variable" to display it and it works fine.
Here is what I sent to Dennis. May help others.
Here's the current js that I have on the slide that I want to show the results on. It runs on timeline start:
var player = GetPlayer();
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("checklist.xml");
xmlObj=xmlDoc.documentElement;
var parts = xmlDoc.getElementsByTagName("PART");
for (var t = 0; t < parts.length; t++)
{
if (parts[t].attributes.getNamedItem("Checked").value == "True")
{
player.SetVar(parts[t].attributes.getNamedItem("Tag").value, 1);
}
else
{
player.SetVar(parts[t].attributes.getNamedItem("Tag").value, 0);
}
}
Here's an example of the XML file contents:
<PARTS
<PART Tag="Lights" Checked="False" /
<PART Tag="Wheels" Checked="False" /
<PART Tag="Boot" Checked="False" /
</PARTS
(I had to remove the closing tags in the XML as it wouldn't display)
Then on some graphics on the page, I have it working like this:
Change state of [graphic] to state [off] when [timeline starts] when [boot == 0.00]
or
Change state of [graphic] to state [on] when [timeline starts] when [boot == 1.00]
You can also just output the variables to a textbox like you have tried. You just need to make sure that you specify that in the javascript.
-----------------------
This may be more along the lines of what you need:
var player = GetPlayer();
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("checklist.xml");
xmlObj=xmlDoc.documentElement;
var parts = xmlDoc.getElementsByTagName("PART");
for (var t = 0; t < parts.length; t++)
{
player.SetVar(someVar, parts[0].attributes.getNamedItem("Tag").value);
}
That will set someVar to the value of the first parts Tag value.
So looking at my XML, someVar would equal Lights.
-----
You can put the XML file anywhere, you just need to specify the address, somewhere online or within the folder structure, within the xmldoc.load function.
Hi all
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();
xmlhttp.open("GET","SAG.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
/* 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. */
package0=xmlDoc.getElementsByTagName("package")[0].childNodes[0].nodeValue;
var n=package0.replace(/</g,"
var x=n.replace(/>/g,">");
var y=x.replace(/./g,"/");
player.SetVar("Package1",y);
package1=xmlDoc.getElementsByTagName("package")[1].childNodes[0].nodeValue;
var n=package1.replace(/</g,"
var x=n.replace(/>/g,">");
var y=x.replace(///g,"/");
player.SetVar("Package2",y);
comp0=xmlDoc.getElementsByTagName("comp")[0].childNodes[0].nodeValue;
var n=comp0.replace(/</g,"
var x=n.replace(/>/g,">");
var y=x.replace(///g,"/");
player.SetVar("Competency1",y);
comp1=xmlDoc.getElementsByTagName("comp")[1].childNodes[0].nodeValue;
var n=comp1.replace(/</g,"
var x=n.replace(/>/g,">");
var y=x.replace(///g,"/");
player.SetVar("Competency2",y);
name0=xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue;
var n=name0.replace(/</g,"
var x=n.replace(/>/g,">");
var y=x.replace(///g,"/");
player.SetVar("CompName1",y);
name1=xmlDoc.getElementsByTagName("title")[1].childNodes[0].nodeValue;
var n=name1.replace(/</g,"
var x=n.replace(/>/g,">");
var y=x.replace(///g,"/");
player.SetVar("CompName2",y);
desc0=xmlDoc.getElementsByTagName("description")[0].childNodes[0].nodeValue;
var n=desc0.replace(/</g,"
var x=n.replace(/>/g,">");
var y=x.replace(///g,"/");
player.SetVar("CompDescription1",y);
desc1=xmlDoc.getElementsByTagName("description")[1].childNodes[0].nodeValue;
var n=desc1.replace(/</g,"
var x=n.replace(/>/g,">");
var y=x.replace(///g,"/");
player.SetVar("CompDescription2",y);
And here is a copy of my XML file:
UEE11
UEENEEE107A
<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>
BSB07
BSBWHS201A
<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.
And here is a copy of the storyline test file for the above;
Hope this helps all those wishing to use XML
Hi Graeme! Thanks for sharing your solution
Great post!
I tried the example files above and they did not work. Anyone else find a solution that is similar to this?
Hi Diana!
This thread is a bit dated. Do you mean that the files would not work for you, or the solution does not work?
If it's the files, I'm re-attaching here in case this assists. If the latter, hopefully someone in the community will be able to chime in and assist.
It works fine on safari and firefox
but Internet explorer and google chrome it does not load data from xml in these browsers
Hi Tamer!
In Graeme's post above he states:
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.
Thank you Leslie McKerchie
it works
Glad to hear it Tamer. Thanks for popping back in with an update.
Ok - I get how this works with the XML but I am missing a basic piece of knoweldge to call that file up that I am hoping somebody can help me with.
I was able to get it to work on ONLY FF from my desktop. Not chome, not IE. Then, I loaded it up to a server. XML doesn't appear on any browser so this tells me I have done something wrong or need to reference it somewhere.
I think what I am missing is in here. Do I need to add the file location on the server in one of these commands somewhere? If so, where do I do that? If someone can show me what i'm doing wrong, I think I can really use this. Thanks!
Hi Alsion!
This is not something supported by Articulate. Hopefully someone will be able to chime in and assist you here. Looks like Graeme solution helped the other users here, but I doubt he's subscribed 3 years later, even though I am :)
Hi I am new to strotyline. I saw this post and i am trying to pull data from xml (for the transcript )into storyline text. Can anyone tell me where to keep .xml file in the folder structure?
Also it would be very helpful if some one provide me the working file if anyone has tried it before.
Hi Pratik,
Are you looking to use the translation feature of Storyline? That would allow you to export text that you currently have, and modify it to import in a new copy using the updated XML file.
As Leslie mentioned earlier, the other method is not something we could support.
Let me know if you need anything else!
Hi Graeme, Can we update the transcript dynamically through xml using this technique? If yes please let me know how.
Hello Pratik!
The reply from Graeme above is a bit dated and I'm not sure that the user is still subscribed to the forums here. You are certainly welcome to reach out to the user directly via the 'Contact Me' option on the user profile if you do not hear back soon.
Hi,
I want to make menu that read data from xml file.
help please
Hi Saied,
I'll leave that to the community as there isn't a feature in Storyline to do so and it's not something I can help with!
Best of luck with your project.
I have the same problem. I can't find where to upload the xml file in file structure...
This discussion is closed. You can start a new discussion or contact Articulate Support.