Forum Moderators: open

Message Too Old, No Replies

Can't Validate XHTML 1.0 Mobile Document?

         

jdMorgan

10:43 pm on Jul 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




System: The following 2 messages were cut out of thread at: http://www.webmasterworld.com/html/3396306.htm [webmasterworld.com] by encyclo - 8:46 pm on July 16, 2007 (utc -4)


Well, try using it to validate to the "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" DTD -- It won't even recognize the <head> element, and then of course the error cascade after that is even more impressive. :)

Never mind that the server sent the proper "application/xhtml+xml" MIME-type!

I'm not sure if it's still *that* broken, but it certainly was yesterday...

Jim

encyclo

12:45 am on Jul 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you talking about a document with the following doctype?

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

When validating a document with a non-W3C DTD, I usually turn to the WDG validator [htmlhelp.com] for comparison with the w3.org version (the WDG validator tends to handle custom DTDs better). However, a simple document with the above doctype fails completely in both validators.

Looking deeper, I don't think it is a validator issue at all, rather a MIME type issue. As I understand it (I'm willing to be corrected on this), when encountering a "new" (ie. not the usual W3C HTML/XHTML doctypes), the validator will fetch the DTD referenced in the doctype and parse the document according to that DTD. Such an approach would at the very least be logical.

The problem comes when you view the wapforum.org DTD (use Firefox and follow this link):

[wapforum.org...]

XML Parsing Error: syntax error
Location: [wapforum.org...]
Line Number 19, Column 1:

So the referenced DTD throws an XML error! Of course, we're talking about a DTD here, not an XML document: the DTD is served up as

text/xml
- which is totally wrong, as DTD files use SGML syntax, not XML.

This shows a few things - firstly, the dangers of relying on an external DTD, secondly, the importance of sending files with the right MIME code, and thirdly, the weakness of XML on the web.

On a not totally unrelated topic, does using

application/xhtml+xml
work well these days with mobile devices? My understanding was (and I don't develop for mobiles so I may be out of date) that most if not all authors blithely ignored the specification regarding MIME types and served everything as
text/html
instead.

jdMorgan

1:36 am on Jul 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you serve xhtml as text/html, Googlebot-Mobile will chuck you out of the Google Mobile index -- at least that's what I've seen... (the little mobile-phone icon on your listing disappears). Not that I want to grant Google any more of a standards-dictating monopoly on the Web, but hey, we need the mobile-device traffic... :)

I used that DTD and the application/xhtml+xml MIME-type on the recommendation of ready.mobi, and it passes *their* validator.

[added] As I recall, the "Mobile Specification" said that servers *should* serve as application/vnd.wap.xhtml+xml or application/xhtml+xml, but that clients *must* accept text/html. Google didn't like application/vnd.wap.xhtml+xml either, as I recall, so I'm using application/xhtml+xml. Frankly, I just kept adjusting things until everything worked in all the emulators, search engines, and phones/PDAs I could get my hands on. As usual, it looks like it'll be awhile before the "standards" are standard. [/added]

Jim

[edited by: jdMorgan at 1:47 am (utc) on July 17, 2007]