SlideShare a Scribd company logo
Introduction to XML
Kristian Torp
Department of Computer Science
Aalborg University
people.cs.aau.dk/˜torp
torp@cs.aau.dk
November 3, 2015
daisy.aau.dk
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 1 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 2 / 42
Learning Goals
Goals
Know the basic differences between a table and an XML document
Know the different representations of an XML document
Know the basic parts of an XML document
Know the goals of designing XML
Know data centric from document centric
Be able to construct your own basic XML documents
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 3 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 4 / 42
Text Files, (a Dej´a Vu?)
Example (A Text File)
P4 OOP 3 Object−oriented programming
P2 DB 7 Databases including SQL
Open Questions
What does the columns mean?
When does white space matter?
What are the types of the columns?
Note
No metadata what so ever
Need additional information to parse the text file!
Could be a human looking at the file
Lowest common denominator a CSV file
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 5 / 42
A First Look
Example (Table Look)
Id Name Semester Desc
P4 OOP 3 Object-oriented programming
P2 DB 7 Databases including SQL
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 6 / 42
A First Look
Example (Table Look)
Id Name Semester Desc
P4 OOP 3 Object-oriented programming
P2 DB 7 Databases including SQL
Example (XML Look)
<?xml version=” 1.0 ” ?>
<!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ”>
<coursecatalog>
<course cid= ’P4 ’>
<name>OOP</name>
<semester>3</ semester>
<desc>Object−oriented programming</ desc>
</ course>
<course cid= ’P2 ’>
<name>DB</name>
<semester>7</ semester>
<desc>Databases including SQL</ desc>
</ course>
</ coursecatalog>
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 6 / 42
A Second Look
Example (XML Look (again))
<?xml version=” 1.0 ” ?>
<!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ”>
<coursecatalog>
<course cid= ’P4 ’>
<name>OOP</name>
<semester>3</ semester>
<desc>Object−oriented programming</ desc>
</ course>
<course cid= ’P2 ’>
<name>DB</name>
<semester>7</ semester>
<desc>Databases including SQL</ desc>
</ course>
</ coursecatalog>
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 7 / 42
A Second Look
Example (XML Look (again))
<?xml version=” 1.0 ” ?>
<!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ”>
<coursecatalog>
<course cid= ’P4 ’>
<name>OOP</name>
<semester>3</ semester>
<desc>Object−oriented programming</ desc>
</ course>
<course cid= ’P2 ’>
<name>DB</name>
<semester>7</ semester>
<desc>Databases including SQL</ desc>
</ course>
</ coursecatalog>
Example (Tree Look)
/coursecatalog
course
id=4 name:OOP sem:3 dsc
course
id=2 name:DB sem:7 dsc
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 7 / 42
Something Well Known?
Example (XHTML)
<?xml version=” 1.0 ” encoding=”UTF−8” ?>
<!DOCTYPE html PUBLIC ” −//W3C/ / DTD XHTML 1.0 T r a n s i t i o n a l / / EN”
” h t t p : / /www.w3. org /TR/ xhtml1 /DTD/ xhtml1−t r a n s i t i o n a l . dtd ”>
<html xmlns=” h t t p : / /www.w3. org /1999/ xhtml ”>
<head>
< t i t l e >A Simple XHTML Document</ t i t l e >
</ head>
<body>
<p>Hello XHTML!</ p>
</ body>
</ html>
[Source: examples/xhtml_simple.xhtml]
XHTML versus HTML
XHTML is a cleaned-up version of HTML
Looks a lot like HTML
Much stricter requirements to XHTML than to HTML
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 8 / 42
Data versus Document Centric
Example (Data Centric)
<rows>
<row>
<name>Hans</name>
<address>Denmark</ address>
</ row>
<row>
<name>Marge</name>
<address>Sweden</ address>
</ row>
</ rows>
Example (Document Centric)
< l y r i c >
Is i t getting < i t >better</ i t >?
Or do you f e e l the same?
W i l l i t make i t easier on you now?
You got someone to <em>blame</em>
You say
One love
One l i f e
</ l y r i c >
Data Centric
Database table like
Content in leafs
Inflexible, but simple
Document Centric
Free format (almost)
Mixed content
Flexible, but complex
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 9 / 42
Goals of XML
Goals
XML shall be straight forwardly usable over the Internet
XML shall support a wide variety of applications
XML shall be compatible with SGML
SGML = Standard Generalized Markup Language
Easy to write programs which process XML documents
Keep the number of optional features low (0)
XML documents should be reasonably clear
The XML design should be prepared quickly
The design of XML shall be formal and concise
XML documents shall be easy to create
[Source: www.w3.org/TR/REC-xml/]
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 10 / 42
XML Family of Products
Products
Core
The basic XML recommendation
Add-ons
DTD, XML Namespace, XPath, XLink, XPointer, XQuery, etc.
Focus on layout
CSS, XSLT, and XSL-FO
XML Applications
XHTML, DocBook, SVG, XForms, etc.
XML Applications
Web Content Syndication: RSS (www.rssboard.org)
Education: SCORM for teaching material (www.scorm.com)
Document metadata: Dublin Core (www.dublincore.org)
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 11 / 42
Summary: Introduction
Main Points
An XML document compared to a text file
More readable (without help)
More complicated to handle (if you are familiar with content)
Higher space usage
Data and metadata embedded in the same document
Markup and content clearly separated
An XML document can be represented in two ways
Textual structure
Tree structure
The goals of the XML design were made in an Internet age!
There is a very large set of XML technologies and applications
Note
XML and databases are not competing technologies
XML is not a replacement of HTML
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 12 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 13 / 42
Main Parts of an XML Document
Concepts
Document prolog
Elements
A root
Attributes
Entities
Example (XML Document)
<?xml version=” 1.0 ” encoding=”UTF−8” ?>
<!DOCTYPE coursecatalog
SYSTEM ” coursecatalog . dtd ” [
<!ENTITY prg ” programming ”>
<! ENTITY sql ”SQL”> ]>
<coursecatalog>
<course id=”P4”>
<name>OOP</name>
<semester>3</ semester>
<desc>Object−oriented &prg ;</ desc>
</ course>
<course id=”P2”>
<name>DB</name>
<semester>7</ semester>
<desc>Databases including &sql ;</ desc>
</ course>
</ coursecatalog>
Note
Elements more flexible than attributes
XML supports UTF out-of-the box
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 14 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 15 / 42
Document Prolog
Example
<?xml version=” 1.0 ” ?>
<!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ”>
<coursecatalog>
Consists of
Version number and text encoding
Document type definition declaration
Instruction to the XML processor
Root element of the XML document
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 16 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 17 / 42
Elements
Example
Start tag <state> or <course>
State tag with attributes <state id=”1” abbr=”GA”>
End tag </state>
Element with content <state>Georgia</state>
Empty element <state/>
Empty element with attributes <state id=”1” abbr=”GA”/>
Case matters <state> <State> <STaTE>
Consists of
Start tag
Some content called character data
End tag
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 18 / 42
Elements, cont.
Rules
Start tag must be before end tag
An elements start and end tag must have the same parent
Wrong: <state><city></state></city>
Right: <state><city></city></state>
Content
Simple <outer><one>stuff</one></outer>
Mixed content <outer>More <one>stuff</one></outer>
Tag versus Element
<msg>Hello World</msg>
Element: <msg>Hello World</msg>
Tag: msg
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 19 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 20 / 42
Attributes
Example
<state id=”1” abbr=”GA”>
<country id=”DK”date=”2006−02−01”>
Consists of
Name/value pairs
Note
Attributes cannot stand alone
Only start tags can have attributes
There can be any number of attributes
Attribute names must be unique <state id=”GA”id=”GE”>
Attribute values must be in quotes <state id=GA>
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 21 / 42
Elements versus Attributes
Example (Elements versus Attributes)
<box height=” 20 ”
width=” 20 ”
depth=” 30 ”
u n i t =”cm”>
<content>S t u f f</ content>
</ box>
<box>
<height>
<scalar>20</ scalar>
<u n i t>cm</ u n i t>
</ height>
<width>
<scalar>20</ scalar>
<u n i t>cm</ u n i t>
</ width>
<depth>
<scalar>30</ scalar>
<u n i t>cm</ u n i t>
</ depth>
<content>S t u f f</ content>
</ box>
Note
Attributes can always be converted to elements
Elements can sometimes be converted to attributes
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 22 / 42
Elements versus Attributes, cont.
Example (Elements versus Attributes)
<box>
<height>
<scalar>20</ scalar>
<u n i t>cm</ u n i t>
</ height>
<width>
<scalar>20</ scalar>
<u n i t>cm</ u n i t>
</ width>
<depth>
<scalar>30</ scalar>
<u n i t>cm</ u n i t>
</ depth>
<content>S t u f f</ content>
</ box>
<box>
<height u n i t =”cm”>20</ height>
<width u n i t =”cm”>20</ width>
<depth u n i t =”cm”>30</ depth>
<content>S t u f f</ content>
</ box>
Note
Attributes good for identify, units and so on
Elements good if variable number of “stuff”
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 23 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 24 / 42
Entities
Example
<! ENTITY company ”XML Lovers Inc.”>
<! ENTITY sql ”SQL”>
Purpose
To make XML document easier to maintain
Recurring text
Are place holders for content (abbreviations)
Types
Parameter entities used in DTD
General entities used in the XML document itself
There are a lot of details about entities!
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 25 / 42
Using Entities
Example
<?xml version=” 1.0 ” encoding=”UTF−8” ?>
<!DOCTYPE coursecatalog
SYSTEM ” coursecatalog . dtd ” [
<!ENTITY prg ” programming ”>
<! ENTITY sql ”SQL”> ]>
<coursecatalog>
<course id=”P4”>
<name>OOP</name>
<semester>3</ semester>
<desc>Object−oriented &prg ;</ desc>
</ course>
<course id=”P2”>
<name>DB</name>
<semester>7</ semester>
<desc>Databases including &sql ;</ desc>
</ course>
</ coursecatalog>
[Source: examples/coursecatalog_with_entity.xml]
Note
The entities prg and sql
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 26 / 42
More Entity Examples
Entity Types
Predefined character entities amp = & gt = >
Usage: <msg>Hello &amp; and &gt;</msg>
Numbered character entities #145 = æ
Usage: <msg>This is a Danish letter &#145;</msg>
External entities definition is in another file
Internal entities
Unparsed entity <!ENTITY logo SYSTEM ”logo.gif”NDATA gif>
Note
There are a lot of details about entities!
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 27 / 42
Various Comments on XML Documents
Comments
Are always in UTF
Whitespace is preserved (not the case in HTML)
Carriage return and line feed converted to line feed
Weird when used to MS Windows
This is a comment <!−−a comment in XML −−>
Example (Comments in XML)
<?xml version=” 1.0 ”>
<doc>
<!−− A comment −−>
<row> </ row>
<row> <!−− Another comment −−> </ row>
</ doc>
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 28 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 29 / 42
First Design
Example (1-n Relationship)
<order −db>
<orders>
<order id=” 117 ”>
<customer−name>Ann</ customer−name>
</ order>
<order id=” 341 ”>
<customer−name>Jim</ customer−name>
</ order>
</ orders>
<orderlines>
<o r d e r l i n e id=” 117 ” line −no=” 1 ”>
<description>pizza</ description>
<quantity>1</ quantity>
<price −each>10.50</ price −each>
</ o r d e r l i n e>
</ orderlines>
</ order −db>
Note
Too much first normal form, does not use tree hierarchy
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 30 / 42
Second Design
Example (1-n Relationship)
<order −db>
<orders>
<order id=”O117”>
<customer−name>Ann</ customer−name>
<orderlines>
<o r d e r l i n e line −no=” 1 ”>
<description>pizza</ description>
<quantity>1</ quantity>
<price −each>10.50</ price −each>
</ o r d e r l i n e>
</ orderlines>
</ order>
<order id=”O341”>
<customer−name>Jim</ customer−name>
</ order>
</ orders>
</ order −db>
Note
All information related to single order is stored together
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 31 / 42
Summary: Anatomy
Main Points
Elements
One is the root
Attribute
Limited set
Entities
Similar to a macro
There are many details
The prolog
Note
In doubt element or attribute? Pick element
Remember good comments, for humans!
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 32 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 33 / 42
Non Well-Formed XML Document
Example (Missing Root)
<course id=”P4”>
<name>OOP</name>
<semester>3</ semester>
<desc>Object−oriented Prog .</ desc>
</ course>
<course id=”P2”>
<name>DB</name>
<semester>7</ semester>
<desc>Databases including SQL</ desc>
</ course>
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 34 / 42
Non Well-Formed XML Document
Example (Missing Root)
<course id=”P4”>
<name>OOP</name>
<semester>3</ semester>
<desc>Object−oriented Prog .</ desc>
</ course>
<course id=”P2”>
<name>DB</name>
<semester>7</ semester>
<desc>Databases including SQL</ desc>
</ course>
Example (Nesting Wrong)
<person ssn=” 43 ”>
<name>< f i r s t >James</ f i r s t > <l a s t>Bond</name></ l a s t>
<job>agent</ job>
</ person>
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 34 / 42
Non Well-Formed XML Document
Example (Missing Root)
<course id=”P4”>
<name>OOP</name>
<semester>3</ semester>
<desc>Object−oriented Prog .</ desc>
</ course>
<course id=”P2”>
<name>DB</name>
<semester>7</ semester>
<desc>Databases including SQL</ desc>
</ course>
Example (Nesting Wrong)
<person ssn=” 43 ”>
<name>< f i r s t >James</ f i r s t > <l a s t>Bond</name></ l a s t>
<job>agent</ job>
</ person>
Example (Missing Quotes)
<person ssn=43>
<name> . . . </name>
</ person>
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 34 / 42
Well-Formed XML and Valid Document
Well-Formed XML Document
All XML elements must have a closing tag
Empty elements are allow
Tags must be properly nested
Start and end tag must have the same parent
The XML document must have a root tag
Attribute values must be quoted
Valid XML Document
Is well-formed
Adheres to the rules of the specified DTD or XML Schema
Similar to a schema for a table, e.g., types and integrity constraints
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 35 / 42
Well-Formed and Valid
XML Documents
Well-Formed XML Documents
Valid XML Documents
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 36 / 42
Summary: Well-Formed and Valid
Main Points
Well-formed XML document
Structure must adhere to certain rules
Valid XML document
Types and constraints must match a schema (DTD or XML Schema)
Not covered in this lecture, more to come later
Note
Tools check if documents are well-form and valid
The well-formedness is a huge plus over “flat” files
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 37 / 42
Outline
1 Introduction
2 Anatomy of an XML Document
Document Prolog
Elements
Attributes
Entities
Complete XML Document
3 Well-Formed and Valid XML Documents
4 Summary
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 38 / 42
Why XML?
Many Good Reasons
Open
Specifications available to all
Platform neutral
Runs on Apple, Linux, Unix, Windows, . . .
Vendor neutral
Competition among vendors
Standard
Changes done in open forums
Note
XML has support for checking structure/types/integrity constraints
DTD and XML Schema
XML has support for querying text documents
XPath and XQuery
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 39 / 42
Data vs. Document Centric
Data Centric
Database designer
Does not use document order
Only content at leaf level
Simple
Rigid
Example: Extract RDBMS
Document Centric
Text author
Document order, e.g., for
chapters figure no
Mixed content
Complex
Flexible
Examples: DocBook, XHTML
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 40 / 42
XML vs. DBMS
RDBMS
Structured data
Unordered
Flat information
Native format
Very compact format
SQL
Fine-grained modifications
Bad data exchange
Integrity via SQL DDL
Supports data types
Extreme data volumes
XML
Structured and unstructured
Ordered
Hierarchical information
Standard format
Very verbose format
XPath and XQuery
Coarse-grained modifications
Excellent data exchange
Integrity via XML Schema (DTD)
Supports data types
Large data volumes
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 41 / 42
Additional Information
Web Sites
W3C Schools free online tutorials www.w3schools.com.
Quite good for getting an overview of the various XML technologies.
Interactive XML Tutorials www.xmlzoo.net.
Covers several parts of XML
The Annotated XML 1.0 Specification
www.xml.com/axml/testaxml.htm.
The XML 1.0 specification with a lot of comments.
W3C XML recommendations www.w3.org.
The place to go if you want all the details.
Altova’s home page (maker of XMLSpy) www.altova.com. If you are
looking for a good XML tool.
IBM developerWorks overview “New to XML”
www.ibm.com/developerworks/xml/newto/
Many links to additional information.
Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 42 / 42
Ad

