Skip to Content
Real World XML
book

Real World XML

by Steven Holzner
January 2003
Beginner to intermediate content levelBeginner to intermediate
1200 pages
23h 42m
English
Peachpit Press
Content preview from Real World XML

Comments

XML comments are very much like HTML comments. You can use comments to include explanatory notes in your document that are ignored by XML parsers; comments may appear anywhere in a document outside other markup. As in HTML, you start a comment with <!-- and end it with -->. Here's an example:

<?xml version="1.0" encoding="UTF-8"?> 
<DOCUMENT>
    <!--Start the document off with a greeting.-->
					<GREETING>
					<!--Here's the greeting's text.-->
        Hello from XML!
    </GREETING>
</DOCUMENT>

You should follow a few rules when adding comments to an XML document:

Comments must not come before an XML declaration. For example, this is incorrect:

					<!--Here's my document.--> <?xml version="1.0" encoding="UTF-8"?> <DOCUMENT> <GREETING> Hello from XML! </GREETING> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Inside XML

Inside XML

Steven Holzner
XML Hacks

XML Hacks

Michael Fitzgerald

Publisher Resources

ISBN: 0735712867Purchase book