Post on 21-Dec-2015
Comments from James
Good Morning!
Welcome on this beautiful morning to the presentation of Robert Kaminski and Thomas Panas about advanced XML.
Please feel free to ask any questions anytime. If possible, hand them to the presenters in
written form during the audio-virtual presentation in Dolby surround, so all
relevant questions can be evaluated in real-time. :)
All rights reserved. James
Is this Structured Data ?
<company>Microsoft</company>
Semi-structured DataSemi-structured Data“schemaless” or “self-describing”
Structured Data
<company>Microsoft</company>
<simpleType name=”company"> <restriction base="string"> <pattern value=”\w{20}"/> </restriction> </simpleType>
Is this Structured Data ?
<head>HTML</head><body>
Microsoft</body>
<complexType name=”Company"> <sequence>
<element name=”head" type="string" minOccurs="1"/> <element name=”body" type=”string" minOccurs="1"/></sequence>
</complexType>
A Syntax for Data
Structured Data Describe the structure (type, schema)
of the data Create an instance of the schema
Semi-structured Data Describe the data using a simple
syntax <company>Microsoft</company>
Non-structured Data Microsoft
XML+Schema
Lisp
Semi-Structured Data in Lisp
Association lists (label-value pairs) {name: “Alan”, tel: 21534323, email: “abg@abs.com}
Value as structure {name: {first: “Alan”, last: “White”}, tel: 21534323, email:
“abg@abs.com} Graph representation
name tel email
“Alan” 7786 “abg@abs.com”
Specifying a Syntax
Semi-Structures Data can be expressed as: <ssd-expr> ::= <value> <value> ::= atomicvalue | <complexvalue><complexvalue> ::= {label : <ssd-expr>, …, label : <ssd-
expr>}
Relational Databases
Is this semi-structured or structured data?
FirstName LastName Tel
Thomas Panas 123
Robert Kaminski 345
Student:
Semi-structured DataSemi-structured DataThe schema is included into the “data-file”
Object Databases: Tree
o2 o3o1
person person person
name name nameage age country
“Mary” 45 17“John” “Jane” “Canada”
relatives
Object Databases: Tree
o2 o3o1
person person person
name name nameage age country
“Mary” 45 17“John” “Jane” “Canada”
relatives
mother sister
child
child
mother
Object Databases
Semi-Structures Data can also be presented Lisp-like{ person: &o1{name: “Mary”, age: 45, child &o2, child &03}, person: &o2{name: “John”, age: 17, relatives: {mother: &o1,
sister &o3}}, person: &o3{name: “Jane”, country: “Canada”, mother &o1}}
Object Databases
Semi-Structures Data becomes Structuredclass State (extent states){
attribute string scode;attribute string sname;attribute City capital;relationship set<City> cities-in
inverse City::state-of;}
Structured Data for one Application Area ! (Object Databases)
Solution: XML
Problem description
Namespaces avoids name conflicts same tag for different things same tag for different format
Example:Document 1: <person>Robert Kaminski</person>Document 2: <person>Kaminski Robert</person>
Solution
First try
<Document1:person> Robert Kaminski </Document1:person>
Second try<www.ida.liu.se/pelab:person>
Robert</www.ida.liu.se/pelab:person>
Final solution<foo xmlns:doc=”www.ida.liu.se/pelab”>
<doc:person> Robert </doc:person>
Namespace example
<html:html xmlns:html=”...” xmlns:math=”...”>
<html:title> George Soros </html:title>
<html:h2> Counting ... </html:h2>
<math:reln>
.....
</math:reln>
</html:html>
Default namespace
<html xmlns=”...” xmlns:math=”...”>
<title> George Soros </title>
<h2> Counting ... </h2>
<math:reln>
.....
</math:reln>
</html>
Attribute name
Attributes can have namespace Example:
<myLink xmlns:xlink=”...”
xlink:type=”simple”
......
</myLink>
What is a Schema ?
A schema defines the content of a number of XML-documents
It defines which elements and attributes can be included the element content the order of elements
Schema substitutes DTD
Think of classes (schema) and instances (dokument)
XML Schema
Schema is saved with postfix .xsd A document is validated against a schema A schema is a XML-document
XSL
XSL consist of formatting objects XSL Transformations (XSLT)
Formatting object: specifies presentation
XSLT: Transformations to arbitrary format
The idea of XSLT: traverse the tree and apply a specific
template at each node
The XSLT language
Transformation in XML dialect Example:
<xsl:transform xmlns:xsl=”http://www.w3.org.”>
<!-- templates rules go here-->
</xsl:transform>
A rule based language Output handled by the enviroment
Terminology
Template rules consists of: pattern template
Pattern specifies nodes a template applies to tag name attributes context
Template defines the transformations
XML Example
<book>
<title> chicken soup </title>
<section>
<title> Introduction </title>
<para> I’ve always.. <para>
</section >
</book>
book
title section
title para
Template rule for book
<xsl:template match=”book”>
<body>
<h1> <xsl:value-of select=”title”/> </h1>
<xsl:apply-templates select=”section”></body>
</xsl:template>
Template rule for section
<xsl:template match=”section”>
<h2><xsl:value-of select=”title”/></h2>
<xsl:apply-template select=”para”/>
</xsl:template>
Formatting objects
Formatting represents common document elements
Example block external-graphic table simple-link
They are specified in XML Attributes specify their appearance
Template rule with objects
<xsl:template match=”section”>
<fo:block font-size=”12pt”>
<xsl:value-of select=”title”/>
</fo:block>
<xsl:apply-template select=”para”/>
</xsl:template>
SMIL
SMIL Synchronized Multimedia Integration Language SMIL is an XML extension used for multimedia presentations which integrate
streaming audio and video with images, text, etc. enables to specify what should be presented when
SMIL<smil> <head> </head>
<body> <par> <audio src="sound.rm"/> <seq> <textstream src="tobbe2.rt" region="videoregion"/> <par>
<textstream src="tobbe.rt" region="textregion"/> <video src="tobias.rm" region="videoregion"/>
</par> </seq> </par> </body>
</smil>