More Related Content

What's hot (20)

XML
XMLXML
XML
Daminda Herath
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Fazli Kabashi
 
Xml
XmlXml
Xml
Venkat Krishnan
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Vijay Mishra
 
Intro xml
Intro xmlIntro xml
Intro xml
sana mateen
 
Extensible Markup Language (XML)
Extensible Markup Language (XML)Extensible Markup Language (XML)
Extensible Markup Language (XML)
AakankshaR
 
XML Introduction
XML IntroductionXML Introduction
XML Introduction
Marco Bresciani
 
XML
XMLXML
XML
Mukesh Tekwani
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Prabu U
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
Gtu Booker
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
Baskarkncet
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
BG Java EE Course
 
XML
XMLXML
XML
Avanitrambadiya
 
Markup Languages
Markup Languages Markup Languages
Markup Languages
Senthil Kanth
 
XML
XMLXML
XML
Vahideh Zarea Gavgani
 
Fergus Fahey - DRI/ARA(I) Training: Introduction to EAD - Introduction to XML
Fergus Fahey - DRI/ARA(I) Training: Introduction to EAD - Introduction to XMLFergus Fahey - DRI/ARA(I) Training: Introduction to EAD - Introduction to XML
Fergus Fahey - DRI/ARA(I) Training: Introduction to EAD - Introduction to XML
dri_ireland
 
