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 help developers 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-->
  <phone>(091) 123-4567</phone>

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 comments inside a comment.

Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram