W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2006

[whatwg] Map lang to xml:lang at the parser level

From: Henri Sivonen <hsivonen@iki.fi>
Date: Mon, 23 Oct 2006 13:52:44 +0300
Message-ID: <ADBADE0D-EC5A-4D34-A383-69FC32720186@iki.fi>
On Oct 15, 2006, at 20:05, Simon Pieters wrote:

> When parsing HTML and serializing as XML you normally want to  
> change the lang attribute to xml:lang. But why not put it in the  
> XML namespace at the parser level? Then when you serialize the DOM  
> as XML it becomes xml:lang automatically.

FWIW, this is what my special-purpose parser does in order to make  
the same schemas work with HTML and XHTML. (The special purpose being  
conformance checking.)

> I don't know if this is too expensive on the parser or if there are  
> other flaws but it's just an idea.

I believe it isn't too expensive in the parser.

I think this proposal is definitely worth considering. Would it have  
any ill effects on scripting compatibility with Appendix C XHTML soup  
served as text/html? In cases like <p lang='en' xml:lang='fr'> the  
DOM would not be exactly the same as in legacy browsers. (I am  
assuming here that xml:lang='fr' would disappear in text/html parsing  
and lang='en' would be treated as a meaningless attribute on the  
application/xhtml+xml side.)

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/
Received on Monday, 23 October 2006 03:52:44 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:49 UTC