About XML DTD and its various components

The DTD is a building block of an XML document. It defines a list of legal documents for the document structure. A DTD can be specified either externally or internally in a document.

With the help of a DTD each of your XML files can carry information in their own format. A standard DTD can be used to verify whether the data you receive from outside is valid or not. A DTD can be declared either internally or externally. The following are the simple building blocks of XML:

* Tags
* Elements
* Entities
* Attributes
* CDDATA
* PCDATA

TAGS:

These are used to markup elements. These are used for formatting codes. This indicates how a document will appear when displayed.
Example:

<Wish>
<To>John</to>
<From>Jill</From>
<Heading>Reminder</Heading>
<Body>HAPPY BIRTHDAY</Body>
</Wish>
In the above example the term “wish” is the tag.

ELEMENTS:

These are the main building blocks of XML documents. Elements can contain text or they can be empty

Example:

<Wish>
<To>John</To>
<From>Jill</From>
<Heading>Reminder</Heading>
<Body>HAPPY BIRTHDAY</Body>
</Wish>

In the above example the terms <to>, <from>, <body> are the elements.

ENTITIES:

They are variables to define common text.

A few of the predefined entities in XML are as follows:

Entity References
Character
&gt;
>
&lt;
<
&quot;
&amp;
&
&apos;
'

ATTRIBUTES:

They provide extra information about elements.
Example:

<Img src="computer.gif" />

In the above example the Img provides more information about the image by specifying source of the image using the attribute “src”.

CDATA:

Cdata means Character Data. It is a text that will not be parsed by the parser. The text inside these tags is not treated as markups and the entities will not be expanded.

PCDATA:

PcData denotes “Parsed Character Data”. PcData is the text parsed by the parser. The text inside these tags is treated as markups and the entities will be expanded.



FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________





Top XML News