The standalone Declaration

The standalone Declaration

The standalone attribute has the value yes or no. If no standalone declaration is present, then no is the default.

A yes value means that no declarations in the external DTD subset affect the content of the document in any way. Specifically, the following four conditions apply.

  1. No default attribute values are specified for elements.

  2. No entity references used in the instance document are defined.

  3. No attribute values need to be normalized.

  4. No elements contain ignorable white space.

Table 1-1. Character Set Names Defined in XML

Name

Set

UTF-8

Variable width, byte order independent Unicode

UTF-16

Two-byte Unicode with surrogate pairs

ISO-10646-UCS-2

Two-byte Unicode without surrogate pairs; plane 0 only

ISO-10646-UCS-4

Four-byte Unicode

ISO-8859-1

Latin-1; mostly compatible with the standard U.S. Windows character set

ISO-8859-2

Latin-2

ISO-8859-3

Latin-3

ISO-8859-4

Latin-4

ISO-8859-5

ASCII and Cyrillic

ISO-8859-6

ASCII and Arabic

ISO-8859-7

ASCII and Greek

ISO-8859-8

ASCII and Hebrew

ISO-8859-9

Latin-5

ISO-8859-10

Latin-6

ISO-8859-11

ASCII plus Thai

ISO-8859-13

Latin-7

ISO-8859-14

Latin-8

ISO-8859-15

Latin-9, Latin-0

ISO-8859-16

Latin-10

ISO-2022-JP

A combination of ISO 646 (a slight variant of ASCII) and JIS X0208 that uses escape sequences to switch between the two character sets

Shift_JIS

A combination of JIS X0201:1997 .and JIS X0208:1997 that uses escape sequences to switch between the two character sets

EUC-JP

A combination of four code sets (ASCII, JIS X0208-1990, half width Katakana, and JIS X0212-1990) that uses escape sequences to switch between the character sets

If these conditions hold, the parser may choose not to read the external DTD subset, which can save a significant amount of time when the DTD is at a remote and slow web site.

A nonvalidating parser will not actually check that these conditions hold. For example, it will not report an error if an element does not have an attribute for which a default value is provided in the external DTD subset. Obviously the parser can't find mistakes that are apparent only when it reads the external DTD subset if it doesn't read the external DTD subset.

A validating parser is supposed to report a validity error if standalone has the value yes and any of these four conditions are not true.

It is always acceptable to set standalone to no, even if the document could technically stand alone. If you don't want to be bothered figuring out whether all of the above four conditions apply, just set standalone="no" (or leave it unspecified because the default is no). This is always correct.

The standalone declaration only applies to content read from the external DTD subset. It has nothing to do with other means of merging in content from remote documents such as schemas, XIncludes, XLinks, application-specific markup like the img element in XHTML, or anything else. It is strictly about the DTD.

Whatever values you pick for the version , encoding , and standalone attributes, and whether you include encoding and standalone attributes at all, you should provide an XML declaration. It only takes a few bytes and makes it much easier for both people and parsers to process your document.



Effective XML. 50 Specific Ways to Improve Your XML
Effective XML: 50 Specific Ways to Improve Your XML
ISBN: 0321150406
EAN: 2147483647
Year: 2002
Pages: 144

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net