views:

48

answers:

2

Hey,

I have some very simple code below that I can't get to validate on http://validator.w3.org/check and the errors make little sense to me. I'm stumped here can anyone see/understand the issue(s)?

Code:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd"&gt; 
<html xmlns="http://www.w3.org/1999/xhtml"&gt; 
    <head> 
        <title>Test Mobile Site</title> 
        <link href="/css/site.css" rel="stylesheet" type="text/css" media="handheld" /> 
    </head> 
    <body> 
        <div id="test">Why won't you validate for me? :(</div>
    </body> 
</html>

Errors:

Error: Line 18, Column 46: Input is not proper UTF-8, indicate encoding ! Bytes: 0x92 0x53 0x20 0x52

Error: Line 69, Column 17: conditional section INCLUDE or IGNORE keyword expected

Error: Line 73, Column 39: xmlParseElementDecl: 'EMPTY', 'ANY' or '(' expected

Error: Line 73, Column 39: Content error in the external subset

+1  A: 

Well this was my second time trying to figure this out and after doing enough digging I see that in July 2008 the W3C brought out xHTML Basic 1.1 which now supercedes xHTML Mobile Profile 1.2 from the Open Mobile Alliance.

Moral of the story: You'll find loads using MP 1.2 DTD in mobile examples across the web but you need to use:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"&gt;

if you want to validate correctly. Hope this helps someone else not to waste the time I did!

Reference: http://en.wikipedia.org/wiki/XHTML#XHTML_Basic_and_XHTML-MP

Denis Hoctor
+1  A: 

Yes, the XHTML Mobile Profile DTD is bogus. You'll never validate any document using it.

The problem is in http://www.openmobilealliance.org/tech/DTD/xhtmlmp12-form-1.mod, which is a version of the XHTML Forms module that OMA altered to add one attribute, inputmode. They managed to mess that up by pasting this comment with a smart-quote in it from MS Word into the module:

NO REPRESENTATIONS OR WARRANTIES (WHETHER EXPRESS OR IMPLIED) ARE
MADE BY THE OPEN MOBILE ALLIANCE OR ANY OPEN MOBILE ALLIANCE MEMBER
OR ITS AFFILIATES REGARDING ANY OF THE IPR’S REPRESENTED ON THE OMA

and saving it as cp1252 instead of the default encoding for XML entities, UTF-8. This results in the accurate error about the invalid UTF-8 sequence, which then seems to confuse the validator into failing to parse the following entity declarations correctly.

(It's doubly comical that this encoding error is itself triggered by a basic grammatical error, the grocers' apostrophe. But then since OMA are the jokers that gave us the WAP fiasco, perhaps this level of incompetence is to be expected.)

bobince