Vous êtes sur la page 1sur 36

CSC570 XML Programming

CHAPTER 1
INTRODUCTION TO
XML

Introduction to XML

Introduction to XML
Differences Between XML, SGML,
HTML
Uses of XML
Standard XML Applications

Anis Shobirin Bt Abdullah Sani

Introduction to XML

What is XML?
What are the elements in XML?
What are the XML Technologies

Anis Shobirin Bt Abdullah Sani

What is XML?

XML stands for Extensible Markup


Language.

XML is a set of rules for forming


semantic tags that break a document
into parts and identify the different
parts of the document.

Anis Shobirin Bt Abdullah Sani

What is XML?

XML, is a metamarkup language, in which you


make up the tags you need as you go along.

These tags must be organized according to


certain general principles, but they're quite
flexible in their meaning.

For instance, if you're working on genealogy and


need to describe people, births, deaths, burial
sites, families, marriages, divorces, and so forth,
you can create tags for each of these elements.

Anis Shobirin Bt Abdullah Sani

XML Environment

Anis Shobirin Bt Abdullah Sani

XML History

XML has two main predecessors: SGML


and HTML.

Both were very successful markup


languages, and HTML is probably the most
widely used markup language in history.

Both SGML and HTML have shortcomings,


and a new approach was needed to
combine their strengths without their
limitations XML.
Anis Shobirin Bt Abdullah Sani

XML History

The first drive for XML was, the Standard Generalized


Markup Language (SGML).

SGML is an international standard for semantic tagging


of documents that's been around for a little over a
decade.

SGML is intended for semantic markup that assists


computer cataloging and indexing, and can be extended
in an infinite variety of ways to handle new data formats.

Although SGML has its advantages, it is too complex and


expensive for anyone to put their information on the
Internet.

Anis Shobirin Bt Abdullah Sani

XML History

HTML, invented by Tim Berners-Lee at CERN in


1990, HTML was designed as a simple replacement
for SGML that could be written without the
assistance of expensive authoring tools.

Unfortunately, HTML didn't scale very well.

First of all, it was limited to a small fixed set of


tags.

HTML lacked the flexibility and adaptability of


SGML.

Anis Shobirin Bt Abdullah Sani

XML History

XML was designed by a group of 11 techies from


various companies that had an interest in internet
standards (Netscape, Microsoft, and others).

Their work was done via email and teleconference


in the late 1990s.

The formal XML standard recommendation coming


in early 1998.

Various versions of XML have since been


developed.
Anis Shobirin Bt Abdullah Sani

XML Basic Components

Elements.
The basic building block of XML markups.

Attributes.
Information regarding the element.

Character and Entity References.


Use to display characters that are not

supported by the input device (keyboard).


Entities may be defined and used.
Anis Shobirin Bt Abdullah Sani

XML Basic Components

Character Data (CDATA).


To escape blocks of text containing

characters which would otherwise be


recognized as markup.

Processing Instruction.
Allow documents to contain instructions for

applications.

Comments.
Anis Shobirin Bt Abdullah Sani

XML Declaration

The XML declaration looks like this:

<?xml version=1.0 encoding=UTF-8


standalone=yes?>
The XML declaration is not required by browsers, but

is required by most XML processors.


If present, the XML declaration must be first
Version=1.0 is required
Encoding can be UTF-8 (ASCII) or UTF-16
(Unicode), or something else, or can be omitted.
Standalone tells whether there is a separate DTD.
Anis Shobirin Bt Abdullah Sani

XML Document
Example 1

Anis Shobirin Bt Abdullah Sani

Example 2
<?xml version=1.0/>
<address>
<name>Alice Lee</name>
<email>alee@aol.com</email>
<phone>212-346-1234</phone>
<birthday>1985-03-22</birthday>
</address>

Full XML Document

Anis Shobirin Bt Abdullah Sani

XML Technologies

DTD/Schema
definition of XML structures

XPath
locating nodes

XSL (XSLT and XSL-FO)


presentation

Xlink, Xpointer
linking

DOM and SAX


APIs to manipulate XML
Anis Shobirin Bt Abdullah Sani

XML Technologies XML Parser

A parser is a piece of program that takes a physical


representation of some data and converts it into an inmemory form for the program as a whole to use.

XML parser is required to read and manipulate XML


documents.

It XML documents as a plain text and transform it into


a data structure, typically tree, in the memory.

The applications, such as web browser, access the


data structure and process the data according to their
objectives.
Anis Shobirin Bt Abdullah Sani

XML Parser Environment

Anis Shobirin Bt Abdullah Sani

Introduction to XML

Description to the XML


Differences Between XML, SGML,
HTML
Uses of XML
Standard XML Applications

Anis Shobirin Bt Abdullah Sani

Diff. between XML, SGML, HTML

What is Markup Language (ML)?


A markup language is a combination of words and

symbols which give instructions on how a document


