#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    48
    Rep Power
    13

    Error in WML code


    Wow, not too much traffic in this forum... I still hope that someone can help me.

    I run a php-script that produces a wml output but unfortunately not with the desired content. here is my code:
    PHP Code:
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    <wml>
        <card id='card1' title='Shopping'>
            <p>
            <do type='accept'> 
                <go href='wap.php' method='post'>
                    <postfield name='items' value='$Items'/>
                </go>
            </do>
            Shoppinglist:<br/>
            <select name='Items' multiple='true'>
                <option value='6'>Milk</option><br/>
                <option value='7'>Thuna fish</option><br/>
                <option value='8'>Salad</option><br/>
                <option value='9'>Meat (lots of!)</option><br/>
            </select>
            </p>
        </card>
    </wml>
    The wml-validator provided by w3schools.org reports an error in the line with the first option-tag. It says: "Element content invalid according to the DTD/scheme".

    can anyone see the mistake I made?

    cheers
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Posts
    4
    Rep Power
    0
    what is your apache config (httpd.conf)?
    is it only :

    AddType text/vnd.wap.wml .wml
    AddType application/vnd.wap.wmlc .wmlc
    AddType text/vnd.wap.wmlscript .wmls
    AddType application/vnd.wap.wmlscriptc .wmlsc
    AddType image/vnd.wap.wbmp .wbmp

    or you configure it with php :

    AddType application/x-httpd-php .php3 .php .phtml .wml

    ?

    if you choose the first one, i think it would work well according to your script. But if fail, I suggest you choose the 2nd choice and give this extra syntax into your first line of the script.

    <?
    Header("Content-type: text/vnd.wap.wml");
    ?>

    PS. sorry for my bad english
    i hope you understand.
  4. #3
  5. No Profile Picture
    peterg
    Guest
    Devshed Newbie (0 - 499 posts)
    Heyup ! I tried this out on my system, and used the PyWeb emulator to check it. It objected to the <br/> at the end of each option line. The other thing I had problems with was the header, and this has been the case for quite a while now. It seems to be very picky about format and spacing, so in the end I constructed a PHP header which I know include in all my WAP/WML pages. Also, i don't know if it's significant, but I changed single quotes to double quotes.

    The code below shows the final result, which seems to work.

    Code:
    <?php 
    header("Content-type: text/vnd.wap.wml"); 
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" 
       . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; 
    ?>
    <wml>
        <card id="card1" title="Shopping">
            <p>
            <do type="accept"> 
                <go href="wap.php" method="post">
                    <postfield name="items" value="$Items"/>
                </go>
            </do>
            Shoppinglist:<br/>
            <select name="Items" multiple="true">
                <option value="5">Veg</option>
                <option value="6">Milk</option>
                <option value="7">Thuna fish</option>
                <option value="8">Salad</option>
                <option value="9">Meat (lots of!)</option>
            </select>
            </p>
        </card>
    </wml>
    inijoey was right about the WML Apache config - mine looks like this..

    Code:
    AddType application/x-httpd-php .php .php3 .php4 .htm .html .wml
    AddType text/vnd.wap.wmlscript .wmls
    AddType image/vnd.wap.wbmp .wbmp
    Hope this helps..

    PS .. I added a veg option as number 5 ..

IMN logo majestic logo threadwatch logo seochat tools logo