Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q5218 How does XML handle different languages?

irt.org | Knowledge Base | XML | Q5218 [ previous next ]

Q5218 How does XML handle different languages?

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.