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

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