The syntax for comments in XML is exactly the same as for HTML. That means, the comments should be enclosed inside the tag boundaries <!-- and -->
Why comments are used?
Generally, Comments are used for two major reasons –
- To give information about particular code or give a user insight on the purpose of the program.
- To hide a part of code temporarily.
Comments in XML Example
<title>MyBook</title> <!-- Name of the book -->
<author>ABC</author> <!-- Who wrote the book -->
<pages>100</pages> <!-- Total pages in book -->
<mrp>$49.99</mrp> <!-- Cost of the book inclusive of taxes-->
We hope that you found this article on Comments in XML to be helpful.
Please share your thoughts in the Comments Section.
If you liked this article, then please like our Facebook page.