Parsing rules of xml:lang

Hi,
I'm think processing xml:lang is a bit underspecified. It does not 
really make it clear in erroneous cases such as:

<x xml:lang="  en  ">
    <y xml:lang="I am not a language tag"> What language am I?</y>
</x>

Does y then inherit x's xml:lang? OR is y XML lang in error, and treated 
as if it was an empty string? I guess logically, it would be treated as 
an empty string.

I know this is probably the wrong working group to raise this in... 
but... if the influence of xml:lang is defined to be inherited, why does 
the DOM not provide a way to get at an elements' language without 
requiring the use of xPath? I.e., an attribute that would reflect the 
value of the inherited xml:lang, like "element.lang", would be quite 
helpful:

var y = doc.getElementsByTagName("y")[0];
alert(y.lang); /* returns 'en', spaces trimmed */

Kind regards,
Marcos

-- 
Marcos Caceres
Opera Software

Received on Monday, 15 March 2010 15:16:11 UTC