Edition for Web Developers — Last Updated 17 December 2024
Support in all current engines.
This section only describes the rules for XML resources. Rules for
text/html
resources are discussed in the section above entitled "The HTML
syntax".
Using the XML syntax is not recommended, for
reasons which include the fact that there is no specification which defines the rules for how an
XML parser must map a string of bytes or characters into a Document
object, as well
as the fact that the XML syntax is essentially unmaintained — in that, it’s not expected that any
further features will ever be added to the XML syntax (even when such features have been added to
the HTML syntax).
The XML syntax for HTML was formerly referred to as "XHTML", but this specification does not use that term (among other reasons, because no such term is used for the HTML syntaxes of MathML and SVG).
The syntax for XML is defined in XML and Namespaces in XML. [XML] [XMLNS]
This specification does not define any syntax-level requirements beyond those defined for XML proper.
XML documents may contain a DOCTYPE
if desired, but this is not required
to conform to this specification. This specification does not define a public or system
identifier, nor provide a formal DTD.
According to XML, XML processors are not guaranteed to process
the external DTD subset referenced in the DOCTYPE. This means, for example, that using entity references for characters in XML documents
is unsafe if they are defined in an external file (except for <
,
>
, &
,
"
, and '
).