W3C home > Mailing lists > Public > xml-editor@w3.org > January to March 2010

Parsing rules of xml:lang

From: Marcos Caceres <marcosc@opera.com>
Date: Mon, 15 Mar 2010 16:15:33 +0100
Message-ID: <4B9E4F15.30001@opera.com>
To: xml-editor@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 15 March 2010 15:16:21 GMT