74
XML XML Extensible Markup Language

XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell ([email protected]) XML Evangelist IBM

Embed Size (px)

Citation preview

Page 1: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

XMLXML

Extensible Markup Language

Page 2: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Why do we need XML?Why do we need XML?

Introduction to XML

Skill Level: Introductory

Doug Tidwell ([email protected])

XML Evangelist

IBM

07 Aug 2002

SGML as anISO Standard

XMLXML

1993 1986 1996

HTML

Standard Generalized Markup Language (langage normalisé de balisage généralisé - SGML) est un langage de description à balises, de norme ISO (ISO 8879:1986).

Page 3: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Why do we need XML?Why do we need XML?

<< "HTML is the most successful markup language of all time.

<p><b>Mrs. Mary McGoon</b><br/>

1401 Main Street<br/>

Anytown, NC 34829</p>

The trouble with HTML is that it was designed with humans in mind. …

The tags don't tell the browser what the information is. You and I know it's an address, but a machine doesn't. ">>

Page 4: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

<XML><XML>

XML voué à la simplicité des échanges est aujourd'hui une galaxie.

Page 5: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Document and Publishing Focus Data Integration / e-Business Focus

<XML><XML>

Page 6: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

XSL-FO

SOA and Web

Services

ApplicationIntegration

Flexible DataInterchange

Document and Publishing Focus Data Integration / e-Business Focus

XQuery

DTDs Schemas

XSLT

SVG EXI

SOAP

RelaxNG

<XML><XML>

Page 7: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

trainingtraining

http://www.w3schools.com/xpath/xpath_intro.asp

Page 8: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

W3CW3C

Page 10: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

XML et la diversité d'utilisation et fonctionnementXML et la diversité d'utilisation et fonctionnement

XML voué à la simplicité des échanges est aujourd'hui une galaxie.

XML Schema pour définir les structures et les types de données XSLT pour transformer des données XML SOAP XML pour échanger des données entre les applications WSDL pour décrire les services Web RDF pour décrire des ressources Web XPath et XQuery pour accéder à des données XML SMIL pour des graphiques

Page 11: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

PlanPlan

XML

Balise

Contenu et balisage

Éléments

Documents

Page 12: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

PlanPlan

XML

Balise

Contenu et balisage

Éléments

Documents

Page 13: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

XMLXML

Permet le stockage l'organisation et la vérification de l'information.

XML est un standard W3C.

XML est devenu indispensable dans le système d'information.

Page 14: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

PlanPlan

XML

Balise

Contenu et balisage

Éléments

Documents

Page 15: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisageBalisage

XML est un ensemble de règles permettant la création de langages de balisage.

un langage de balisage est un ensemble de symboles placés dans le corps d'un document afin d'en délimiter et d'en étiqueter les différentes parties.

XML n'est pas en langage en lui-même : c'est une spécification

Le balisage améliore la compréhension de l'information.

HTML : <i> 183 <i>

XML : <taille unite="cm"> 183 </taille>

Page 16: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

PlanPlan

XML

Balise

Contenu et balisage

Éléments

Documents

Page 17: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Balisage et contenuBalisage et contenu

Le contenu et le balisage sont des valeurs informatives du document.

Le Contenu est ce qui compte pour le lecteur mais cela doit être présenté d'une façon signifiante.

Le Balisage permet au programmes de déterminer les fonctions et les limites de ces différents contenus (voir plus loin).

Page 18: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

PlanPlan

XML

Balise

Contenu et balisage

Éléments

Documents

Page 19: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Les élémentsLes éléments

Les éléments sont des morceaux qui composent un document.

Ils s'imbriquent les uns dans les autres structurant et étiquetant le contenu d'un document.

Page 20: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

PlanPlan

XML

Balise

Contenu et balisage

Éléments

Documents

Page 21: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Le documentLe document

Un document est en XML l'unité fondamentale de l'information.

