Next page Previous page Start of chapter End of chapter

The XML declaration

XML documents can have an XML declaration. If present, the XML declaration must be the first thing in the document (not even a white space may precede it). It starts with <?xml, ends with ?>, and must have the pseudo-attribute version and possibly encoding and standalone. The meaning of the pseudo-attributes is the following:

For instance, the following line declares a standalone XML document in version 1.0 with an ISO-8859-1 encoding (ASCII plus the characters for most Western European languages)

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

Since XML documents are written in Unicode, you can use it to write multilingual documents. In such documents, it is useful to identify in which language a particular section is written. For instance, a multilingual spell-checker might check the spelling of sections in different languages. Each XML element may have an xml:lang attribute that specifies the language of the content of the element. Language codes are defined in ISO-639. An example follows:

<paragraph xml:lang="en">
The following is a Greek maxim saying: "The wise man knows himself".
</paragraph>

<maxim xml:lang="el">
&#x3C3;&#x3BF;&#x3C6;&#x3CC;&#x3C2;
&#x3AD;&#x3B1;&#x3C5;&#x3C4;&#x3CC;&#x3BD;
&#x3B3;&#x3B9;&#x3B3;&#x3BD;&#x3CE;&#x3C3;&#x3Ba;&#x3B5;&#x3B9;
</maxim>
Next page Previous page Start of chapter End of chapter
Caff�XML - Massimo Franceschet