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

Henri Sivonen hsivonen at iki.fi
Fri Oct 27 03:02:13 PDT 2006

On Oct 27, 2006, at 11:52, Anne van Kesteren wrote:

> On Fri, 27 Oct 2006 10:48:06 +0200, Henri Sivonen <hsivonen at iki.fi>  
> wrote:
>>>> However, other types of programs processing HTML5 using XML  
>>>> tools would have to be allowed to consider xml:lang in text/html  
>>>> non-conforming and trashable, because what you suggest violates  
>>>> basic assumptions that XML processing software is supposed to  
>>>> make or even enforce.
>>> How so?
>> The colon is not allowed in a local name, so having "xml:lang" in  
>> no namespace in a namespace-aware system is forbidden.
> Ah, so you were going to say that :-)  Yeah, dunno how to solve  
> serializatoin for those things. That's what currently happens...

It is not only a serialization issue. It is an API contract issue,  
too. (Which is why XML 1.1 is harmful, but that's a rant for another  

If you are doing processing outside a browser and have an XML tree  
implementation (XML DOM, XOM, ElementTree, whatever), a text/html  
parser cannot append stuff that makes XML-enforcing tree  
implementations throw an exception. Likewise, SAX ContentHandlers are  
allowed to assume that the stuff they get obeys XML rules.

WHAT WG gets to break API contracts in Presto, Gecko and WebKit, but  
there's a whole lot of other stuff out there. And the whole point of  
having an XML flavor is having all the other code Just Work. (And for  
non-browser cases you really want to convert from the text/html  
flavor to the XML flavor up front so that you can use the existing  
code for XML.)

Henri Sivonen
hsivonen at iki.fi

More information about the whatwg mailing list