Comments are an XML construct, and are normally only valid inside a DTD. However, as Section 7.4, “Escaping Back to XML” shows, it is possible to use XML syntax within the document.
The delimiter for XML comments is the string
“--
”. The first occurrence of
this string opens a comment, and the second closes it.
<!-- This is inside the comment --> <!-- This is another comment --> <!-- This is one way of doing multiline comments --> <!-- This is another way of -- -- doing multiline comments -->
XHTML users may be familiar with different
rules for comments. In particular, it is often believed that
the string <!--
opens a comment, and it is
only closed by -->
.
This is not correct. Many web browsers have broken XHTML parsers, and will accept incorrect input as valid. However, the XML parsers used by the Documentation Project are more strict, and will reject documents with that error.
<!-- This is in the comment -- THIS IS OUTSIDE THE COMMENT! -- back inside the comment -->
The XML parser will treat this as though it were actually:
<!THIS IS OUTSIDE THE COMMENT>
That is not valid XML, and may give confusing error messages.
All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/
Questions that are not answered by the
documentation may be
sent to <[email protected]>.
Send questions about this document to <[email protected]>.