An alternative way of thinking about these extra slashes is to think in terms of elements.[5] An element takes one of two forms: either a start-tag and an end-tag (whose types must match):
<tag> . . . </tag>
or a single empty-element tag (complete with extra slash):
<tag/>
Note that there is exactly one slash per element.
An element can contain other elements (either matched pairs or
empty-element tags), possibly mixed up with flow text. Looking at
Example 1.2 this way, there is a single
<wml>
element (as a matched pair
<wml>
</wml>
),
containing a single <card>
element (as a
matched pair <card>
</card>
), containing a single
<p>
element (also as a matched pair,
<p>
</p>
), which in
turn contains a single <img>
element (as the
empty-element tag <img/>
).
It’s important to ensure the tags match properly. Mismatching tags such as:
<x>...<y>...</x>...</y>
is an error and will prevent the page from being displayed. This should have been written as:
<x>...<y>...</y>...</x>
Get Learning WML, and WMLScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.