1.6 Comments
<!-- comment text -->XML supports comments that are used to provide information to humans about the actual XML content. They are not used to encode actual data. Comments can appear as children of elements. They can also appear as top-level constructs (children of the document) either before or after the document element.
Comments begin with the character sequence <!-- and end with the character sequence -->. The text of the comment is serialized between the start and the end sequences. The character sequence -- may not appear inside a comment. Other markup characters such as less than, greater than, and ampersand (&), may appear inside comments but are not treated as markup. Thus, entity references that appear inside comments are not expanded.
Examples
Legal comments
<!-- This is a comment about how to open ( <![CDATA[ ) and close ( ]]> ) CDATA sections --> <!-- I really like having elements called <fred> in my markup languages --> <!-- Comments can contain all sorts of character literals including &, <, >, ' and". --> <!-- If entities are used inside comments ( < for example ) they are not expanded. -->
Some syntactically legal comments
Illegal comments
<!-- Comments cannot contain the -- character sequence --> <!-- Comments cannot end with a hyphen ---> <!-- Comments cannot <!-- be nested --> -->
Some syntactically illegal comments