Wrox Programmer Forums
|
BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3
This is the forum to discuss the Wrox book Beginning CSS: Cascading Style Sheets for Web Design by Richard York; ISBN: 9780764576423
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 1st, 2005, 06:53 PM
Registered User
 
Join Date: Aug 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to skillmanp
Default Sending XHTML as text/html Considered Harmful

A co-worker is strongly discouraging me to use the declaration
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> as advocated by Richard in his excellent and persuasive book.

My coworked referred me to following the article
http://hixie.ch/advocacy/xhtml
that concludes:
"There are few advantages to using XHTML if you are sending the content as text/html, and many disadvantages..."

so, somewhat in fear, I am reverting back to
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Am I following the right course?

==p
 
Old August 1st, 2005, 07:23 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I've read Hixie's article, though the one I read was much more informative and verbose than that one, I'll see if I can find it again. Unfortunately, I didn't read his article until after Beginning CSS had already been published, or I would have presented that opinion as well.

I'm on the fence on that topic. I like XHTML because it has rigid syntax. I also somewhat disagree with sending the application/xhtml+xml MIME type, because that presents the possibility of the user seeing the XML "Yellow Screen of Death", from XHTML documents that are not fully loaded. The YSOD, being the result of XML syntax that is not well-formed.

I still beleive that designers should design for the XHTML standard. But, in the end, HTML 4.0 is still a valid standard. We'll even see an HTML 5, eventually. Being a programmer, I just happen to like XHTML more, and beleive strongly, that the future of the web is XHTML.

XHTML 1.0, which appears in my book, can be sent as either text/html or application/xhtml+xml, and still conform to the standard. XHTML 1.1, and XHTML 2.0, on the other hand cannot be sent as text/html.

As with anything, including plain old HTML 4.0, designers should use validation tools to ensure that the markup they produce is well-formed, and conforms to the target standard. One of those tools being the W3C validation service at http://validator.w3.org. Hixie's arguments center around sending XHTML as text/html just invokes the browser's tag soup parser, instead of the more rigid XML parser, thereby making the more rigid syntax meaningless. I agree with his sentiments, but I also think that there's nothing wrong with this- if the developer knows what they're doing. e.g. validate the markup, and even use server-side programming to selectively supply the proper MIME type to browsers that support it. Unfortunately, Internet Explorer does not support this MIME type, which is another central point in Hixie's arguments.

I also found out, after Beginning CSS had shipped that the XHTML I presented isn't 100% compliant, eventhough validation at validator.w3.org told me it was. One thing is missing, a reference to the XHTML namespace, and in some of the examples a reference to the character set, though this isn't as bad, since it can be set in the HTTP headers instead.

Valid XHTML documents should begin as follows:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
    <head>
        <meta http-equiv='content-type' content='text/html; charset=UTF-8' />
Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
 
Old August 1st, 2005, 07:50 PM
Registered User
 
Join Date: Aug 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to skillmanp
Default

Richard...thank you for your speedy, considerate and thoughtful reply. As a web developer/database programmer who works for a builder of a cross platform IDE, I, too, enjoy the clarity and unambiguous nature of XML and am considering coding in XHTML just for the pure joy of it.

I sent my co-worker, a fierce advocate of open source, brilliant JAVA head and denouncer of IE, your reply. I am curious on how he will respond.

==p



 
Old August 3rd, 2005, 12:37 PM
Registered User
 
Join Date: Aug 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to skillmanp
Default

From a co-worker who a fierce proponent of browser responding in standard mode....

I like Richard York's response, and thoroughly agree with his sentiments
especially
> Being a programmer, I just happen to like XHTML more, and beleive
> strongly, that the future of the web is XHTML.

My thing is that the proper mime-type absolutely should be sent. What
he and Hixie both mentioned about server-side processing to choose the
right mime-type to send to conforming browsers I think is right on. I
didn't know that XHTML 1.0 specifically allowed text/html as a valid
mime-type.

> Hixie's arguments center around sending XHTML as text/html just
> invokes the browser's tag soup parser, instead of the more rigid XML
> parser, thereby making the more rigid syntax meaningless. I agree
> with his sentiments, but I also think that there's nothing wrong with
> this- if the developer knows what they're doing.

One of the things I'm after is getting browsers, especially IE, to go
into standards mode instead of "quirks" mode because there are fewer IE
bugs and oddities to deal with when it's using the W3C box model
instead of the original IE (Spyglass?) box model. I also go after
getting both the [x]html and css valid.






Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML 4.0 vs. XHTML 1.0 and font sizes Ron Howerton HTML Code Clinic 4 October 14th, 2008 07:05 AM
html tags to reformed to xhtml standard using xsl swapbpl XSLT 12 May 8th, 2008 05:38 AM
w3 HTML (XHTML) validation crmpicco HTML Code Clinic 6 June 7th, 2006 07:33 AM
New HTML, XHTML, and CSS book jminatel HTML Code Clinic 0 July 30th, 2004 04:41 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.