XML Comments

XML comments are same as HTML comments. Comments are used as notes to easily understand the purpose of XML code. Comment can be used to include related links, information and terms. They are visible only in the source code, not in XML code. Comment show up anywhere in XML code. Syntax

<!-- Your comment-->
Comment start with <!--- and ends with --->. We can write comment in between these characters.

Example

<?xml version="1.0"?>  
<!----Employee salary uploaded by months--->  
<Employees>  
    <Employee>  
        <name>Ajay</name>  
        < salary >50000</salary>  
    </Employee>  
<Employee>  
        <name>Arun</name>  
        < salary >35000</salary>  
    </Employee>  
</Employees>
Try Now

Comment Rules

  • It is not appear before XML declaration.
  • t may appear anywhere in a document.
  • Comments are not appear within attribute values.
  • Comments are not nested inside the other comments.



ADVERTISEMENT
ADVERTISEMENT