26.01.2019 Views

XML Simplified

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Module 1<br />

Introduction to <strong>XML</strong><br />

1.4 <strong>XML</strong> Syntax<br />

In this last lesson, <strong>XML</strong> Syntax, you will learn to:<br />

‣ ¾ State and describe the use of comments and processing instructions in <strong>XML</strong>.<br />

Concepts<br />

‣ ¾ Classify character data that is written between tags.<br />

‣ ¾ Describe entities, DOCTYPE declarations and attributes.<br />

1.4.1 Comments<br />

<strong>XML</strong> comments are used for the people to give information about the code in the absence of the developer.<br />

It makes a document more readable. Comments are not restricted to document type definitions but may<br />

be placed anywhere in the document. Comments in <strong>XML</strong> are similar to those in HTML. Comments should<br />

be used only when needed, as they are not processed. Comments are used only for human consumption<br />

rather than machine consumption. Since the comments are not parsed, their presence or absence does<br />

not make any difference to the processors.<br />

They are inserted into the <strong>XML</strong> document and are not part of the <strong>XML</strong> code. They can appear in the<br />

document prolog, DTD or in the textual content. These comments will not appear inside the tags or<br />

attribute values.<br />

Comments start with the string . The parser believes that the comment<br />

has come to an end when it finds a > as shown in figure 1.8.<br />

Figure 1.8: Comments in <strong>XML</strong> Document<br />

<strong>XML</strong> <strong>Simplified</strong><br />

Version 1.0 © Aptech Limited

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!