Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 12

XML Introduction

XML Programming Overview


Sep-2009

© 2008 MindTree Consulting


Agenda

Introduction to XML
Need for XML

Slide 2
Brief History of XML

Developed in 1996 by W3C.


A subset of and based upon SGML (Standard Generalized Markup
Language).
Originally designed to meet the challenges of large-scale electronic
publishing.
Designed to be both machine readable and human readable.

Slide 3
What is XML?

XML provides a platform-neutral, language-independent means of


describing data.
XML documents can be validated in many ways to ensure consistent
format.
XML allows us to define your own tags, so we can create our own
markup languages.
The XML specification is owned by W3C
XML is about the description of data, and not its presentation.

Slide 4
Cont..

XML – Extensible Markup Language


Based upon HTML
Describe your own tags
Uses DTD ( Document Type Definition ) to describe the data
XML is not a replacement for HTML
XML is a language for creating other languages
Documents follow the custom language a user develops from XML
Labeled information in XML can be reused
Need to follow the rules accordingly

Slide 5
Problem with HTML

Do not give information about content of the web page


Hard to be able to reuse this information
HTML are hard to display from browser’s point of view because of
HTML’s simplicity
Limited in areas of formatting and dynamic content

Slide 6
XML Syntax

XML uses a “tag markup syntax” similar to HTML.


XML is case sensitive
<employee> is not the same as <Employee>

Elements
Element is the basic container for content

<emp id=“123”>Employee</emp>
Attribute Tag Content Tag

Tags Element

Start – tag
 Contains element type name
End – tag
Empty – element tag

Slide 7
Well formed XML - example

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


<employees>
<employee id="IN9999">
<name>
<firstname>Suraj</firstname>
<middlename>Kumar</middlename>
<surname>Verma</surname>
</name>
<department>IT Services</department>
<project>C2</project>
<details><![CDATA[Some data here >, even these symbols don't bother it.]]></details>
</employee>
<employee id="IN9498">
<name>
<firstname>Abhi</firstname>
<surname>Dhar</surname>
</name>
<department>R&amp;D Services</department>
<project/>
</employee>
</employees>

Slide 8
Valid XML

Why validate XML at all?


Valid XML data is well-formed data that also complies with syntax,
structural and other rules as defined in a Document Type
Definition.
Alternatives to DTD
XML Schema
XML Data

Slide 9
XML Parsers

Two common XML Parser specifications


DOM
SAX
When to user SAX
Large document handling
Retrieving a specific value from a document
Creating a subset document
When to use DOM
Modifying the document
Random access

Slide 10
Questions

Slide 11
Thank you

XML Technology, Semester 4


SICSR Executive MBA(IT) @ MindTree, Bangalore, India

By Neeraj Singh (toneeraj(AT)gmail(DOT)com


)
Slide 12

You might also like