Syntax. An XML comment should be written as: <! -- Write your comment-->
How do I comment out a line in XML?
If you want to comment out a single line in the XML code, insert your cursor at the beginning of a line you want to comment out. Type a less-than symbol followed by an exclamation point and two dashes. Move your cursor to the end of the line and then type two dashes followed by a greater-than symbol.
Can you comment out XML?
5 Answers. No, there is no way to comment a line in XML and have the comment end automatically on a linebreak. XML forbids -- in comments to maintain compatibility with SGML.