GJ.
GJ.

Reputation: 4626

What is the meaning of <xml lang="..">

<?xml version="1.0" encoding="iso-8859-1"?> 
<vxml version="2.0" xml:lang="..">

In the XML Snippet given above, the XML root has an attribute xml:lang value pointing to ".." value. what is the meaning of ".." here ?

Upvotes: 0

Views: 72

Answers (1)

Michael Kay
Michael Kay

Reputation: 163468

The semantics of the xml:lang attribute are defined in the XML recommendation §2.12:

A special attribute named xml:lang may 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. The values of the attribute are language identifiers as defined by [IETF BCP 47], Tags for the Identification of Languages; in addition, the empty string may be specified.

So it the author writes <quote xml:lang="de">Alle Menschen werden Brüder</quote> then the attribute is giving anyone who reads the document a clue that the quotation is in German.

Of course, it's only a convention and a clue. The document would not become invalid if the quotation were actually in French.

In your example you had xml:lang="..". I'm not sure if you were telling us that the actual value of the attribute was two full stops. That wouldn't be a valid language identifier according to IETF BCP 47. Unfortunately the spec is vague about how that should be handled; although it says "the values of the attribute are language identifiers", it doesn't say what the parser should do if it finds a value that isn't.

Upvotes: 2

Related Questions