Name
Standalone Document Declaration
Text from specification
The standalone document declaration must have the
value no
if any external
markup declarations contain declarations of: attributes with
default values, if elements to which these attributes apply
appear in the document without specifications of values for
these attributes, or entities (other than amp
, lt
, gt
, apos
, quot
), if references to those entities
appear in the document, or attributes with values subject to
normalization, where the attribute appears in the document with
a value which will change as a result of normalization, or
element types with element content, if whitespace occurs
directly within any instance of those types.
Explanation
This laundry list of potential standalone flag violations
can be read to mean, “If you have an external subset in your
DTD, ensure that your document doesn’t depend on anything in it
if you say standalone='yes
'
in your XML declaration.” A more succinct interpretation would
be, “If your document has an external DTD subset, just set
standalone
to no
.”
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.