Working With XML

Tag Structure
Special Characters
Comments
Meta Tagging

Tag Structure

All rules governing well-formed XML apply to the scripting of Interactive XML applications. These won't be detailed here, but following are some useful tips relating to tag structure:

  1. Every opened tag must have a corresponding closing tag. For example:

            <a_tag>some_text</a_tag>

or

            <a_tag name="some_text"/>

  1. Tags must be opened and closed at the same level. For example:

Incorect:

            <tag1>
                        <tag2>some_text</tag1>
            </tag2>

Correct:

            <tag1>
                        <tag2>some_text</tag2>
            </tag1>

  1. The correct hierarchy of tags as described in this documentation must be respected. For example:

Incorrect:

<media>
                        <medias>
                                    <file>a_file.mp4</file>
                        </medias>
</media>

Correct:

<medias>
                        <media>
                                    <file>a_file.mp4</file>
                        </media>
</medias>

This is referred to in the Interactive XML Glossary later in this document as the parent-child relationship.

Note that you will NOT get an XML error when you debug the above incorrect code in a browser. However, the file specified in <file> will never be called.

Special Characters

In order to make certain characters function or display properly, they must be written as follows:
Quotation mark (") &quot;
Apostrophe (') &apos;
Ampersand (&) &amp;
Percent (%) &percnt;
Less than (<) &lt;
Greater than (>) &gt;
Dash (–) &#8211;
Line breaks in any output text must be written as follows: &#xD;

Comments

Comments begin with:

<!--

and end with: 

-->

For example:

<!-- this is where the user is asked for their email address -->

or

            <!--<tag1>
                        <tag2>xyz</tag2>
            </tag1>-->

In the second case, the code within the comment will not be executed.

Note that two hyphens in a row (--) may ONLY be used to denote comments.

Meta Tagging

XML tags other than those recognized by Interactive XML may be incorporated into an Interactive XML application for some other purpose (Interactive XML will simply ignore such tags). For example, you may want to use meta tags so that web crawlers can index your application. Put your meta tags in the <settings> section of your application:

<settings>
            <meta name="author" content="John Doe"/>
            <meta name="description" content="Interactive XML"/>
            <meta name="keywords" content="XML, videos, interactive video..."/>
            ...
</settings>