Re: HTML5 and XML syntax

temp17@staldal.nu wrote:
> Simon Pieters skrev:
>>> Why is it forbidden to use the XML syntax with text/html?
>>
>> It's not forbidden. 
> 
> I got that impression when reading this paragraph in the WD (section 1.3):
> -----
> XHTML documents (XML documents using elements from the HTML namespace) 
> that use the new features described in this specification and that are 
> served over the wire (e.g. by HTTP) must be sent using an XML MIME type 
> such as application/xml or application/xhtml+xml and must not be served 
> as text/html. [RFC3023]
> -----

The XHTML-compatible syntax that is allowed in text/html is only a 
subset of XML syntax, such as the xmlns attribute and and trailing slash 
for void elements.  Using non-HTML-compatible XML syntax in text/html is 
forbidden.

> It would be good if the xml:lang attribute was allowed in HTML documents 
> though:
> -----
> The xml:lang attribute may only be used on elements of XML documents. 
> Authors must not use the xml:lang attribute in HTML documents.
> -----

Why?  It would also serve no purpose.

>>> Why is this syntax [the traditional non-XML syntax] recommended?
>>
>> AIUI, because of wider support in UAs, because the syntax is more 
>> forgiving, and because most authors use it already.
> 
> Wider support in UAs is a valid argument. But I don't understand why 
> more forgiving syntax is an advantage.

Because it means that if a well-formedness error accidentally slips into 
the markup, then end users aren't presented with a Yellow Screen of 
Death, describing an error that they probably won't understand and can 
do nothing about.

> Because it is an advantage to be able to process HTML documents with XML 
> tools. And it's easier to parse.

Just process XHTML documents with XML tools and serialise as HTML before 
publishing, or just use the HTML-compatible subset of the XML syntax.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Monday, 28 January 2008 10:25:52 UTC