C'est un ensemble ordonné de balises et éléments

Le document peut correspondre à • une BD• un format d'échange de données entre application• (c'est une notion plus large que le document traditionnel)

Page 22: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Modèle de documentModèle de document

Il existe deux moyens pour créer un langage dérivé de XML

1. XML sans modèle

On parle de document bien formé, si le document satisfait aux règles minimales de XML

2. XML modèle de document

Création d'une spécification qui établit les règles propres du document.

La conformité des instances de document est obtenu par comparaison avec le modèle

On parle de validation de document.

Page 23: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Type de documentType de document

On parle de type de document (ou application XML) qui respecte les règles de XML.

Il existe de nombreuses applications XML dans de nombreux domaines.

XMLNews is a specification for exchanging news and other information.

XML Weather Service• http://www.weather.gov/xml/current_obs/

http://www.medicalnewstoday.com/index.php?page=newsfeed

Page 24: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

PrésentationPrésentation

En XML, les styles et mise en forme du document sont définis dans un document appelé feuille de style.

L'idée est de séparer la forme du fond

Page 25: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

TraitementTraitement

Tout programme qui peut lire et traiter du XML est appelé processeur XML.

On parle de traitement du XML.

Validateurs

Navigateurs

Parseurs

Le parseur transforme par exemple le flux de caractères en atomes et construit une structure d'arbre en mémoire.

Page 26: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Exemple de TransformationExemple de Transformation

Un processus qui réorganise les différentes parties d'un document est appelée transformation.

Les documents sont transformés à l'aide de XSLT (Extensible Style Language for transformation)

il est possible de

résumer

extraire

calculer• Limites du HTML.

Page 27: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

DocumentDocument

Prologue

Contenu textuel

Les chevrons (<>) et les noms qu'ils encadrent sont appelé des balises.

Elles marquent et nomment les parties du document et ajoutent des informations qui aident à en définir la structure.

Le balisage et le contenu sont complémentaires.

Ils forment ensemble une entité d'information dont les données sont découpées et étiquetées.

Page 28: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

<!-- Prologue --><?xml version="1.0" encoding="ISO-8859-1"?><!-- Élément racine --><biblio> <!-- Premier enfant --> <livre> <!-- Élément enfant titre --> <titre>Les Misérables</titre> <auteur>Victor Hugo</auteur> <nb_tomes>3</nb_tomes> </livre> <livre> <titre>L'Assomoir</titre> <auteur>Émile Zola</auteur> </livre> <livre lang="en"> <titre>David Copperfield</titre> <auteur>Charles Dickens</auteur> <nb_tomes>3</nb_tomes> </livre></biblio>

Page 29: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

ProloguePrologue

Contient une déclaration XML décrivant des propriétés générales du document indiquant au processeur XML qu'il a besoin d'un parseur XML pour l'interprétation du document.

Une déclaration de type

on spécifie la déclaration d'entité la DTD utilisée, nom de l'élément racine.

Page 30: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Exemple : Déclaration XMLExemple : Déclaration XML

<?xml nom="val" ... ?>

propriété

Propriété :

version

encoding

standalone (No : indique qu'il faut charger d'autres fichiers)

Page 31: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

<!-- Prologue --><?xml version="1.0" encoding="ISO-8859-1"?><!-- Élément racine --><biblio> <!-- Premier enfant --> <livre> <!-- Élément enfant titre --> <titre>Les Misérables</titre> <auteur>Victor Hugo</auteur> <nb_tomes>3</nb_tomes> </livre> <livre> <titre>L'Assomoir</titre> <auteur>Émile Zola</auteur> </livre> <livre lang="en"> <titre>David Copperfield</titre> <auteur>Charles Dickens</auteur> <nb_tomes>3</nb_tomes> </livre></biblio>

Page 32: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Déclaration de typeDéclaration de type

<!DOCTYPE racine SYSTEM "URI vers la DTD">