Xml and xml processor
Xml and xml processorXml and xml processor
Xml and xml processor
Himanshu Soni
 
XML
XMLXML
XML
Prabu U
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
Umar Ali
 
DTD
DTDDTD
DTD
Kamal Acharya
 

Viewers also liked (20)

Xml databases
Xml databasesXml databases
Xml databases
Srinivasan R
 
XML In My Database!
XML In My Database!XML In My Database!
XML In My Database!
Denise McInerney
 
Integrating Lucene into a Transactional XML Database
Integrating Lucene into a Transactional XML DatabaseIntegrating Lucene into a Transactional XML Database
Integrating Lucene into a Transactional XML Database
lucenerevolution
 
XML on SQL Server
XML on SQL ServerXML on SQL Server
XML on SQL Server
torp42
 
Relational Database Schema for MPEG 7 Visual Descriptors by Florian
Relational Database Schema for MPEG 7 Visual Descriptors by FlorianRelational Database Schema for MPEG 7 Visual Descriptors by Florian
Relational Database Schema for MPEG 7 Visual Descriptors by Florian
Multimedia and Vision Laboratory at Universidad del Valle
 
Encoding survey
Encoding surveyEncoding survey
Encoding survey
Rajeev Raman
 
Comparing the Multimodal Interaction Technique Design of MINT with NiMMiT
Comparing the Multimodal Interaction Technique Design of MINT with NiMMiTComparing the Multimodal Interaction Technique Design of MINT with NiMMiT
Comparing the Multimodal Interaction Technique Design of MINT with NiMMiT
Sebastian Feuerstack
 
Lca seminar modified
Lca seminar modifiedLca seminar modified
Lca seminar modified
Inbok Lee
 
Gesture-aware remote controls: guidelines and interaction techniques
Gesture-aware remote controls: guidelines and interaction techniquesGesture-aware remote controls: guidelines and interaction techniques
Gesture-aware remote controls: guidelines and interaction techniques
Dong-Bach Vo
 
Algorithms and Data Structures~hmftj
Algorithms and Data Structures~hmftjAlgorithms and Data Structures~hmftj
Algorithms and Data Structures~hmftj
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Xml dtd
Xml dtdXml dtd
Xml dtd
sana mateen
 
[DL Hacks輪読] Semi-Supervised Learning with Ladder Networks (NIPS2015)
[DL Hacks輪読] Semi-Supervised Learning with Ladder Networks (NIPS2015)[DL Hacks輪読] Semi-Supervised Learning with Ladder Networks (NIPS2015)
[DL Hacks輪読] Semi-Supervised Learning with Ladder Networks (NIPS2015)
Yusuke Iwasawa
 
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...
go_oh
 
The system development life cycle (SDLC)
The system development life cycle (SDLC)The system development life cycle (SDLC)
The system development life cycle (SDLC)
gourav kottawar
 
Masterizing php data structure 102
Masterizing php data structure 102Masterizing php data structure 102
Masterizing php data structure 102
Patrick Allaert
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with Phing
Michiel Rook
 
Semi supervised learning
Semi supervised learningSemi supervised learning
Semi supervised learning
Ahmed Taha
 
