In any markup language, the first element to appear is called the "root element", which defines what kind of document that file will be. In an HTML file the tag is the root element. An HTML file will always have the HTML element as the root element, while in an XML file it can be anything.
In an XML file there can only be one root element. The root element must encapsulate all other elements, meaning these other elements must show up after the opening root tag and before the closeing root tag. Here is an example of an XML document with the root element "phonebook".
XML Code:
Notice how the root element "phonebook" surrounds the other elements in XML file. Below is a broken XML file. Try to see if you can find what is wrong with this file before reading the caption below.
XML Code:
You should have noticed that the root element "phonebook" did not contain all other elements because the closing name tag is not between the root element tags & .
There Can Be Only One
Another rule for XML files is only one root element per file is allowed. Our previous example followed this rule, but our example below does not because it has two root elements. What are the two root elements?
XML Code:
If you said "phonebook" and "diary" were the two root elements then you got it right! Phone book is the first element to appear in this file, so it is automatically a root element.
After the phonebook element is closed, no other elements should follow because then there would be another root element. "diary" is the element that did not follow the one root element rule and transformed this XML file into a lawless, rule-breaking file!
http://www.nueva-design.com/nvd/Client-Side-Coding/XML-Tutorial/XML-Tutorial-445.html