C'est une déclaration optionnelle servant à attacher une grammaire de type Document Type Definition au document XML.

Page 33: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

exempleexemple

<?xml version="1.0"?><!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)>]><note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend</body></note>

http://www.w3schools.com/dtd/default.asp

Page 34: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisagesBalisages

élément

attribut

espace de noms

entités

commentaires

les instructions de traitements

sections CDATA

Page 35: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisagesBalisages

élément

attribut

espace de noms

entités

commentaires

les instructions de traitements

sections CDATA

Page 36: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

ÉlémentsÉléments

Les éléments sont les parties d'un document<nom attribut="val" ... >

contenu</nom>

Les éléments vides<nom attribut="val" ... />

Les éléments sont soumis aux règles de positionnement1. La balise de fin doit arriver après la balise de début2. Les balises début et fin doivent apparaître tous deux à l'intérieur

d'un même élément parent.

Page 37: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

<!-- Prologue --><?xml version="1.0" encoding="ISO-8859-1"?><!-- Élément racine --><biblio> <!-- Premier enfant --> <livre> <!-- Élément enfant titre -->

<titre> Les Misérables </titre> <auteur>Victor Hugo</auteur> <nb_tomes>3</nb_tomes> </livre> <livre> <titre>L'Assomoir</titre> <auteur>Émile Zola</auteur> </livre>

<livre lang="en"> <titre>David Copperfield</titre> <auteur>Charles Dickens</auteur> <nb_tomes>3</nb_tomes>

</livre></biblio>

Page 38: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

ÉlémentsÉléments

Nom d'un élément : suite non vide decaractères alphanumériquestiret-souligné (underscore)signe moinspointcaractère deux-points (:)

ce caractère possède un sens particulierContraintes à satisfaire

le premier caractère doit être alphabétique ou un tiret-soulignéles trois premiers caractères ne doivent pas former une chaîne dont la représentation en lettres minuscules est "xml".

Page 39: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

ÉlémentsÉléments

Corrects

_tiyi

Nom_société

xsl:rule

X.11

Incorrects

2009-catalogue

XmlSpécifification

nom société

Page 40: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisagesBalisages

élément

attribut

espace de noms

entités

commentaires

les instructions de traitements

sections CDATA

Page 41: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

AttributsAttributs

Un élément peut avoir un nombre quelconque d'attributs

nom="valeur"

attributs réservés :

xml:lang

xml:space

xml:link

xml:attribut

Page 42: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Attributs ou élémentsAttributs ou éléments

On peut écrire avec des attributs ce que l'on écrit avec des éléments

<livre lang="en"> … </livre>

<livre><lang>en </lang>

…</livre>

L'inverse n'est pas vrai

Page 43: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

RéglesRégles

Choix de l'attribut, lorsque une valeur

n'est pas répétée

n'évoluera pas vers une structure complexe

En cas de doute

choix de l'élément

Page 44: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisagesBalisages

élément

attribut

espace de noms

entités

commentaires

les instructions de traitements

sections CDATA

Page 45: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Espace de noms : garantir l'absence de conflitsEspace de noms : garantir l'absence de conflits

doc 3

doc 2doc1

nom (livre) nom (auteur)

Page 46: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Choix d'un identifiant uniqueChoix d'un identifiant unique

L'identifiant pourrait être n'importe quel chaîne de caractère.

L'identifiant est généralement une URL

L'URL ne signifie pas qu'il doit y avoir un document sur le serveur.

Page 47: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Choix d'un identifiant uniqueChoix d'un identifiant unique

<h:table xmlns:h="http://www.w3.org/TR/html4/"><f:table xmlns:f="http://www.w3schools.com/furniture">

Page 48: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

exempleexemple

xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Page 49: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

ExempleExemple

<?xml version="1.0" encoding="utf-8"?>

<library xmlns="http://dyomedea.com/ns/library" >

