![]() |
Previous | Next |
The instructions in the skin definition file are written in XML, the eXtensible Markup Language that is an extension to HTML. If you have used HTML to create Web pages, you will find that XML looks very familiar. The XML in the skin definition file uses a set of special element tags to define parts of the skin user interface. For example, the <BUTTON> tag defines how a button will behave, where it will go, and what it will look like.
Each element tag has specific attributes. For example, the BUTTON element has an Image attribute that defines where the picture of the button can be found. This is similar to HTML, where the BODY element will have a BgColor attribute which defines the background color of the body of the HTML page. You can also think of attributes as similar to methods and properties of objects in Microsoft JScript® or other object-based languages. Detailed information about all skin elements and their attributes is included in the Skin Programming Reference section.
XML has a few simple rules that you need to know to create skins. Unlike HTML, XML requires you to follow the rules exactly.
All elements are enclosed by angle brackets; for example, the Button element is typed
<BUTTON>
You do not need to type the word "Button" in all uppercase, but the convention of typing element names in all uppercase is used in the example code of this SDK.
All attributes for a particular element must be included before the closing angle bracket. An attribute consists of the attribute name followed by an equal sign (=) and the value of the attribute in quotes. For example,
<BUTTON image="mysong.wma">
You do not need to type the word "image" in lowercase, but the convention of typing attribute names in lowercase is used in the example code of this SDK. Also note that the value of the attribute is enclosed in quotation marks.
Some elements are grouped together inside another element. For example, the BUTTONGROUP element does not make a lot of sense unless you use one or more BUTTONELEMENT elements with it. To make the grouping clear, you need to have an opening and closing tag for each element. The opening tag is just the element name and any related attributes, surrounded by angle brackets. The closing tag is the element name, preceded by a forward slash, (/) and then enclosed by angle brackets. For example, the BUTTONGROUP element opening tag is:
<BUTTONGROUP>
and the closing tag is:
</BUTTONGROUP>
You would put the BUTTONELEMENT tags between the opening and closing BUTTONGROUP element tags. For example:
<BUTTONGROUP>
<BUTTONELEMENT/>
<BUTTONELEMENT/>
<BUTTONELEMENT/>
</BUTTONGROUP>
If an element has no other elements inside it, you must put a forward slash at the end of the element name just before the closing angle bracket. For example, in the code above, each BUTTONELEMENT element has a forward slash to indicate that there are no other elements nested within it.
In other words, you must either have a closing element tag or close off your element with a forward slash.
This is correct:
<BUTTONGROUP>
<BUTTONELEMENT/>
<BUTTONELEMENT/>
</BUTTONGROUP>
This is not:
<BUTTONGROUP/>
<BUTTONELEMENT/>
<BUTTONELEMENT/>
</BUTTONGROUP>
This is also incorrect:
<BUTTONGROUP>
<BUTTONELEMENT>
<BUTTONELEMENT>
</BUTTONGROUP>
because the BUTTONELEMENT tags are not closed off.
Previous | Next |