0% found this document useful (0 votes)
68 views14 pages

Chapter 5 - XML

Chapter 5 introduces XML, a markup language designed for storing and transporting data, which is both human and machine-readable. It highlights XML's origins from SGML and its advantages over HTML, such as extensibility and support for Unicode, while also noting its disadvantages like verbosity and redundancy. The chapter concludes by demonstrating XML's flexibility through examples of how applications can adapt to changes in data structure.

Uploaded by

farisyanazari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views14 pages

Chapter 5 - XML

Chapter 5 introduces XML, a markup language designed for storing and transporting data, which is both human and machine-readable. It highlights XML's origins from SGML and its advantages over HTML, such as extensibility and support for Unicode, while also noting its disadvantages like verbosity and redundancy. The chapter concludes by demonstrating XML's flexibility through examples of how applications can adapt to changes in data structure.

Uploaded by

farisyanazari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Chapter 5:

Introduction to
XML
What is XML
• XML stands for eXtensible Markup Language
• XML is a markup language much like HTML
• XML was designed to store and transport data
• XML is a meta language that allows you to create
and format your own document markups
What is XML (cont.)
• XML is a method for putting structured data into a
text file; these files are - easy to read - unambiguous
- extensible - platform-independent
• XML documents are used to transfer data from one
place to another often over the Internet.
The Origins of XML
• Extensible Markup Languages (XML) history begins
with the development of Standardised Generalised
Markup Language (SGML) by Charles Goldfarb,
along with Ed Mosher and Ray Lorie in the 1970s
while working at IBM (Anderson, 2004).
• SGML despite the name is not a mark-up language
in it’s own right, but is a language used to specify
mark-up languages. The purpose of SGML was to
create vocabularies which could be used to mark
up documents with structural tags.
• It was imagined at the time, that certain machine
readable documents should remain machine
readable for perhaps decades.
(cont.) The Origins of
XML
• One of the most popular applications of SGML
came with the development of HyperText Markup
Language (HTML) by Tim Berners Lee in the late
1980s (Raggett, Lam, Alexander & Kmiec, 1998).
• Since its development HTML has somewhat
become a victim of it’s own popularity, as it was
rapidly adopted and extended in many ways,
beyond it’s original vision. It remains popular today,
though as a presentation technology, and is
considered unsuitable as a general purpose data
storage format.
(cont.) The Origins of
XML
• When it comes to data storage and interchange,
HTML is a bad fit, as it was originally intended as a
presentation technology, while SGML is considered
too complex for general use.
• XML bridges this gap by being both human and
machine readable, while being flexible enough to
support platform and architecture independent
data interchange.
XML Features
• XML focuses on data rather than how it looks
• Easy and efficient data sharing
• Compatibility with other markup language HTML
• Supports platform transition
• Allows XML validation
• Adapts technology advancements
• XML supports Unicode
The Advantages of XML
• It supports Unicode, allowing almost any information
in any written human language to be
communicated.
• It can represent common computer science data
structures: records, lists, and trees.
• XML is heavily used as a format for document
storage and processing, both online and offline.
• It is based on international standards.
• It can be updated incrementally.
The Disadvantages of
XML
• XML syntax is redundant or large relative to binary
representations of similar data, especially with
tabular data
• The redundancy may affect application efficiency
through higher storage, transmission and processing
costs
• XML syntax is verbose, especially for human readers,
relative to other alternatives ‘text-based’ data
transmission formats.
• The hierarchical model for representation is limited
in comparison to an object-oriented graph
Comparing HTML and
XML
BASIS FOR COMPARISON XML
HTML

Expands to Extensible Markup Language Hypertext Markup Language

Basic Provides a framework for specifying markup HTML is predefined markup language.
languages.

Structural Information Does not contain structural information


Provided

Language type Case sensitive Case insensitive


Purpose of the language Transfer of information Presentation of the data

Errors Not allowed Small errors can be ignored.

Whitespace Can be preserved. Does not preserve white spaces.

Closing tags Compulsory to use closing tags. Closing tags are optional.

Nesting Must be properly done. Not much valuable.

Tags The XML language has no predefined tags. HTML works with predefined tags
XML is Extensible
• Most XML applications will work as expected even if
new data is added (or removed).
• Imagine an application designed to display the
original version of note.xml (<to> <from> <heading>
<body>).
• Then imagine a newer version of note.xml with
added <date> and <hour> elements, and a
removed <heading>.
• The way XML is constructed, older version of the
application can still work.
(cont.) XML is Extensible
Original Version

<?xml version="1.0" encoding="UTF-8"?>


<note> Note
<to>Farrah</to> To: Linda
<from>Linda</from> From: Farrah
<heading>Reminder</heading> Reminder
<body>Don't forget me this
Don't forget me this weekend!
weekend!</body>
</note>

Save file as: note.xml


(cont.) XML is Extensible
Newer Version

<?xml version="1.0" encoding="UTF-8"?>


<note>
Note
<date>2015-09-01</date>
To: Linda
<hour>08:30</hour>
From: Farrah
<to>Linda</to> Date: 2015-09-01 08:30
<from>Farrah</from> Don't forget me this
<body>Don't forget me this weekend!
weekend!</body>
</note>
CONT. – W3SCHOOL

You might also like