XML comment tags are completely ignored to display by the browsers. It's used to insert comments into the source code. This lesson describes how to write comments in XML.
Comment can be used anywhere to add information about XML tags or data, which will be helpful for developers to understand the existing code in the future easily.
The syntax for writing comments in XML is similar to the syntax of writing comments in HTML.
<!--This is a comment area, write your comment-->
<?xml version="1.0" encoding="UTF-8" ?> <!-- Employee Information--> <address> <name>Alex</name> <company>w3schools</company> <phone>(091) 123-4567</phone> </address>
XML Comments Rules
- Comment cannot be used before an XML declaration.
- Comment cannot be used within the attribute value.
- There is no meaning to used comment inside a comment.