<book id="b0836217462">

<title>Being a Dog Is a Full-Time Job</title>

<authors>

<person id="CMS">

<name>Charles M Schulz</name>

</person>

</authors>

</book>

</library>

Page 50: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

remarqueremarque

l'espace de nom est invisible : Mozilla

Page 51: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

l'espace de nom est visible

Page 52: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

<?xml version="1.0" encoding="utf-8"?><library xmlns="http://dyomedea.com/ns/library" > <book id="b0836217462"> <title>Being a Dog Is a Full-Time Job</title> <authors> <person id="CMS"> <name>Charles M Schulz</name> </person> </authors> </book></library>

<?xml version="1.0" encoding="utf-8"?><library xmlns="http://dyomedea.com/ns/library" > <book id="b0836217462"> <title>Being a Dog Is a Full-Time Job</title> <authors> <person id="CMS"> <name>Charles M Schulz</name> </person> </authors> </book></library>

Equivalence des écrituresEquivalence des écritures

<?xml version="1.0"?>

<lib:library xmlns:lib="http://dyomedea.com/ns/library">

<lib:book id="b0836217462">

<lib:title>

Being a Dog Is a Full-Time Job

</lib:title>

<lib:authors>

<lib:person id="CMS">

<lib:name>

Charles M Schulz

</lib:name>

</lib:person>

</lib:authors>

</lib:book>

</lib:library>

Page 53: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Espace de noms par défautEspace de noms par défaut

<library xmlns="http://dyomedea.com/ns/library" >

<book id="b0836217462">

</book>

</library>

L'espace de noms http://dyomedea.com/ns/library est définie comme l'espace de noms par défaut.

L'espace de noms s'applique à tous les éléments du document.

Page 54: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Et encore ! Et encore !

<?xml version="1.0"?>

<l:library xmlns:l="http://dyomedea.com/ns/library">

<l:book id="b0836217462" xmlns:lib="http://dyomedea.com/ns/library">

<l:title>

Being a Dog Is a Full-Time Job

</l:title>

<lib:authors>

<l:person id="CMS" xmlns="http://dyomedea.com/ns/library">

<name>

Charles M Schulz

</name>

</l:person>

</lib:authors>

</l:book>

</l:library>

Page 55: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

coexistence des espaces de nomscoexistence des espaces de noms

<?xml version="1.0"?><!-- Namespace: http://dyomedea.com/ns/library --> <library xmlns="http://dyomedea.com/ns/library" xmlns:mkt="http://dyomedea.com/ns/library/mkt"> <book id="b0836217462"> <title> Being a Dog Is a Full-Time Job </title> <authors> <person id="CMS"> <name> Charles M Schulz </name> </person> </authors> <mkt:cover> Paperback </mkt:cover> <mkt:pages> 128 </mkt:pages> </book></library>

XML sert de glue entre applications, et les espaces de noms ont été créés pour faire cohabiter différents vocabulaires.En ajoutant des nouveau espaces de noms "mkt=marketing" le reste de l'application estinchangée.

XML sert de glue entre applications, et les espaces de noms ont été créés pour faire cohabiter différents vocabulaires.En ajoutant des nouveau espaces de noms "mkt=marketing" le reste de l'application estinchangée.

Page 56: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisagesBalisages

élément

attribut

espace de noms

entités

Entités

Entité de caractère

Entités de contenu mixte

Entité non parsée

commentaires

les instructions de traitements

sections CDATA

Page 57: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Une entitéUne entité

Son rôle

remplacement de caractère

marquage de position pour inclure un fichier

joue le rôle de variable de remplacement dans le document

Une entité générale est une réserve de contenu qui apparaît au niveau de la racine où à n'importe quel niveau à l'intérieur de celui-ci.

Losque le parseur rencontre des appels d'entités, il recherche dans une table en mémoire le marqueur pour le remplacer dans le document.

