Comments In XML

XML comments have the exact same syntax as HTML comments. A comment is used to temporarily edit out a portion of XML code or to leave a note . Although XML is a supposed to be self-describing data, you may still come across some instances where an XML comment might be necessary. Below is an example of a notation comment that should be used when you need to leave a note to yourself or to someone who may be viewing your XML.
 
Example:
 
<?xml version=”1.0″ encoding=”ISO-8859-15″?>
<!–Associate commission details are updated bi-weekly –>
<associate_details>
  <associate>
   <name>XYZ Kumar</name>
   <commission>50K</commision>
</ associate >
<associate>
     <name>Dharmendra Das</name>
     <commission>52K</commision>
</ associate >
<associate>
     <name>ABC </name>
     <commission>92K</commision>
</ associate >
</associate_details>
<!– End of associate commission details–>
 
For many different reasons, sometimes you might want to temporarily remove some XML code from your XML document. XML Comments let you do this easily, as this example below shows.
 
Example:
 
<?xml version=”1.0″ encoding=”ISO-8859-15″?>
<!–Associate commission details are updated bi-weekly –>
<associate_details>
<–
<associate>
    <name>XYZ Kumar</name>
    <commission>50K</commision>
</ associate >
–>
<associate>
    <name>Dharmendra Das</name>
    <commission>52K</commision>
</ associate >
<associate>
    <name>ABC </name>
    <commission>92K</commision>
</ associate >
</associate_details>
<!– End of associate commission details–>