Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q5218 How does XML handle different languages?

You are here: irt.org | FAQ | XML | Q5218 [ previous next ]

If your writing your XML document in another language than English, it might be very useful to identify this. This server multiple purposes, e.g. search engines and aural browsers.

A special attribute xml:lang many be inserted in documents to specify the language used in the contents and attribute values of any element in an XML document. In valid documents, this attribute, like any other, must be declared if it is used.

It is customary to give the language code in lower case, and the country code (if any) in upper case. Note that these values, unlike other names in XMl documents, are case insensitive.

Consider this example:

<p xml:lang="en">Is the Internet any good?</p>
<p xml:lang=en-GB">What colour is it?</p>
<p xml:lang=en-US">What color is it?</p>
<sp who="Kohl" desc='leise' xml:lang="de">
  <l>Übung macht den Meister</l>
</sp>

©2018 Martin Webb