Well-Formed XML Documents
As mentioned previously, an XML document is well formed if only one root exists and all start tags have corresponding end tags, with the correct nesting. For example, the following is not well formed:<bookcatalog>
<book>
<title>History of Interviews</ti>
<author>
<firstname>Juan</firstname>
<lastname>Smith</author></lastname>
<ISBN>99999-99999</ISBN>
<publisher>Oracle Press</publisher>
<publishyear>2003</publishyear>
<price type="US">10.00</price>
</book>
</bookcatalog>
<bookcatalog2>
…
</bookcatalog2>
The following are the reasons why it is not well formed:
Two roots exists, bookcatalog and bookcatalog2.
The <title> tag does not have a correct corresponding end tag, as in </title>.
The end tag </author> is not nested correctly, because the </lastname> end tag is after it instead of before it.
XML parsers will reject this document without further processing.