should appear.
For example, a tag may indicate that words are written

in italics or bold type.


Although the most common and most widely used

markup languages are written for computers, the


concept of a markup language is not limited to
computer programming.
Anis Shobirin Bt Abdullah Sani

Diff. between XML, SGML, HTML

What is SGML?
SGML (Standard Generalized Markup Language) is a

standard for how to specify a document markup


language or tag set.
SGML is not in itself a

document language,
but a description of
how to specify one.
It is metadata.
Anis Shobirin Bt Abdullah Sani

Diff. between XML, SGML, HTML

What is HTML?
HTML (Hypertext Markup Language) is the set of

markup symbols or codes inserted in a file intended


for display on a World Wide Web browser page.
The markup tells the Web browser how to display a

Web page's words


and images for the user.
Each individual markup

code is referred to as an
element (but many people
also refer to it as a tag).
Anis Shobirin Bt Abdullah Sani

XML vs. SGML vs. HTML


SGML
SGML is semantic
markup for storage
(define your own
tags).

XML
XML is semantic
markup for
interoperability (define
your own tags).

HTML
HTML is visual
markup for
presentation
(predefined tags).

XML will not replace SGML or HTML. It addresses a new market integration.

Anis Shobirin Bt Abdullah Sani

Introduction to XML

Description to the XML


Differences Between XML, SGML,
HTML
Why use XML
Standard XML Applications

Anis Shobirin Bt Abdullah Sani

Why use XML?

A lot of computer data from the last forty years is irretrievably


simply because there is no document on how one reads the
data media and formats.

At a low level, XML is an incredibly simple data format. XML


can be written in ASCII text as well as a few other well-defined
formats.

ASCII is reasonably resistant to corruption. Removing bytes


or even large sequences of bytes does not noticeably corrupt
the rest of the text.

XML is well-documented.

The W3C's XML specification and numerous paper and books.

Anis Shobirin Bt Abdullah Sani

Why use XML

Separate data from HTML


Simplify data sharing
Simplify data transport
Simplify Platform Changes
Makes data more available

Anis Shobirin Bt Abdullah Sani

XML Separates Data from


HTML

If you need to display dynamic data in your


HTML document, it will take a lot of work to
edit the HTML each time the data changes.

With XML, data can be stored in separate


XML files. This way you can concentrate on
using HTML/CSS for display and layout,
and be sure that changes in the underlying
data will not require any changes to the
HTML.
Anis Shobirin Bt Abdullah Sani

XML Simplifies Data Sharing

In the real world, computer systems and


databases contain data in incompatible
formats.
XML data is stored in plain text format.
This provides a software- and hardwareindependent way of storing data.
This makes it much easier to create data
that can be shared by different
applications.
Anis Shobirin Bt Abdullah Sani

XML Simplifies Data


Transport

One of the most time-consuming


challenges for developers is to
exchange data between incompatible
systems over the Internet.
Exchanging data as XML greatly
reduces this complexity, since the data
can be read by different incompatible
applications.

Anis Shobirin Bt Abdullah Sani

XML Simplifies Platform


Changes

Upgrading to new systems (hardware or


software platforms), is always time
consuming. Large amounts of data must
be converted and incompatible data is
often lost.
XML data is stored in text format. This
makes it easier to expand or upgrade to
new operating systems, new applications,
or new browsers, without losing data.
Anis Shobirin Bt Abdullah Sani

XML Makes Your Data More


Available

Different applications can access your


data, not only in HTML pages, but also
from XML data sources.
With XML, your data can be available to
all kinds of "reading machines"
(Handheld computers, voice machines,
news feeds, etc), and make it more
available for blind people, or people with
other disabilities.
Anis Shobirin Bt Abdullah Sani

Introduction to XML

Description to the XML


Differences Between XML, SGML,
HTML
Uses of XML
Standard XML Applications

Anis Shobirin Bt Abdullah Sani

Standard XML
Applications

Web publishing:
XML allows you to create interactive pages, allows the

customer to customize those pages, and makes creating ecommerce applications more intuitive.

Web searching and automating Web tasks:


XML defines the type of information contained in a document,

making it easier to return useful results when searching the


Web.

General applications:
XML provides a standard method to access information,

making it easier for applications and devices of all kinds to use,


store, transmit, and display data.

Anis Shobirin Bt Abdullah Sani

Standard XML
Applications

e-business applications:
XML implementations make electronic data interchange (EDI)

more accessible for information interchange, business-tobusiness transactions, and business-to-consumer transactions.

Metadata applications:
XML makes it easier to express metadata in a portable,

reusable format.

Pervasive computing:
XML provides portable and structured information types for

display on pervasive (wireless) computing devices such as


personal digital assistants (PDAs), cellular phones, and others.

Anis Shobirin Bt Abdullah Sani

Questions & Answers

Thank You

Anis Shobirin Bt Abdullah Sani

Vous aimerez peut-être aussi