- Ali Kamandi
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 - - 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
- eXtensible Markup Language
Metalanguage - used to create other
languages
Has become a universal data-exchange
format
- <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>
- 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)
- 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>
!
<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
"
#$%
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
&
'()*+
Well-Formed:
Structure follows XML syntax rules
Valid:
Structure conforms to a DTD
,
<DT> <IMG SRC= "greenball.gif" > <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
- .+*/
- 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
- #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
- 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
- Consider an XML document:
<db><person><name>Alan</name> <age>42</age> <email>agb@usa.net </email> </person> <person>………</person> ………. </db>
- DTD for it might be:
<!DOCTYPE db [ <!ELEMENT db (person*)> <!ELEMENT person (name, age, email)> <!ELEMENT name (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT email (#PCDATA)> ]>
- 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)
- 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
"
#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>
&
#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>