Roots and Nests

This paragraph (which, strictly speaking is unnecessary - it is merely amplifying the consequences of the grammar) describes the essence of well-formedness. Simply stated, there has to be one element that contains everything else, and all the elements have to nest nicely within each other - no overlapping! All this "root" and "nest" terminology suggests trees, which is just fine.

The fact that XML requires a single root element is more important than you might think; given that we expect to be transmitting these documents over network links which, we all know, are sometimes slow, flaky, and unreliable, it's a really good idea if the beginning and (especially) the end of every document is clearly marked, so that even if the guy on the other end is slow in closing down the link, you know when you've got the whole message.

Back-link to spec

Copyright © 1998, Tim Bray. All rights reserved.