Page 58: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Entité de caractèreEntité de caractère

Pour éviter des conflits avec les délimiteurs de balisage

&amp; &

apos '

gt >

lt <

quot "

Page 59: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Unité de caractère NumériqueUnité de caractère Numérique

Unicode 10000 caractères, symboles.

Impossibilités d'utiliser le clavier, remplacé par un code de saisie numérique

¥

&yen;

&#xa5;

Page 60: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Entités de contenu mixteEntités de contenu mixte

Entité interne

<!ENTITY nom "<name>nom</name>">

Entité externe

<!ENTITY chap1 SYSTEM "chap1.xml">

Identifiant systèmeest une URL, qui permet d'inclure n'importe quel fichier

Page 61: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Entité non parséeEntité non parsée

L'analyse syntaxique doit restreindre son analyse à des documents comme les images, graphique.

<!ENTITY img SUSTEM "Photo.gif" NDATA GIF>

Exemple d'identifiant de notation

Page 62: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisagesBalisages

élément

attribut

espace de noms

entités

commentaires

les instructions de traitements

sections CDATA

Page 63: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

CommentairesCommentaires

<!-- texte -->

Page 64: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisagesBalisages

élément

attribut

espace de noms

entités

commentaires

les instructions de traitements

sections CDATA

Page 65: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Instructions de traitementsInstructions de traitements

joue le rôle de conteneur pour des données destinées à un processeur XML spécifique

<? nom données ?>

Page 66: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

BalisagesBalisages

élément

attribut

espace de noms

entités

commentaires

les instructions de traitements

sections CDATA

Page 67: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Sections CDATASections CDATA

CDATA : caractères data : signifie pas de balise

Indique au parseur que les caractères de balisage doivent être traités comme des caractères normaux.

Page 68: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Documents bien formésDocuments bien formés

Les documents bien formés répondent à un ensemble de règles de bases :

les délimiteurs de balise doivent être corrects

une balise de fin suit une balise début

les éléments ne se chevauchent pas• si un document répond à ces règles, il est bien formé.

Page 69: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

PlanPlan

XML

Balise

Contenu et balisage

Éléments

Documents

Page 70: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM
Page 71: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

EOF

Page 72: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Format de fichierFormat de fichier

Le standard et ses extensions proposent :

support de très nombreux encodages (Unicode, ISO Latin, etc.) international

inclusion et macro (très élémentaires)

contraintes de structure :

Document Type Definition (DTD),

Schéma

méta organisation : namespace

liens évolués : XPointer et Xlink

stockage :

bases de données XML (langage de requêtes XQuery)

compression spécialisée

calcul de différences (gestion de version)

Page 73: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

ProgrammationProgrammation

Le standard et ses extensions proposent :analyse syntaxique :

modèle objet : Document Object Model (DOM)modèle évènementiel : Simple API for Xml (SAX)sérialisation

validation (en général intégrée à l’analyseur) :DTDschéma

moteur de transformation (d’un document XML en un autre) : XSLTexpressions rationnelles XML : XPathOutils Open Source par le groupe apache

http://xml.apache.org :• Xerces : analyse syntaxique et validation• Xalan : transformation et expressions rationnelles (voiraussi Saxon, http://saxon.sourceforge.net/)

Page 74: XML Extensible Markup Language. Why do we need XML? Introduction to XML Skill Level: Introductory Doug Tidwell (dtidwell@us.ibm.com) XML Evangelist IBM

Outils et normes utiles :Outils et normes utiles :

base de connaissances : Ressource Description Framework (RDF)transformation vers HTML et WML : XSLTimpression de qualité : XSL :FOdessin vectoriel : Scalable Vector Graphics (SVG)animation : SMILmathématiques : MathMLRPC en XML : xmlrpc et SOAP

Outils Open Source par le groupe apachehttp://xml.apache.org :FOP : support de XSL :FOBatik : support de SVG