XML Comments

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.

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

Subscribe Updates via Email

Join 49,000+ W3schools lovers and get all the latest tutorials, programs, algorithms in your inbox.