Why aren't document entities named?

Jeffrey E. Sussna jes at kuantech.com
Wed Jun 23 01:25:28 BST 1999

The XML spec states "this specification does not specify how the document
entity is to be located by an XML processor; unlike other entities, the
document entity has no name and might well appear on a processor input
stream without any identification at all." I believe that failure to specify
a named identifier for document entities causes at least two problems:
1. There is no standard way to embed multiple WELL-FORMED documents within a
single physical document entity. Actually it's easy to embed them, but
difficult to extract them, since there's no standard way to detect "start of
document". I can think of two obvious ways to do it: a) hardwire the parsing
application to know about the root element; b) use a processing instruction,
such as <?start-doc?>. Neither of these are satisfactory because they step
out of the realm of a general standard.
2. Among other things, a document defines a scope for ID attributes. When a
document maps 1-to-1 to a file, it is easy to construct an URL that
identifies an element based on its ID. But if a file (or other storage unit)
contains multiple documents, how do you address ID'd elements (or even the
document itself). Again, the processing instruction could solve this problem
by providing a document name, a la <?start-doc name="doc1" ?>.
I'd really like to know why this one entity was made anonymous. I have long
felt that XML has certain weaknesses in the area of data structure
definition that other languages solve through comprehensive, logical rather
than physical, scoping facilities. I believe this is a prime case in point.
Jeff Sussna

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 (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe 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