The standalone Attribute

If the standalone attribute has the value no, then an application may be required to read an external DTD (that is, a DTD in a file other than the one it’s reading now) to determine the proper values for parts of the document. For instance, a DTD may provide default values for attributes that a parser is required to report, even though they aren’t actually present in the document.

Documents that do not have DTDs, like all the documents in this chapter, can have the value yes for the standalone attribute. Documents that do have DTDs can also have the value yes for the standalone attribute if the DTD doesn’t change the content of the document in any way or if the DTD is purely internal. Details for documents with DTDs are covered in Chapter 3.

The standalone attribute is optional in an XML declaration. If it is omitted, then the value no is assumed.

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.