XML declaration
An XML declaration is an identifier string at the beginning of the prologue of an XML file.
syntax
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
The part after <?xmltakes on so-called pseudo-attributes . This is data that has the format attribut="wert". For an XML parser , these are technically no real attributes (hence the name). The order of the pseudo-attributes is determined by the specification (1st version, 2nd encoding, 3rd standalone).
The rule [23] of the XML standard defines the following pseudo-attributes:
version="1.0"- defines the version number of the underlying XML specification. The information is mandatory.
encoding="Zeichenkodierung"- determines the coding of the XML file. The specification is optional. If this parameter is omitted, the content must be encoded in either UTF-8 or UTF-16 if the encoding cannot be determined from the context (e.g. an HTTP header ).
standalone="Wert"- Valid values are
yesorno. - The specification is optional; if the parameter is
standaloneomitted, it is automaticallyyesornoassumed depending on the following referencing of an external DTD :- The attribute value
nois assumed or used when the document references an external DTD . - The attribute value
yesis assumed or used when the document does not reference an external DTD . - The attribute value
yesis assumed or used when the document contains an internal DTD . - The attribute value
yesis assumed or used if the document does not use a DTD .
- The attribute value
- The attribute value
nomust always be specified if the document, including the internal DTD, uses external declarations .
Examples of syntactically correct XML declarations:
<?xml version="1.0"?>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="UTF-16"?>
<?xml version="1.0" encoding="EUC-JP" standalone="yes" ?>
See also
Individual evidence
- ↑ XML Declaration in: Extensible Markup Language (XML) 1.0 (Fifth Edition). Retrieved January 16, 2017 .
- ↑ Standalone Document Declaration in: Extensible Markup Language (XML) 1.0 (Fifth Edition). Retrieved January 17, 2017 .