How to Use Comments in XML
Syntax
An XML comment should be written as:
<!-- Write your comment-->
XML Comments Example
<?xml version="1.0" encoding="UTF-8" ?>
<!--Students marks are uploaded by months-->
<students>
<student>
<name>Ratan</name>
<marks>70</marks>
</student>
<student>
<name>Aryan</name>
<marks>60</marks>
</student>
</students>
Rules for adding XML comments
Syntax
An XML comment should be written as:
<!-- Write your comment-->
XML Comments Example
<?xml version="1.0" encoding="UTF-8" ?>
<!--Students marks are uploaded by months-->
<students>
<student>
<name>Ratan</name>
<marks>70</marks>
</student>
<student>
<name>Aryan</name>
<marks>60</marks>
</student>
</students>
Rules for adding XML comments
- Don't use a comment before an XML declaration.
- You can use a comment anywhere in XML document except within attribute value.
- Don't nest a comment inside the other comment.
Post a Comment