Introduction To XML - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Introduction To XML

Description:

... a program using some libraries (DOM or SAX) Write processing rules ... DOM Or SAX. Libraries to parse XML data ... DOM is easy to use, slow, and consumes memory ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 26
Provided by: ABDUL83
Category:
Tags: xml | dom | introduction

less

Transcript and Presenter's Notes

Title: Introduction To XML


1
Introduction To XML
  • By Abdul Habra
  • October 30, 2002

www.tek271.com/articles/articles.html
2
Topics
  • Expectations
  • What is XML
  • Acronyms
  • History
  • Motivation
  • Where/Who uses XML
  • When to use/not use
  • Technologies
  • Whats next
  • Feedback

3
Expectations
  • Understand what XML is, even if you are not a
    programmer
  • Tell you what are some of the acronyms and
    technologies
  • What to do to learn more
  • Will NOT learn API or programming

4
What Is XML
  • Data formatted in a way that is easy for humans
    and machines to read
  • eXtensible Markup Language
  • Text data, i.e. not binary
  • When stored in a file, one can view it with
    Notepad
  • Not a proprietary language
  • Fast becoming a universal data translation
    language

5
Example
lt?xml version"1.0"?gt ltCustomerListgt
ltcustomer id"1"gt ltfnamegt Jen lt/fnamegt
ltlnamegt Lo lt/lnamegt lttitlegt CEO lt/titlegt
ltcompanygt Blue Moon Enterprises lt/companygt
lt/customergt ltcustomer id"2"gt ltfnamegt
Austin lt/fnamegt ltlnamegt Powers lt/lnamegt
lttitlegt Gold Member lt/titlegt ltcompanygt
MiniEvil lt/companygt lt/customergt lt/CustomerListgt
6
Acronyms
  • DOM, SAX, DTD, XSL, XSLT, SOAP, UDDI,
  • X eXtensible
  • D Document
  • L Language
  • O Object
  • P Protocol
  • See
  • www.tek271.com/articles/acroStats/AcroStat.html

7
XMLs History
  • Derived from SGML (Standard Generalized Markup
    Language), that started in the 1960s
  • Specs published in Feb 1998
  • Began to get popular in 2000
  • Supported by most vendors and platforms
  • MS, IBM, Sun, Borland,
  • I.E. gt 5.0 can display XML data

8
Motivation
  • Businesses needed to communicate over the
    Internet. (B2B)
  • Send documents and complex data that have
    different formats
  • Word, PDF, Excel, Access, comma separated,
  • E.g. think how many ways a persons name can be
    formatted
  • Different Internet clients capabilities.
  • Desktops with different browsers
  • PDAs, Mobile phones,

9
Where/Who Uses XML
  • In databases to store or move data
  • In configuration files
  • In communication between systems
  • MS .NET, IE, SQL Server,
  • IBM donated their Java XML technologies to
    Apache
  • Sun Supports XML, Web Services,
  • I started using it at RR in 1998

10
To Use Or Not To Use
  • Use when you want to
  • Communicate between different programs and
    systems
  • Store complex configuration data
  • Display output by different clients, e.g.
    desktops and PDAs. Use XSLT
  • Do not use when
  • You need a relational database model, XML is less
    efficient than RDBs

11
XML Technologies
  • The following slides will introduce some XML
    related terms and technologies
  • This a high level definition
  • Some definitions are approximated for the sake of
    simplicity

12
Tags And Elements
  • Consider the following XML snippet
  • ltcustomer id"2"gt
  • ltfnamegt Austin lt/fnamegt
  • ltlnamegt Powers lt/lnamegt
  • lttitlegt Gold Member lt/titlegt
  • ltcompanygt MiniEvil lt/companygt
  • lt/customergt
  • ltfnamegt is a start tag
  • lt/fnamegt is an end tag
  • ltfnamegtAustinlt/fnamegt is an element
  • id (in customer tag) is an attribute

13
Well-Formed/Valid Documents
  • Well-Formed document
  • Follows XML syntax
  • Every start tag must have an end tag
  • If a document is not well-formed, then it is NOT
    an XML document
  • Valid document
  • Must be well-formed
  • Must follow a template (DTD) that specifies what
    elements and attributes can/must exist in the
    document

14
Documents Templates
  • Consider the following XML snippet
  • ltcustomer id"2"gt
  • ltfnamegt Austin lt/fnamegt
  • ltlnamegt Powers lt/lnamegt
  • ltcompanygt MiniEvil lt/companygt
  • ltbalancegt 1009 lt/balancegt
  • lt/customergt
  • A template will specify that customer element
  • Must have an id attribute that is an integer
  • Must contain an fname element that is a string
  • Can contain a balance element that is an integer

15
DTD And Schema
  • A standard was created for defining document
    templates Document Type Definition (DTD)
  • DTD has a confusing syntax and is not XML
  • In 2001 a new standard was created XML Schema
  • XML Schemas are well-formed XML documents
  • Schemas provide better control of the data types

16
XML Parsers
  • To parse is to classify a word or analyze a
    sentence in terms of grammar
  • A Parser is a program that reads source code of a
    language and recognizes each element of it
  • An XML parser reads the XML source, breaks it
    down into its elements, and allows another
    program to act on these elements

17
Processing XML
  • To process an XML document, you have several
    options
  • Write a program to parse and process (do it
    yourself)
  • Write a program using some libraries (DOM or SAX)
  • Write processing rules using XSLT

18
DOM Or SAX
  • Libraries to parse XML data
  • A Document Object Model (DOM) parser reads the
    whole source and converts it into a tree-like
    data structure
  • A Simple API for XML (SAX) parser reads the
    source and allows the programmer to act on each
    element as soon as it is recognized
  • DOM is easy to use, slow, and consumes memory
  • SAX is harder to use, fast, and consumes less
    memory

19
XSL And XSLT
  • Process XML data using rules.
  • The eXtensible Stylesheet Language (XSL) is used
    to format XML documents for display (e.g. in a
    browser)
  • The eXtensible Stylesheet Language Transformation
    (XSLT) allows converting XML documents into any
    other format including XML, HTML

20
SOAP
  • SOAP Simple Object Access Protocol
  • XML based standard
  • Allows calling methods, functions, or procedures
    on a remote computer
  • It works over the Internet
  • Uses HTTP
  • Can pass through a firewall
  • Allows inter-operability between different
    platforms, operating systems, and languages

21
Web Services
  • A standard for locating SOAP methods and
    determining how to use them automatically
  • Web Service Description Language (WSDL) A way to
    describe the remote methods name and parameters
  • Universal Description, Discovery and Integration
    Protocol (UDDI) A directory listing of different
    services (like yellow pages)
  • Web Service SOAP WSDL UDDI

22
Thats It with XML Technologies
23
Whats Next
  • To learn more about XML
  • www.xml.com
  • www.ibm.com/developer/xml/
  • www.xmlsoftware.com
  • msdn.microsoft.com/xml/
  • Book CodeNotes for XML
  • Start using it. You can use
  • VB, Java, .NET, C,
  • MS, IBM, and Sun provide free XML parsers and
    libraries

24
Examples
  • RTRErrorLog.xml Error log file.
  • RTRConfClient.xml A configuration file.
  • XSLT On-line example.

25
Feedback
  • Did this satisfy your expectations?
  • Any suggestions or comments?
  • What topics do you like to see in a next or
    advanced class? (e.g. XSLT, SOAP, )
Write a Comment
User Comments (0)
About PowerShow.com