previous next

Syntax Rules

RealSystem G2 mark-up languages are based on Extensible Mark-up Language (XML), which is similar to Hypertext Mark-up Language (HTML), but is more structured. As a result, many practices acceptable when writing HTML, such as using any case for tags (<B> or <b>, for example), are not acceptable when writing RealSystem mark-up. The following sections describes these differences in detail.

Three Basic Elements for Mark-up Tags

There are three basic elements to RealSystem G2 mark-up tags:

  1. tag names

  2. attributes

  3. attribute values

For example, here's a RealText tag with one attribute and value:


<font color="blue">

Every tag starts with a left angle bracket and ends with a right angle bracket. The tag name, font in the example above, immediately follows the left angle bracket. This tag has one attribute, color. Each attribute takes one value, which is "blue" here. Some tags do not have any attributes, such as the RealText <b> tag, which turns on bolding. But many tags accept multiple attributes, as demonstrated here:


<font color="blue" size="+2" face="Arial" charset="us-ascii">

Some Tags have End Tags

There are two classes of tags: those that use a corresponding end tag and those that do not. For example, the tag that indicates the start of SMIL mark-up, <smil>, has a corresponding end tag, </smil>, that indicates the close of SMIL mark-up. These are similar to the <HTML> and </HTML> tags that enclose HTML mark-up.

When a tag includes attributes, such as the following:


<font color="blue" size="+2" face="Arial" charset="us-ascii">

its end tag uses just the tag name and never includes attributes:


</font>

Note that how you nest tags, which attributes you include, and where you place end tags affects the outcome. Compare the following RealText samples (bolding used for emphasis only) and the illustrations of how this mark-up affects the text when the clip plays in RealPlayer:


Start with normal text.
<font color="red">Make text red.
<font size="+1">Make red text one size larger.
</font>Turn off larger size for red text.
</font>Turn off color.

Start with normal text.
Make text red.
Make red text one size larger.
Turn off larger size for red text.
Turn off color.

Start with normal text.
<font color="red">Make text red.
</font>Turn off color.
<font size="+1">Make text one size larger.
</font>Turn off larger size.

Start with normal text.
Make text red.
Turn off color.
Make text one size larger.
Turn off larger size.

Start with normal text.
<font color="red" size="+2">Make text red and two sizes larger.
<font color="blue" size="+1">Make text blue and one size smaller.
</font></font><font size="+1">Turn off color but keep text the same size.
</font>Reduce text to normal.

Start with normal text.
Make text red and two sizes larger.
Make text blue and one size smaller.
Turn off color but keep text the same size.
Reduce text to normal.

All Other Tags Close with a Forward Slash

If a tag does not use a corresponding end tag, it must close with a forward slash ("/"). The closing forward slash is an crucial departure from HTML. Here's a sample SMIL tag:


<audio src="first.rm"/>

Warning
RealPlayer will not play the presentation if you omit a closing forward slash from a tag that requires it.

Lowercase Text Used for Tags and Attributes

Tags and attributes must be lowercase, as illustrated in this RealPix example:


<fadein start="4" duration="3" target="2"/>

You cannot use uppercase or mixed case for tags and attributes. The following example, which mixes cases, will not play in RealPlayer:


<FADEIN Start="4" duration="3" TARGET="2"/>

Attribute values are typically lowercase, but can be uppercase or mixed case as well. Uppercase or mixed case attribute values may be required with file names:


<audio src="FIRST.RM"/>

In RealSystem G2 mark-up, the file specified in the attribute value must match the file's name exactly. The tag above would not work if the file on the operating system is actually First.rm. Also note that file names cannot contain spaces.

Tip
It's good practice always to use lowercase file names, such as first.rm. This makes it easier to write RealSystem mark-up and to host files on servers.

Attribute Values Enclosed in Double Quotation Marks

Attribute values must be enclosed in double quotation marks, as illustrated in this RealText example:


<time begin="23" end="55.5"/>

Again, this is an important difference from HTML, in which quotation marks for attribute values are often optional. If you leave quotation marks out, as in this next example, the presentation will not play in RealPlayer:


<time begin=23 end=55.5/>

SMIL Body Section Required

A SMIL file can include an optional header section defined by <head> and </head> tags. It requires a body section defined by <body> and </body> tags:


<smil>
<head>
...optional section with all header mark-up...
</head>
<body>
...required section with all body mark-up...
</body>
</smil>

The optional header section is used to specify presentation information and to define clip layout.

HTML-Style Comments Allowed

As in HTML, RealSystem G2 mark-up can include comment tags that start with <!-- and end with -->. Unlike all other RealSystem G2 mark-up tags, the comment tag does not close with a forward slash:


<!-- This is a comment -->


Copyright © 1998 RealNetworks
For information on RealNetworks' technical support, click here.
This file last updated on 12/13/99 at 12:09:43.
previous next