09.03.2014 Views

IT 640 Modern Information Systems

IT 640 Modern Information Systems

IT 640 Modern Information Systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>IT</strong> <strong>640</strong> <strong>Modern</strong> <strong>Information</strong><br />

<strong>Systems</strong><br />

<strong>IT</strong> <strong>640</strong><br />

<strong>Modern</strong> <strong>Information</strong> <strong>Systems</strong><br />

Dr Deepak B Phatak<br />

Subrao Nilekani Chair Professor<br />

Kanwal Rekhi School of <strong>Information</strong> Technology<br />

I<strong>IT</strong> Bombay<br />

Session 21, eXtensible Markup Language (XML)<br />

SESSION OVERVIEW<br />

Review of Markup Languages<br />

HTML<br />

Rendering Vs Semantics<br />

XML Basics<br />

Elements and Attributes<br />

Namespaces<br />

XML Schema<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

2<br />

HTML<br />

A Markup Language<br />

Used by Proof-editors<br />

Font, margins, etc.<br />

HTML<br />

Predefined tags<br />

To describe appearance (Rendering)<br />

Can embed programs<br />

Browsers are interpreters of HTML<br />

XML<br />

Extensible Markup Language<br />

meta language to represent data<br />

or a piece of information<br />

Markup of XML elements<br />

done through<br />

data <br />

Tags are user defined, case sensitive<br />

Used to denote meta data<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

3<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

4<br />

XML<br />

Each XML document<br />

Has a root element<br />

other elements (nested)<br />

A mixed element can<br />

support other elements<br />

Sequentially<br />

Hierarchically<br />

XML example<br />

Describe a note document<br />

is the root element<br />

Contains four child elements<br />

to, from, heading, and body<br />

Each element has some simple data<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

5<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

6<br />

1


XML example<br />

<strong>IT</strong> <strong>640</strong> <strong>Modern</strong> <strong>Information</strong><br />

<strong>Systems</strong><br />

<br />

Pratibha<br />

Deepak<br />

Reminder<br />

Visit Pune this weekend!<br />

<br />

XML Example<br />

Suppose an application<br />

reads the XML document<br />

Extracts the elements:<br />

, , , and <br />

Produces the following output<br />

REMINDER NOTE<br />

To: Pratibha<br />

From: Deepak<br />

Visit Pune this weekend!<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

7<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

8<br />

Extensibility<br />

Suppose the document<br />

is modified<br />

<br />

31-03-2005<br />

Deepak<br />

Pratibha<br />

Reminder<br />

Visit Pune this weekend!<br />

<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

9<br />

Extensibility<br />

If the same application<br />

is used again<br />

Will it crash?<br />

No, it will still<br />

Correctly extract the required fields<br />

Produce exactly the same output<br />

ignoring the extra information<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

10<br />

XML Elements<br />

<br />

My First XML<br />

<br />

<br />

Introduction to XML<br />

What is HTML<br />

What is XML<br />

<br />

XML Syntax<br />

Elements must have a closing tag<br />

Elements must be properly nested<br />

<br />

<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

11<br />

XML Elements<br />

Elements have Content<br />

can have different content<br />

types.<br />

An element can have<br />

element content, mixed<br />

content, simple content,<br />

or empty content. An<br />

element can also have<br />

attributes.<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

12<br />

2


XML elements<br />

book has element content,<br />

because it contains other<br />

elements.<br />

Chapter has mixed content<br />

because it contains both text<br />

and other elements.<br />

Para has simple content (or<br />

text content) because it<br />

contains only text.<br />

Prod has empty content,<br />

because it carries no<br />

information.<br />

<strong>IT</strong> <strong>640</strong> <strong>Modern</strong> <strong>Information</strong><br />

<strong>Systems</strong><br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

13<br />

XML attributes<br />

XML elements can have<br />

attributes in the start tag, just<br />

like HTML<br />

Attributes are used to provide<br />

additional information about<br />

elements.<br />

<strong>IT</strong><strong>640</strong><br />

<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

14<br />

XML elements<br />

In the example only the prod element has<br />

attributes.<br />

The attribute named id has the value 143".<br />

The attribute named media has the value<br />

"paper".<br />

Dr. Deepak B Phatak <strong>IT</strong><strong>640</strong>-Session 21, XML<br />

15<br />

Attributes<br />

Attributes often provide<br />

information that is not a<br />

part of the data. In the<br />

example below, the file type<br />

is irrelevant to the data, but<br />

important to the software<br />

that wants to manipulate<br />

the element:<br />


This document was created with Win2PDF available at http://www.daneprairie.com.<br />

The unregistered version of Win2PDF is for evaluation or non-commercial use only.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!