Scripting Your .xml File

Following is an overview to help you grasp the basics of scripting your Interactive XML application. For more details about functionality and syntax, please consult the Glossary of Interactive XML Tags later in this document.

Document

At the highest level, your .xml file must be enclosed within <document> tags. At the next level, Interactive XML is structured to accommodate one <settings> tag and any number of <node name=””> tags.

Settings

As the name suggests, <settings> is where you can establish default behavior for much of your application, such as the position of videos on the screen, the file path for media, and the presence of mute or pause buttons. You can also define templates of clickable buttons so they do not have to be redefined in multiple places.

See the <settings> definition in the glossary for more information.

Nodes

Nodes, represented by <node> tags, are the “steps” through which an Interactive XML application progresses. The topmost node defined in the script is the node through which the user enters the application and can be considered the starting point of the interaction. For the interaction to continue, each node must lead to another node. If a node does not lead to another node, the interaction will end there and such a node (or nodes) can be considered the ending point of the interaction.

Here is a simple example of how a series of nodes might define an interactive experience:

<node name="hello">
     <medias>
          <media>
               <file>hello.mp4</file>
          </media>
     </medias>
     <media_end node="how_are_you"/>
</node>
<node name="how_are_you">
     <medias>
          <media>
               <file>how_are_you.mp4</file>
               <custom_event>3</custom_event>
          </media>
          <media>
               <file>waiting_for_answer.mp4</file>
          </media>
     </medias>
     <media_custom_event node="how_are_you_buttons"/>
</node>
<node name="how_are_you_buttons">
     <buttons>
          <button>
               <text>Good</text>
               <next_node>user_good</next_node>
          </button>
          <button>
               <text>Bad</text>
               <next_node>user_bad</next_node>
          </button>
     </buttons>
</node>
<node name="user_good">
     <medias>
          <media>
               <file>im_glad_youre_good.mp4</file>
          </media>
     </medias>
     <media_end node="goodbye"/>
</node>
<node name="user_bad">
     <medias>
          <media>
               <file>im_sorry_youre_bad.mp4</file>
          </media>
     </medias>
     <media_end node="goodbye"/>
<node name="goodbye">
     <medias>
          <media>
               <file>goodbye.mp4</file>
          </media>
     </medias>
</node>

In the above interaction, here’s what the user would experience:

1. A video (hello.mp4) in which the host of the interaction says hello (hello node).

2. A video (how_are_you.mp4) in which the host asks, “How are you?” (how_are_you node).

3. Three seconds after the “How are you?” video starts, “Good” and “Bad” buttons will appear on the screen (how_are_you_answer node). The media defined in the previous node plays in succession, so the user will see a video of the host waiting for an answer (waiting_for_answer.mp4).

4. If the user clicks “Good,” they will go to the user_good node and see a video of the host acknowledging that the user feels good (user_good.mp4).

5. If the user clicks “Bad,” they will go to the user_bad node and see a video of the host acknowledging that the user feels bad (user_good.mp4).

6. At the conclusion of the user_good.mp4 or user_bad.mp4 videos, the interaction advances directly to the goodbye node, in which the host says goodbye.

Here are some important things to keep in mind regarding nodes:

1. A node can determine which node to proceed to depending on user behavior or other conditions, such as a button click or the time elapsed from the beginning of a video.

2. A node does not have to actually include any user interaction. A node may simply increment a counter, evaluate the result of a web service call, or perform any number of actions that are “invisible” to the user.

3. Unlike many scripting languages, nodes in Interactive XML can be recursive. In other words, Node A can lead to Node B and Node B can lead back to Node A.

4. Other than the topmost node being the first node, nodes are not hierarchical. They can lead arbitrarily to any other node anywhere in the script.

%d bloggers like this: