Every XML document must begin with a declaration that states the version of XML being used; this declaration is also referred to as the "document prolog." This document prolog may also contain additional information, such as the document encoding, and whether the document is to be viewed in combination with external DTDs or other entities (as explained above, a DTD lays down the format for an XML document and can be used to verify whether or not it is valid.) Consequently, the document prolog can sometimes look like this, or this. The document prolog also contains a document type declaration, used to specify additional information about the document. This information typically includes the location of the DTD to use when validating the document (if there is one available), an optional list of entity declarations (more on this later), and the name of the root element of the document. A document type declaration usually looks like this: A possible document type declaration for the movie review above might look like this: In this case, the document would be validated against the DTD located at http://www.somedomain.com/review.dtd If entity declarations are present, this might be modified to read Entities will be discussed in detail in the second part of this article. This article copyright Melonfire 2001. All rights reserved.
blog comments powered by Disqus |