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 Attribute Tag
Tags
Content
Tag
Element
Start – tag Contains element type name
End – tag Empty – element tag Slide 7
Well formed XML - example <employees> <employee id="IN9999"> Suraj <middlename>Kumar <surname>Verma <department>IT Services <project>C2 <details>, even these symbols don't bother it.]]> <employee id="IN9498"> Abhi <surname>Dhar <department>R&D Services <project/>
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