An XML document consists of a prolog and a root element that includes all other elements.
The prolog contains information about the version of XML used in the document and, as a rule, information about character encoding.
Often, the prolog also contains information about the declaration of a standalone document and whether there are references to an external markup file, which may directly affect the editable XML file.
Thus, the value « yes » in the standalone document declaration indicates the absence of external markup declarations that would affect the information passed by the XML processor to the application. For example, a prolog with a standalone document declaration looks like this:
<?xml version="1.0" encoding="Windows-1251" standalone="yes"?>
Accordingly, the simplest XML document may look like the one shown :
Example of a simple XML document
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!-- Example of an XML document --> <employee> <person lastname="Walkenbach" firstname="John" email="johnw@yandex.com"/> <person lastname="Wiley" firstname="Gary" email="gwiley@yandex.com"/> </employee>
As a rule, XML code can be typed in a text editor and saved with the .xml extension. For example can be typed in Notepad and then opened in Internet Explorer.
It should be noted that an XML document opened in a browser can be viewed element by element.
For example, if you click the minus sign to the left of the <employee> element, the nested elements will be hidden.