What is the reasoning why a well-formed XML text cannot have multiple top level elements?

Tim Bray tbray at textuality.com
Mon Dec 20 04:30:33 GMT 1999


At 10:15 AM 12/19/99 -0500, Clark C. Evans wrote:
>It just seems that two domains, log files and continuous 
>broadcasts are left out in the cold with this seemingly
>arbitrary choice.  So, I'm looking for answers *other*
>than the following:

Both logfiles and continuous broadcasts work just fine, simply send
a series of small XML documents rather than try to pretend the whole
logfile is one parsable object.  Which is arguably better design anyhow;
to start with, among other things you can validate each record; in 
principle you can't validate a doc until you've read it all.

I've always thought the single-root-element idea was a good one for
networked apps simply because it allows you to know unambiguously when
you're done receiving useful data, and don't have to rely the programmer
at the other end closing the socket, and the connection teardown time,
and so on.

But the real reason XML was done that way was becasuse it was one of
the things inherited from SGML that nobody ever asked to have changed.
Really, I don't recall a single word on that subject at the time. -Tim

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list