Comments

Although we've mentioned comments briefly before, we're mentioning them one last time here in detail to make sure you understand their usage, and to make a point about working with code in documents and DTDs.

Both XML files and Document Type Definitions may contain comments, which are simply pieces of text that are completely ignored by the XML parser, so they can contain just about anything you want to put in them.

Contents in XML take the form

<!-- Comment --> 

The comment must begin with the <!-- string, and it must end with the --> string. Here's an example of a comment:

<!--  This is my XML document. --> 

If we had

<!- This is not a valid comment --> 

or

<!-- This is also not a valid comment -> 

it would not be a valid comment. ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.