Module 5
XML & Data Exchange
Technologies
Class: SE
Sem: IV (NEP 2020)
Subject: MDM -Introduction to web technologies
What is XML?
• XML stands for Extensible Markup Language.
• XML is a markup language much like HTML.
• XML was designed to carry data, not to display data.
• XML tags are not predefined. You must define your own
tags.
• XML is designed to be self-descriptive.
Features/Advantages of XML
1. XML is platform independent and programming language
independent, thus it can be used on any system and supports
the technology change when that happens.
2. XML separates data from HTML. The data stored and
transported using XML can be changed at any point of time
without affecting the data presentation.
3. XML simplifies data sharing between various systems because
of its platform independent nature.
4. XML increases data availability.
XML Elements/ XML tree
• XML elements can be defined as building blocks of an XML.
• Elements can behave as containers to hold text, elements,
attributes, media objects or all of these.
• Each XML document contains one or more elements, the scope of
which are either delimited by start and end tags, or for empty
elements, by an empty-element tag.
<root>
<child>
<subchild>.....</subchild>
</child>
</root>
• An XML document is always descriptive.
• The tree structure is often referred to as XML Tree and plays an
important role to describe any XML document easily.
• The tree structure contains root (parent) elements, child elements and
so on.
• By using tree structure, you can get to know all succeeding
branches and sub-branches starting from the root.
• The parsing starts at the root, then moves down the first branch to
an element, take the first branch from there, and so on to the leaf
nodes.
Example: [Link]
department
<department>
<student> student student
<name> ABC</name>
<rollno>12</rollno> name rollno name rollno
</student>
<student> ABC 12 PQR 25
<name> PQR</name>
<rollno>25</rollno>
</student>
</department>
XML HTML
XML stands for extensible Markup HTML stands for Hypertext Markup
Language Language
XML is designed for storing and HTML is primarily for presenting data
transporting data. in browsers
Tags used are user-defined It uses pre-defined tags
Tags are case-sensitive Tags are not case-sensitive
Root element is userdefined and only Root element is <html>
one root element is allowed
All tags must be properly opened and Not all the tags need a closing tag. Tags
closed. like <br>, <img> don’t need a closing
tag.
Explain XML DTD with its types.
• XML Document Type Declaration(DTD) is a way to
describe precisely the XML language.
• DTD is an XML technique used to define the structure of a
XML document.
• It defines relationship between root element, child
elements and sub-child elements.
• It contain declarations that define elements, attributes,
notations, and entities for any XML files that reference the
DTD file.
Feature of DTD
• It defines the compulsory and optional elements in the XML
document.
• It validates the structure of the XML document.
• It checks for the grammar of the XML document.
• It describes the order in which the element occurs.
Basic Syntax of DTD root-element path to a file on
the system
<!DOCTYPE element DTD identifier
optional list [
of entity
declarations declaration1
called
Internal declaration2
Subset. ........
]>
DTD can be defined in two ways:
1. Internal DTD : A DTD is referred to as an internal DTD if elements
are declared within the XML files. To refer it as internal DTD,
standalone attribute in XML declaration must be set to yes.
Syntax:
<!DOCTYPE root-element [element-declarations]>
where root-element is the name of root element and element-
declarations is where you declare the elements.
[Link]
<?xml version = "1.0" encoding = "UTF-8" standalone=”yes”?>
<!DOCTYPE address
element name
[
<!ELEMENT address (name, phone)>
parsable
<!ELEMENT name (#PCDATA)> character data
<!ELEMENT phone (#PCDATA)>
]>
<address>
<name> Tanmay Patil</name>
<phone>(011) 123-4567</phone>
</address>
2. External DTD: In external DTD elements are declared outside the
XML file. To refer it as external DTD, standalone attribute in the XML
declaration must be set as no.
Syntax:
<!DOCTYPE root-element SYSTEM "file-name">
where file-name is the file with .dtd extension.
[Link]
<?xml version="1.0" standalone=”no”?>
<!DOCTYPE employee SYSTEM "[Link]">
<employee>
<firstname>ABC</firstname>
<email>abc@[Link]</email>
</employee>
[Link]
<!ELEMENT employee (firstname,email)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT email (#PCDATA)>
<?xml version="1.0" standalone=”no”?>
<!DOCTYPE ecommerce SYSTEM "[Link]">
<ecommerce>
<product>
<product_id> 101 </product_id> [Link]
<product_name> Laptop </product_name>
<product_cost> 55000 </product_cost>
<purchase_date> 28-01-2026</purchase_date>
<purchased_by>John</purchased_by>
<seller_name>ABC Electronics</seller_name>
</product>
<product>
<product_id> 105 </product_id>
<product_name> Mouse </product_name>
<product_cost> 550 </product_cost>
<purchase_date> 04-02-2026 </purchase_date>
<purchased_by>Ana</purchased_by>
<seller_name>XYZ Electronics</seller_name>
</product>
</ecommerce>
[Link]
<!ELEMENT ecommerce (product +)>
<!ELEMENT product (product_id, product_name, product_cost,
purchase_date, purchased_by, seller_name)>
<!ELEMENT product_id (#PCDATA)>
<!ELEMENT product_name (#PCDATA)>
<!ELEMENT product_cost (#PCDATA)>
<!ELEMENT purchase_date (#PCDATA)>
<!ELEMENT purchased_by (#PCDATA)>
<!ELEMENT seller_name (#PCDATA)>
[Link] <tr>
<!DOCTYPE html> <td>101</td>
<html><head> <td>Laptop</td>
<title>E-commerce Data</title> <td>55000</td>
</head> <td>228-01-2026</td>
<body> <td>John</td>
<h2>Product Details</h2> <td>ABC Electronics</td>
<table border="1"> </tr>
<tr> <tr>
<th>Product ID</th> <td>105</td>
<th>Name</th> <td>Mouse</td>
<th>Cost</th> <td>550</td>
<th>Purchase Date</th> <td>04-02-2026</td>
<th>Purchased By</th> <td>Ana</td>
<th>Seller</th> <td>XYZ Electronics</td>
</tr> </tr>
</table>
</body></html>