On Sun, 23 Jan 2005, Jerry Preston wrote:

> I was sending a web page and it showed it's self as "xxxx.xml".  When I look
> at the source code of my Perl CGI script the first lines are:
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE html
>       PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> 
> Why XML?

XHTML 1.0 is, in most ways, identical to HTML 4.0. 

The main differences are the presense of these header lines, and strict 
enforcement of rules that HTML had all along but most people didn't 
bother with: all tags must be balanced (every <p> or <li> must end with 
a </p> or </li>), all attributes must be wrapped in quotation marks 
(<img src="foo"> instead of just <img src=foo>), etc. Additionally, all 
tags must be lowercase in XHTML, where before it didn't matter in HTML.

Browsers should handle XHTML and XML documents about identically.

The main difference is that, by forcing XML syntax rules on HTML, it 
becomes possible to use XML tools on HTML documents reliably: parsers 
get easier to write, tools like XSLT can transform documents into new 
documents without choking because of missing tags, etc. 

If you don't like it, you don't have to use it -- the other response to 
your question showed how to turn it off. But the differences are really 
minimal, and the idea is for this to make life easier a few years from 
now, when lots of software moves to being able to handle XML documents 
cleanly and old, malformed HTML documents are harder to deal with.
 


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to