Ali Kamandi kamandi@ce.sharif.edu Fall 2007 Sharif University of - - PowerPoint PPT Presentation

ali kamandi kamandi ce sharif edu fall 2007 sharif
SMART_READER_LITE
LIVE PREVIEW

Ali Kamandi kamandi@ce.sharif.edu Fall 2007 Sharif University of - - PowerPoint PPT Presentation

Ali Kamandi kamandi@ce.sharif.edu Fall 2007 Sharif University of Technology e X tensible M arkup L anguage Metalanguage - used to create other languages Has become a universal data-exchange format


slide-1
SLIDE 1
  • Ali Kamandi

kamandi@ce.sharif.edu Fall 2007 Sharif University of Technology

slide-2
SLIDE 2
  • eXtensible Markup Language

Metalanguage - used to create other

languages

Has become a universal data-exchange

format

slide-3
SLIDE 3
  • <bibliography>

<paper ID= "object-fusion"> <authors> <author>Y.Papakonstantinou</author> <author>S. Abiteboul</author> <author>H. Garcia-Molina</author> </authors> <fullPaper source="fusion"/> <title>Object Fusion in Mediator Systems</title> <booktitle>VLDB 96</booktitle> </paper> </bibliography>

slide-4
SLIDE 4
  • Human-readable

Machine-readable (easy to parse) Standard format for data interchange Possible to validate Extensible

can represent any data can add new tags for new data formats

Hierarchical structure (nesting)

slide-5
SLIDE 5
  • element

element name Character content Element Content Empty Element

<bibliography> <paper ID="object-fusion"> <authors> <author>Y.Papakonstantinou</author> <author>S. Abiteboul</author> <author>H. Garcia-Molina</author> </authors> <fullPaper source="fusion"/> <title>Object Fusion in Mediator Systems</title> <booktitle>VLDB 96</booktitle> </paper> </bibliography>

slide-6
SLIDE 6

!

<bibliography> <paper ID="object-fusion"> <authors> <author>Y.Papakonstantinou</author> <author>S. Abiteboul</author> <author>H. Garcia-Molina</author> </authors> <fullPaper source="fusion"/> <title>Object Fusion in Mediator Systems</title> <booktitle>VLDB 96</booktitle> </paper> </bibliography>

Attribute name Attribute Value

slide-7
SLIDE 7

"

#$%

Tags properly nested Tag names case-sensitive All tags must be closed

  • r self-closing

<foo/> is the same as <foo></foo>

Attributes enclosed in quotes Document consists of a single (root) element

slide-8
SLIDE 8

&

'()*+

Well-Formed:

Structure follows XML syntax rules

Valid:

Structure conforms to a DTD

slide-9
SLIDE 9

,

<DT> <IMG SRC= "greenball.gif" >&nbsp; <A NAME="object-fusion"></A> Y.Papakonstantinou, S. Abiteboul, H. Garcia-Molina. <A HREF="http://www-cse.ucsd.edu/~yannis/papers/fusion.ps"> "ObjectFusion in Mediator Systems".</A> In <I>VLDB 96.</I> </DT>

  • HTML confuses presentation with content
  • No Explicit Structure, Semantics

Author Conference Title

  • .+*/
slide-10
SLIDE 10
  • Extensible set of tags

Content orientated Standard Data

infrastructure

Allows multiple output

forms

Fixed set of tags Presentation oriented No data validation

capabilities

Single presentation

XML HTML

slide-11
SLIDE 11
  • #1#1

XML Document Type Definitions (DTDs): XML Schema

defines structure and data types allows developers to build their own libraries of

interchanged data types

slide-12
SLIDE 12
  • An XML document may have an optional DTD.

A grammar for XML documents Defines

which elements can contain which other elements which attributes are allowed/required/permitted on

which elements

slide-13
SLIDE 13
  • Consider an XML document:

<db><person><name>Alan</name> <age>42</age> <email>agb@usa.net </email> </person> <person>………</person> ………. </db>

slide-14
SLIDE 14
  • DTD for it might be:

<!DOCTYPE db [ <!ELEMENT db (person*)> <!ELEMENT person (name, age, email)> <!ELEMENT name (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT email (#PCDATA)> ]>

slide-15
SLIDE 15
  • Occurrence Indicator:

Occurrence Indicator One or more Required, repeatable + None, one, or more Optional, repeatable * None or one Optional ? One and only

  • ne

Required (no indicator)

slide-16
SLIDE 16
  • 21

<!element book paper*> <!element paper (authors, fullPaper?, title, booktitle)> <!element authors author+> <!element author (#PCDATA)>

Character content Authors followed by

  • ptional fullpaper,

followed by title, followed by booktitle Sequence of 1 or more author Sequence of 0 or more paper

slide-17
SLIDE 17

"

#13%

<type name="Order" > <element name="name" type="string" /> <element name="street" type="string" /> <element name="zip" type="integer" /> <...> <attribute name="orderDate" type="date" /> </type>

slide-18
SLIDE 18

&

#13%

  • <type name="personName">

<element name="title" minOccurs="0"/> <element name="forename" minOccurs="0" maxOccurs="*"/> <element name="surname"/> </type> <type name="extendedName" source="personName" derivedBy="extension"> <element name="generation" minOccurs="0"/> </type> <type name="simpleName" source="personName" derivedBy="restriction"> <restrictions> <element name="title" maxOccurs=“1"/> <element name="forename" minOccurs="1" maxOccurs="1"/> </restrictions> </type>