- DTD Tutorial
- DTD - Home
- DTD - Overview
- DTD - Syntax
- DTD - Components
- DTD - Elements
- DTD - Attributes
- DTD - Entities
- DTD - Validation
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DTD - Components
This chapter will discuss about XML Components from DTD perspective. A DTD will basically contain declarations of the following XML components −
XML elements can be defined as building blocks of an XML document. Elements can behave as a container to hold text, elements, attributes, media objects or mix of all.
Each XML document contains one or more elements, the boundaries of which are either delimited by start-tags and end-tags, or empty elements.
Below is a simple example of XML elements
<name> Tutorials Point </name>
As you can see we have defined a <name> tag. There's a text between start and end tag of <name>. Elements, when used in an XML-DTD, need to be declared which will be discussed in detail in the chapter DTD Elements.
Attributes are part of the XML elements. An element can have any number of unique attributes. Attributes give more information about the XML element or more precisely it defines a property of the element. An XML attribute is always a name-value pair.
Below is a simple example of XML attributes −
<img src = "flower.jpg"/>
Here img is the element name whereas src is an attribute name and flower.jpg is a value given for the attribute src.
If attributes are used in an XML DTD then these need to be declared which will be discussed in detail in the chapter DTD Attributes
Entities are placeholders in XML. These can be declared in the document prolog or in a DTD. Entities can be primarily categorized as −
There are five built-in entities that play in well-formed XML, they are −
Single quote: '
Greater than: >
Less than: <
Double quote: "
We will study more about entity declarations in XML DTD in detail in the chapter DTD Entities