I am trying to run this WML example on variables which I found in my WML textbook but it is giving me an error every time on the same line/statement. This is the code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card id="card1" title="First Card" newcontext="true">
<p>
Card 1... <br/>
card1 var1=$(card1_var1) <br/>
card2 var1=$(card2_var1) <br/>
card3 var1=$(card3_var1) <br/>
<do type="accept" label="Next Card">
<go href="#card2">
<setvar name="card1_var1" value="val_1"/>
</go>
</do>
</p>
</card>
<card id="card2" title="Second Card">
<p>
Card2 ...<br/>
Card1 var1 = $(card1_var1) <br/>
Card2 var1 = $(card2_var1) <br/>
Card3 var1 = $(card3_var1) <br/>
<do type="accept" label="First Card">
<go href="#card1"/>
</do>
<do type="accept" label="Third Card">
<go href="#card3">
<setvar name="card2_var1" value="val_2"/>
</go>
</do>
<do type="prev" label="Previous Card">
<prev/>
</do>
</p>
</card>
<card id="card3" title="Third Card">
<onevent type="onenterforward">
<refresh>
<setvar name="card3_var1 " value="val_3"/>
</refresh>
</onevent>
<p>
Card 3 ...<br/>
Card1 var1 = $(card1_var1) <br/>
Card2 var1 = $(card2_var1) <br/>
Card3 var1 = $(card3_var1) <br/>
<do type="prev" label="Previous">
<prev/>
</do>
</p>
</card>
I am getting error at line 26. Even thought the type is defined over there, it still gives the error.
The example you posted has a few errors that cause it to fail validation. These could just be cut-and-paste issues when posting to StackOverflow, or real errors that might have caused a parser to fail.
Line 1: The XML declaration
<?xml version="1.0"?>
should be in the first column; in your example it is indented.Line 53: The closing WML tag
</wml>
is missing.There are also two minor fixes that may be helpful:
Line 1: Add an encoding to the XML declaration e.g.
<?xml version="1.0" encoding="UTF-8"?>
Line 40: There is an errant space character in
name="card3_var1 "
so the variable does not get updated correctlyWith those corrections in place your WML validates according to the W3C Validator, so it should be fine. I tried it in an Openwave 6.2.2 SDK and it seems to work without any errors.
Corrected example: