XML Comments: Complete Guide with Examples

XML has built-in support for comments. Comments are added to XML data to describe what a given block of data is for. Comments are for humans only and are ignored by XML processors. XML comments may contain information, links, and data-related terms. Comments in XML start with "<!--" and end with "-->", and a text note should be added between these characters. Comment lines may appear anywhere in the XML code. In this XML comment example, we have included two comment elements in the XML data, which you can see below.

XML

XML Comments Summary
  • XML has built-in support for comments
  • XML comment may appear anywhere in the code
  • Comments are ignored by XML processors
  • XML comments cannot be placed before an XML declaration
  • Nested comments in XML are not allowed
  • A comment is intended for humans only and is ignored by XML processors
Trusted by 850,000+ API Developers