xml:lang
Since XML documents are written in Unicode, XML is an excellent choice for multilingual documents, such as an Arabic commentary on a Greek text (something that couldn’t be done with almost any other character set). In such multilingual documents, it’s useful to identify in which language a particular section of text is written. For instance, a spellchecker that only knows English shouldn’t try to check a French quote.
Each XML element may have an xml:lang attribute that specifies the
language in which the content of that element is written. For example,
the previous maxim might look like this:
<maxim xml:lang="el"> σόC6;BF;C2; έB1;C5;C4;όν γιγνώσκει </maxim>
This identifies it as Greek. The specific code used, el, comes from the Greek word for Greek,
ε λ λ η ν ι κ ά.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access