XML Primer - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

XML Primer

Description:

DOCTYPE letter SYSTEM 'letter.dtd' addressbook contact type = 'from' ... Define an attribute type for an element #IMPLIED for system-given elements ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 13
Provided by: drewh6
Category:
Tags: xml | attribute | primer

less

Transcript and Presenter's Notes

Title: XML Primer


1
XML Primer
Dr. Drew Hwang Computer Information Systems Cal
Poly Pomona
2
What is XML?
  • Extensible Markup Language
  • A markup language and a language for creating
    markup language
  • Use customized tags to describe and manage data
    in specific applications
  • XML document displayable in HTML
  • A portable language

3
XML Applications
  • A replacement for EDI
  • Industry-specific MXL tags
  • Chemical Markup Language (CML)
  • Extensible Financial Reporting Markup Language
    (XFRML)
  • Synchronized Multimedia Interface Language (SMIL)
  • Product Data Markup Language (PDML)
  • XML Metadata Interchange Format (XMI) a
    combination of XML and UML

4
XML Elements
  • Case sensitive
  • Quotes mandatory
  • XML declaration (which version?)
  • XML DTD specification (which .dtd?)
  • Root element (container element)
  • Sub-element (children element)
  • .xml for XML .dtd for DTDs

5
XML Example I
  • lt?xml version "1.0"?gt
  • ltarticlegt
  • lttitlegtSimple XMLlt/titlegt
  • ltdategt3/3/2001lt/dategt
  • ltauthorgt
  • ltfnamegtDrewlt/fnamegt
  • ltlnamegtHwanglt/lnamegt
  • lt/authorgt
  • ltsummarygtXML Primerlt/summarygt
  • ltcontentgtXML is a language for structuring and
    managing data. It has been used as the de facto
    protocol for extranets.
  • lt/contentgt
  • lt/articlegt

6
XML Example II
  • lt?xml version "1.0"?gt
  • lt!DOCTYPE letter SYSTEM "letter.dtd"gt
  • ltaddressbookgt
  • ltcontact type "from"gt
  • ltnamegtBill Clintonlt/namegt
  • ltphonegt909-869-5289lt/phonegt
  • ltcategory id "School"/gt
  • lt/contactgt
  • ltcontact type "to"gt
  • ltnamegtGeorge Bushlt/namegt
  • ltphonegt909-869-1111lt/phonegt
  • ltcategory id "Work"/gt
  • lt/contactgt
  • lt/addressbookgt

7
DTDs
  • Document Type Definitions
  • Define grammatical rules for conformity
  • Use Extended Backus-Naur Form (EBNF) grammar for
    syntax
  • Not required but recommended

8
DTDs Elements
  • !ELEMENT
  • Specify an element
  • () for one or more instances
  • PCDATA for parsed character data element
  • EMPTY for elements without end tag
  • !ATTLIST
  • Define an attribute type for an element
  • IMPLIED for system-given elements
  • CDATA for string attribute

9
DTDs Example I
  • lt!ELEMENT addressbook (contact)gt
  • lt!ELEMENT contact (name, phone, category)gt
  • lt!ATTLIST contact type CDATA IMPLIEDgt
  • lt!ELEMENT name (PCDATA)gt
  • lt!ELEMENT phone (PCDATA)gt
  • lt!ELEMENT flag (EMPTY)gt
  • lt!ATTLIST flag id CDATA IMPLIEDgt

10
Using XML with HTML
  • XML specs as data source or data island
  • Use ltXMLgt tag and an ID as the parameter
  • DATASRC for data source binding
  • SPAN and DATAFLD for data publishing

11
XML in HTML Sample I
  • ltHTMLgtltBODYgt
  • ltXML ID sample_xml"gt
  • ltaddressbookgt
  • ltcontactgt
  • ltnamegtBill Clintonlt/namegt
  • ltphonegt909-869-5289lt/phonegt
  • lt/contactgt
  • ltcontactgt
  • ltnamegtGeorge Bushlt/namegt
  • ltphonegt909-869-1111lt/phonegt
  • lt/contactgt
  • lt/addressbookgt
  • lt/XMLgt

ltTABLE DATASRC"sample_xml"gt ltTHEADgtltTRgt
ltTHgtNAMElt/TDgt ltTHgtPHONElt/TDgt
lt/TRgtlt/THEADgt ltTRgt ltTDgtltSPAN DATAFLD
name"gtlt/SPANgtlt/TDgt ltTDgtltSPAN DATAFLD
phone"gtlt/SPANgtlt/TDgt lt/TRgt lt/TABLEgt lt/BODYgtlt/HT
MLgt
12
XML Parser
XML Document
XML Parser
XML Application
XML DTD (optional)
Write a Comment
User Comments (0)
About PowerShow.com