XML Tutorial/Introduction/XML Declarations

Материал из Web эксперт
Версия от 08:26, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

XML provides the XML declaration to label documents as XML.

A declaration must include the version, but the encoding and standalone attributes are optional.
The version, encoding, and standaloneattributes must be in that order.
The XML declaration must be right at the beginning of the file. 
A typical XML declaration looks like this: 
<?xml version="1.0" encoding="UTF-16" standalone="yes"?> 
<name first="Bond" 
      middle="James" 
      last="Last"/> 
An XML declaration can be as full as the previous one or as simple as: 
<?xml version="1.0"?> 
Because the XML declaration is a processing instruction and not an element, there is no closing tag.