Extending Word2Vec for Performance and Semi-Supervised Learning-(Michael Mala...
Extending Word2Vec for Performance and Semi-Supervised Learning-(Michael Mala...Extending Word2Vec for Performance and Semi-Supervised Learning-(Michael Mala...
Extending Word2Vec for Performance and Semi-Supervised Learning-(Michael Mala...
Spark Summit
 
System Development Life Cycle (SDLC) - Part II
System Development Life Cycle (SDLC) - Part IISystem Development Life Cycle (SDLC) - Part II
System Development Life Cycle (SDLC) - Part II
Emertxe Information Technologies Pvt Ltd
 
PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)
Nikita Popov
 
Integrating Lucene into a Transactional XML Database
Integrating Lucene into a Transactional XML DatabaseIntegrating Lucene into a Transactional XML Database
Integrating Lucene into a Transactional XML Database
lucenerevolution
 
XML on SQL Server
XML on SQL ServerXML on SQL Server
XML on SQL Server
torp42
 
Comparing the Multimodal Interaction Technique Design of MINT with NiMMiT
Comparing the Multimodal Interaction Technique Design of MINT with NiMMiTComparing the Multimodal Interaction Technique Design of MINT with NiMMiT
Comparing the Multimodal Interaction Technique Design of MINT with NiMMiT
Sebastian Feuerstack
 
Lca seminar modified
Lca seminar modifiedLca seminar modified
Lca seminar modified
Inbok Lee
 
Gesture-aware remote controls: guidelines and interaction techniques
Gesture-aware remote controls: guidelines and interaction techniquesGesture-aware remote controls: guidelines and interaction techniques
Gesture-aware remote controls: guidelines and interaction techniques
Dong-Bach Vo
 
[DL Hacks輪読] Semi-Supervised Learning with Ladder Networks (NIPS2015)
[DL Hacks輪読] Semi-Supervised Learning with Ladder Networks (NIPS2015)[DL Hacks輪読] Semi-Supervised Learning with Ladder Networks (NIPS2015)
[DL Hacks輪読] Semi-Supervised Learning with Ladder Networks (NIPS2015)
Yusuke Iwasawa
 
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...
go_oh
 
The system development life cycle (SDLC)
The system development life cycle (SDLC)The system development life cycle (SDLC)
The system development life cycle (SDLC)
gourav kottawar
 
Masterizing php data structure 102
Masterizing php data structure 102Masterizing php data structure 102
Masterizing php data structure 102
Patrick Allaert
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with Phing
Michiel Rook
 
Semi supervised learning
Semi supervised learningSemi supervised learning
Semi supervised learning
Ahmed Taha
 
Extending Word2Vec for Performance and Semi-Supervised Learning-(Michael Mala...
Extending Word2Vec for Performance and Semi-Supervised Learning-(Michael Mala...Extending Word2Vec for Performance and Semi-Supervised Learning-(Michael Mala...
Extending Word2Vec for Performance and Semi-Supervised Learning-(Michael Mala...
Spark Summit
 
PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)
Nikita Popov
 
Ad

Similar to Introduction to XML and Databases (20)

Introduction to DTD
Introduction to DTDIntroduction to DTD
Introduction to DTD
torp42
 
Introduction to XPath
Introduction to XPathIntroduction to XPath
Introduction to XPath
torp42
 
SQL/XML on Oracle
SQL/XML on OracleSQL/XML on Oracle
SQL/XML on Oracle
torp42
 
programming with xml for graduate students
programming with xml for graduate studentsprogramming with xml for graduate students
programming with xml for graduate students
RameshPrasadBhatta2
 
Unit-III_JQuery.pptx engineering subject for third year students
Unit-III_JQuery.pptx engineering subject for third year studentsUnit-III_JQuery.pptx engineering subject for third year students
Unit-III_JQuery.pptx engineering subject for third year students
MARasheed3
 
Data interchange integration, HTML XML Biological XML DTD
Data interchange integration, HTML XML Biological XML DTDData interchange integration, HTML XML Biological XML DTD
Data interchange integration, HTML XML Biological XML DTD
AnushaMahmood
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
Dr.Saranya K.G
 
XML.pptx
XML.pptxXML.pptx
XML.pptx
2022bcaaidsaman11164
 
Decoding and developing the online finding aid
Decoding and developing the online finding aidDecoding and developing the online finding aid
Decoding and developing the online finding aid
kgerber
 
Xml Lecture Notes
Xml Lecture NotesXml Lecture Notes
Xml Lecture Notes
Santhiya Grace
 
Internet_Technology_UNIT V- Introduction to XML.pptx
Internet_Technology_UNIT V- Introduction to XML.pptxInternet_Technology_UNIT V- Introduction to XML.pptx
Internet_Technology_UNIT V- Introduction to XML.pptx
shilpar780389
 
IPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriya
IPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriyaIPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriya
IPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriya
VijiPriya Jeyamani
 
Xml iet 2015
Xml iet 2015Xml iet 2015
Xml iet 2015
kiransurariya
 
Intro XML for archivists (2011)
Intro XML for archivists (2011)Intro XML for archivists (2011)
Intro XML for archivists (2011)
Jane Stevenson
 
Xml
XmlXml
Xml
Anas Sa
 
Xml Overview
Xml OverviewXml Overview
Xml Overview
kevinreiss
 
Xml11
Xml11Xml11
Xml11
Sudharsan S
 
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1
Sudharsan S
 
23xml
23xml23xml
23xml
Adil Jafri
 
Xml
XmlXml
Xml
sudhakar mandal
 
Introduction to DTD
Introduction to DTDIntroduction to DTD
Introduction to DTD
torp42
 
Introduction to XPath
Introduction to XPathIntroduction to XPath
Introduction to XPath
torp42
 
SQL/XML on Oracle
SQL/XML on OracleSQL/XML on Oracle
SQL/XML on Oracle
torp42
 
programming with xml for graduate students
programming with xml for graduate studentsprogramming with xml for graduate students
programming with xml for graduate students
RameshPrasadBhatta2
 
Unit-III_JQuery.pptx engineering subject for third year students
Unit-III_JQuery.pptx engineering subject for third year studentsUnit-III_JQuery.pptx engineering subject for third year students
Unit-III_JQuery.pptx engineering subject for third year students
MARasheed3
 
Data interchange integration, HTML XML Biological XML DTD
Data interchange integration, HTML XML Biological XML DTDData interchange integration, HTML XML Biological XML DTD
Data interchange integration, HTML XML Biological XML DTD
AnushaMahmood
 
Decoding and developing the online finding aid
Decoding and developing the online finding aidDecoding and developing the online finding aid
Decoding and developing the online finding aid
kgerber
 
Internet_Technology_UNIT V- Introduction to XML.pptx
Internet_Technology_UNIT V- Introduction to XML.pptxInternet_Technology_UNIT V- Introduction to XML.pptx
Internet_Technology_UNIT V- Introduction to XML.pptx
shilpar780389
 
IPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriya
IPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriyaIPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriya
IPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriya
VijiPriya Jeyamani
 
Intro XML for archivists (2011)
Intro XML for archivists (2011)Intro XML for archivists (2011)
Intro XML for archivists (2011)
Jane Stevenson
 
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1
Sudharsan S
 
Ad

More from torp42 (6)

The DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQLThe DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
torp42
 
Spatial Indexing
Spatial IndexingSpatial Indexing
Spatial Indexing
torp42
 
Entity-Relationship Diagrams ERD
Entity-Relationship Diagrams ERDEntity-Relationship Diagrams ERD
Entity-Relationship Diagrams ERD
torp42
 
Temporal Databases: Data Models
Temporal Databases: Data ModelsTemporal Databases: Data Models
Temporal Databases: Data Models
torp42
 
Temporal Databases: Modifications
Temporal Databases: ModificationsTemporal Databases: Modifications
Temporal Databases: Modifications
torp42
 
Temporal Databases: Queries
Temporal Databases: QueriesTemporal Databases: Queries
Temporal Databases: Queries
torp42
 
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQLThe DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
torp42
 
Spatial Indexing
Spatial IndexingSpatial Indexing
Spatial Indexing
torp42
 
Entity-Relationship Diagrams ERD
Entity-Relationship Diagrams ERDEntity-Relationship Diagrams ERD
Entity-Relationship Diagrams ERD
torp42
 
Temporal Databases: Data Models
Temporal Databases: Data ModelsTemporal Databases: Data Models
Temporal Databases: Data Models
torp42
 
Temporal Databases: Modifications
Temporal Databases: ModificationsTemporal Databases: Modifications
Temporal Databases: Modifications
torp42
 
Temporal Databases: Queries
Temporal Databases: QueriesTemporal Databases: Queries
Temporal Databases: Queries
torp42
 

Recently uploaded (20)

Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
CSUC - Consorci de Serveis Universitaris de Catalunya
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 

Introduction to XML and Databases

  • 1. Introduction to XML Kristian Torp Department of Computer Science Aalborg University people.cs.aau.dk/˜torp torp@cs.aau.dk November 3, 2015 daisy.aau.dk Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 1 / 42
  • 2. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 2 / 42
  • 3. Learning Goals Goals Know the basic differences between a table and an XML document Know the different representations of an XML document Know the basic parts of an XML document Know the goals of designing XML Know data centric from document centric Be able to construct your own basic XML documents Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 3 / 42
  • 4. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 4 / 42
  • 5. Text Files, (a Dej´a Vu?) Example (A Text File) P4 OOP 3 Object−oriented programming P2 DB 7 Databases including SQL Open Questions What does the columns mean? When does white space matter? What are the types of the columns? Note No metadata what so ever Need additional information to parse the text file! Could be a human looking at the file Lowest common denominator a CSV file Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 5 / 42
  • 6. A First Look Example (Table Look) Id Name Semester Desc P4 OOP 3 Object-oriented programming P2 DB 7 Databases including SQL Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 6 / 42
  • 7. A First Look Example (Table Look) Id Name Semester Desc P4 OOP 3 Object-oriented programming P2 DB 7 Databases including SQL Example (XML Look) <?xml version=” 1.0 ” ?> <!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ”> <coursecatalog> <course cid= ’P4 ’> <name>OOP</name> <semester>3</ semester> <desc>Object−oriented programming</ desc> </ course> <course cid= ’P2 ’> <name>DB</name> <semester>7</ semester> <desc>Databases including SQL</ desc> </ course> </ coursecatalog> Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 6 / 42
  • 8. A Second Look Example (XML Look (again)) <?xml version=” 1.0 ” ?> <!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ”> <coursecatalog> <course cid= ’P4 ’> <name>OOP</name> <semester>3</ semester> <desc>Object−oriented programming</ desc> </ course> <course cid= ’P2 ’> <name>DB</name> <semester>7</ semester> <desc>Databases including SQL</ desc> </ course> </ coursecatalog> Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 7 / 42
  • 9. A Second Look Example (XML Look (again)) <?xml version=” 1.0 ” ?> <!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ”> <coursecatalog> <course cid= ’P4 ’> <name>OOP</name> <semester>3</ semester> <desc>Object−oriented programming</ desc> </ course> <course cid= ’P2 ’> <name>DB</name> <semester>7</ semester> <desc>Databases including SQL</ desc> </ course> </ coursecatalog> Example (Tree Look) /coursecatalog course id=4 name:OOP sem:3 dsc course id=2 name:DB sem:7 dsc Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 7 / 42
  • 10. Something Well Known? Example (XHTML) <?xml version=” 1.0 ” encoding=”UTF−8” ?> <!DOCTYPE html PUBLIC ” −//W3C/ / DTD XHTML 1.0 T r a n s i t i o n a l / / EN” ” h t t p : / /www.w3. org /TR/ xhtml1 /DTD/ xhtml1−t r a n s i t i o n a l . dtd ”> <html xmlns=” h t t p : / /www.w3. org /1999/ xhtml ”> <head> < t i t l e >A Simple XHTML Document</ t i t l e > </ head> <body> <p>Hello XHTML!</ p> </ body> </ html> [Source: examples/xhtml_simple.xhtml] XHTML versus HTML XHTML is a cleaned-up version of HTML Looks a lot like HTML Much stricter requirements to XHTML than to HTML Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 8 / 42
  • 11. Data versus Document Centric Example (Data Centric) <rows> <row> <name>Hans</name> <address>Denmark</ address> </ row> <row> <name>Marge</name> <address>Sweden</ address> </ row> </ rows> Example (Document Centric) < l y r i c > Is i t getting < i t >better</ i t >? Or do you f e e l the same? W i l l i t make i t easier on you now? You got someone to <em>blame</em> You say One love One l i f e </ l y r i c > Data Centric Database table like Content in leafs Inflexible, but simple Document Centric Free format (almost) Mixed content Flexible, but complex Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 9 / 42
  • 12. Goals of XML Goals XML shall be straight forwardly usable over the Internet XML shall support a wide variety of applications XML shall be compatible with SGML SGML = Standard Generalized Markup Language Easy to write programs which process XML documents Keep the number of optional features low (0) XML documents should be reasonably clear The XML design should be prepared quickly The design of XML shall be formal and concise XML documents shall be easy to create [Source: www.w3.org/TR/REC-xml/] Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 10 / 42
  • 13. XML Family of Products Products Core The basic XML recommendation Add-ons DTD, XML Namespace, XPath, XLink, XPointer, XQuery, etc. Focus on layout CSS, XSLT, and XSL-FO XML Applications XHTML, DocBook, SVG, XForms, etc. XML Applications Web Content Syndication: RSS (www.rssboard.org) Education: SCORM for teaching material (www.scorm.com) Document metadata: Dublin Core (www.dublincore.org) Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 11 / 42
  • 14. Summary: Introduction Main Points An XML document compared to a text file More readable (without help) More complicated to handle (if you are familiar with content) Higher space usage Data and metadata embedded in the same document Markup and content clearly separated An XML document can be represented in two ways Textual structure Tree structure The goals of the XML design were made in an Internet age! There is a very large set of XML technologies and applications Note XML and databases are not competing technologies XML is not a replacement of HTML Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 12 / 42
  • 15. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 13 / 42
  • 16. Main Parts of an XML Document Concepts Document prolog Elements A root Attributes Entities Example (XML Document) <?xml version=” 1.0 ” encoding=”UTF−8” ?> <!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ” [ <!ENTITY prg ” programming ”> <! ENTITY sql ”SQL”> ]> <coursecatalog> <course id=”P4”> <name>OOP</name> <semester>3</ semester> <desc>Object−oriented &prg ;</ desc> </ course> <course id=”P2”> <name>DB</name> <semester>7</ semester> <desc>Databases including &sql ;</ desc> </ course> </ coursecatalog> Note Elements more flexible than attributes XML supports UTF out-of-the box Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 14 / 42
  • 17. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 15 / 42
  • 18. Document Prolog Example <?xml version=” 1.0 ” ?> <!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ”> <coursecatalog> Consists of Version number and text encoding Document type definition declaration Instruction to the XML processor Root element of the XML document Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 16 / 42
  • 19. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 17 / 42
  • 20. Elements Example Start tag <state> or <course> State tag with attributes <state id=”1” abbr=”GA”> End tag </state> Element with content <state>Georgia</state> Empty element <state/> Empty element with attributes <state id=”1” abbr=”GA”/> Case matters <state> <State> <STaTE> Consists of Start tag Some content called character data End tag Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 18 / 42
  • 21. Elements, cont. Rules Start tag must be before end tag An elements start and end tag must have the same parent Wrong: <state><city></state></city> Right: <state><city></city></state> Content Simple <outer><one>stuff</one></outer> Mixed content <outer>More <one>stuff</one></outer> Tag versus Element <msg>Hello World</msg> Element: <msg>Hello World</msg> Tag: msg Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 19 / 42
  • 22. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 20 / 42
  • 23. Attributes Example <state id=”1” abbr=”GA”> <country id=”DK”date=”2006−02−01”> Consists of Name/value pairs Note Attributes cannot stand alone Only start tags can have attributes There can be any number of attributes Attribute names must be unique <state id=”GA”id=”GE”> Attribute values must be in quotes <state id=GA> Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 21 / 42
  • 24. Elements versus Attributes Example (Elements versus Attributes) <box height=” 20 ” width=” 20 ” depth=” 30 ” u n i t =”cm”> <content>S t u f f</ content> </ box> <box> <height> <scalar>20</ scalar> <u n i t>cm</ u n i t> </ height> <width> <scalar>20</ scalar> <u n i t>cm</ u n i t> </ width> <depth> <scalar>30</ scalar> <u n i t>cm</ u n i t> </ depth> <content>S t u f f</ content> </ box> Note Attributes can always be converted to elements Elements can sometimes be converted to attributes Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 22 / 42
  • 25. Elements versus Attributes, cont. Example (Elements versus Attributes) <box> <height> <scalar>20</ scalar> <u n i t>cm</ u n i t> </ height> <width> <scalar>20</ scalar> <u n i t>cm</ u n i t> </ width> <depth> <scalar>30</ scalar> <u n i t>cm</ u n i t> </ depth> <content>S t u f f</ content> </ box> <box> <height u n i t =”cm”>20</ height> <width u n i t =”cm”>20</ width> <depth u n i t =”cm”>30</ depth> <content>S t u f f</ content> </ box> Note Attributes good for identify, units and so on Elements good if variable number of “stuff” Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 23 / 42
  • 26. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 24 / 42
  • 27. Entities Example <! ENTITY company ”XML Lovers Inc.”> <! ENTITY sql ”SQL”> Purpose To make XML document easier to maintain Recurring text Are place holders for content (abbreviations) Types Parameter entities used in DTD General entities used in the XML document itself There are a lot of details about entities! Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 25 / 42
  • 28. Using Entities Example <?xml version=” 1.0 ” encoding=”UTF−8” ?> <!DOCTYPE coursecatalog SYSTEM ” coursecatalog . dtd ” [ <!ENTITY prg ” programming ”> <! ENTITY sql ”SQL”> ]> <coursecatalog> <course id=”P4”> <name>OOP</name> <semester>3</ semester> <desc>Object−oriented &prg ;</ desc> </ course> <course id=”P2”> <name>DB</name> <semester>7</ semester> <desc>Databases including &sql ;</ desc> </ course> </ coursecatalog> [Source: examples/coursecatalog_with_entity.xml] Note The entities prg and sql Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 26 / 42
  • 29. More Entity Examples Entity Types Predefined character entities amp = & gt = > Usage: <msg>Hello &amp; and &gt;</msg> Numbered character entities #145 = æ Usage: <msg>This is a Danish letter &#145;</msg> External entities definition is in another file Internal entities Unparsed entity <!ENTITY logo SYSTEM ”logo.gif”NDATA gif> Note There are a lot of details about entities! Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 27 / 42
  • 30. Various Comments on XML Documents Comments Are always in UTF Whitespace is preserved (not the case in HTML) Carriage return and line feed converted to line feed Weird when used to MS Windows This is a comment <!−−a comment in XML −−> Example (Comments in XML) <?xml version=” 1.0 ”> <doc> <!−− A comment −−> <row> </ row> <row> <!−− Another comment −−> </ row> </ doc> Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 28 / 42
  • 31. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 29 / 42
  • 32. First Design Example (1-n Relationship) <order −db> <orders> <order id=” 117 ”> <customer−name>Ann</ customer−name> </ order> <order id=” 341 ”> <customer−name>Jim</ customer−name> </ order> </ orders> <orderlines> <o r d e r l i n e id=” 117 ” line −no=” 1 ”> <description>pizza</ description> <quantity>1</ quantity> <price −each>10.50</ price −each> </ o r d e r l i n e> </ orderlines> </ order −db> Note Too much first normal form, does not use tree hierarchy Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 30 / 42
  • 33. Second Design Example (1-n Relationship) <order −db> <orders> <order id=”O117”> <customer−name>Ann</ customer−name> <orderlines> <o r d e r l i n e line −no=” 1 ”> <description>pizza</ description> <quantity>1</ quantity> <price −each>10.50</ price −each> </ o r d e r l i n e> </ orderlines> </ order> <order id=”O341”> <customer−name>Jim</ customer−name> </ order> </ orders> </ order −db> Note All information related to single order is stored together Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 31 / 42
  • 34. Summary: Anatomy Main Points Elements One is the root Attribute Limited set Entities Similar to a macro There are many details The prolog Note In doubt element or attribute? Pick element Remember good comments, for humans! Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 32 / 42
  • 35. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 33 / 42
  • 36. Non Well-Formed XML Document Example (Missing Root) <course id=”P4”> <name>OOP</name> <semester>3</ semester> <desc>Object−oriented Prog .</ desc> </ course> <course id=”P2”> <name>DB</name> <semester>7</ semester> <desc>Databases including SQL</ desc> </ course> Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 34 / 42
  • 37. Non Well-Formed XML Document Example (Missing Root) <course id=”P4”> <name>OOP</name> <semester>3</ semester> <desc>Object−oriented Prog .</ desc> </ course> <course id=”P2”> <name>DB</name> <semester>7</ semester> <desc>Databases including SQL</ desc> </ course> Example (Nesting Wrong) <person ssn=” 43 ”> <name>< f i r s t >James</ f i r s t > <l a s t>Bond</name></ l a s t> <job>agent</ job> </ person> Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 34 / 42
  • 38. Non Well-Formed XML Document Example (Missing Root) <course id=”P4”> <name>OOP</name> <semester>3</ semester> <desc>Object−oriented Prog .</ desc> </ course> <course id=”P2”> <name>DB</name> <semester>7</ semester> <desc>Databases including SQL</ desc> </ course> Example (Nesting Wrong) <person ssn=” 43 ”> <name>< f i r s t >James</ f i r s t > <l a s t>Bond</name></ l a s t> <job>agent</ job> </ person> Example (Missing Quotes) <person ssn=43> <name> . . . </name> </ person> Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 34 / 42
  • 39. Well-Formed XML and Valid Document Well-Formed XML Document All XML elements must have a closing tag Empty elements are allow Tags must be properly nested Start and end tag must have the same parent The XML document must have a root tag Attribute values must be quoted Valid XML Document Is well-formed Adheres to the rules of the specified DTD or XML Schema Similar to a schema for a table, e.g., types and integrity constraints Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 35 / 42
  • 40. Well-Formed and Valid XML Documents Well-Formed XML Documents Valid XML Documents Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 36 / 42
  • 41. Summary: Well-Formed and Valid Main Points Well-formed XML document Structure must adhere to certain rules Valid XML document Types and constraints must match a schema (DTD or XML Schema) Not covered in this lecture, more to come later Note Tools check if documents are well-form and valid The well-formedness is a huge plus over “flat” files Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 37 / 42
  • 42. Outline 1 Introduction 2 Anatomy of an XML Document Document Prolog Elements Attributes Entities Complete XML Document 3 Well-Formed and Valid XML Documents 4 Summary Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 38 / 42
  • 43. Why XML? Many Good Reasons Open Specifications available to all Platform neutral Runs on Apple, Linux, Unix, Windows, . . . Vendor neutral Competition among vendors Standard Changes done in open forums Note XML has support for checking structure/types/integrity constraints DTD and XML Schema XML has support for querying text documents XPath and XQuery Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 39 / 42
  • 44. Data vs. Document Centric Data Centric Database designer Does not use document order Only content at leaf level Simple Rigid Example: Extract RDBMS Document Centric Text author Document order, e.g., for chapters figure no Mixed content Complex Flexible Examples: DocBook, XHTML Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 40 / 42
  • 45. XML vs. DBMS RDBMS Structured data Unordered Flat information Native format Very compact format SQL Fine-grained modifications Bad data exchange Integrity via SQL DDL Supports data types Extreme data volumes XML Structured and unstructured Ordered Hierarchical information Standard format Very verbose format XPath and XQuery Coarse-grained modifications Excellent data exchange Integrity via XML Schema (DTD) Supports data types Large data volumes Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 41 / 42
  • 46. Additional Information Web Sites W3C Schools free online tutorials www.w3schools.com. Quite good for getting an overview of the various XML technologies. Interactive XML Tutorials www.xmlzoo.net. Covers several parts of XML The Annotated XML 1.0 Specification www.xml.com/axml/testaxml.htm. The XML 1.0 specification with a lot of comments. W3C XML recommendations www.w3.org. The place to go if you want all the details. Altova’s home page (maker of XMLSpy) www.altova.com. If you are looking for a good XML tool. IBM developerWorks overview “New to XML” www.ibm.com/developerworks/xml/newto/ Many links to additional information. Kristian Torp (Aalborg University) Introduction to XML November 3, 2015 42 / 42
  翻译: