Rappel sur la notion d'arbre en informatique (différente de celle de la théorie des graphes).
Souvent utilisée pour exprimer la structure d'une entité quelconque.
Les machines savent parfaitement traiter des arbres
mais les hommes ont besoin de représenter les mêmes arbres par des textes (très longues chaînes de caractères).
Les arbres sont des structures à deux dimensions (la descendance parent-enfant [verticale] et l'ordre entre les enfants [horizontale]).
Les chaînes de caractères sont des structures à une seule dimension.
Il faut donc coder les arbres sous forme de chaînes de caractères.
Un des moyens pour effecuer ce codage est fourni par les systèmes de parenthèses.
Le principe de XML n'est pas autre chose qu'une généralisation des systèmes de parenthèses.
( [ ] { < < > > } ( [ ( ) { < > } ] ) )
traduit en XML comme ci-dessus. <Voiture> <Carosserie> <Capot></Capot> </Carosserie> <Moteur> <Cylindres></Cylindres> <Allumage></Allumage> </Moteur> <Transmission> <Boîte></Boîte> <TrainAV></TrainAV> <TrainAR></TrainAR> </Transmission> </Voiture> |
ou bien<personne>
?????Il n'y a pas de règle, c'est une question délicate de modélisation.
<?xml version="1.0" encoding="ISO-8859-1"?>Quand on écrit un fichier XML, il faut donc être attentif au codage adopté par l'éditeur de textes !
<?xml version="1.0"?>
<Capitales>
<France>Paris</France>
<España>Madrid</España>
<Česko>Praha</Česko>
<Україна>Київ</Україна>
<България>София</България>
<Ελλάς>Αθήνα</Ελλάς>
<Россия>Москва</Россия>
<საქართველო>თბილისი</საქართველო>
<Հայաստան>Երեւան</Հայաստան>
<!-- <ኢትዮጵያ>አዲስ አበባ</ኢትዮጵያ> -->
<भारत>नई दिल्ली</भारत>
<தமிழ்_நாடு>ென்னை</தமிழ்_நாடு>
<ประเทศไทย>กรุงเทพฯ</ประเทศไทย>
<Việt_Nam>Hà Nội</Việt_Nam>
<中華>北京</中華>
<日本国>東京</日本国>
</Capitales>
<?xml version="1.0"?>
<html
xmlns="http://www.w3.org/HTML/1998/html4"
xmlns:xdc="http://www.xml.com/books"
>
<head><title>Book Review</title></head>
<body>
<xdc:bookreview>
<h1 style="font-family: sans-serif;">
<xdc:title>XML: A Primer</xdc:title> </h1>
<table border="3">
<tr align="center">
<td>Author</td><td>Price</td>
<td>Pages</td><td>Date</td>
</tr>
<tr align="left" style="font-family: sans-serif;">
<td><xdc:author>Simon St.Laurent</xdc:author></td>
<td><xdc:price>31.98</xdc:price></td>
<td><xdc:pages>352</xdc:pages></td>
<td><xdc:date>1998/01</xdc:date></td>
</tr>
</table>
</xdc:bookreview>
</body>
</html>
<?xml version="1.0"
encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Exemple de listes et de
tables</title></head>
<body>
<h1><em>Liste de
tables</em></h1>
<ol>
<li><strong>Table des
noms</strong>
<ul><li>Nombre de
personnes = 3</li>
<li>
<em>Tableau</em>
<table>
<tr><td>Pierre</td><td>M</td></tr>
<tr><td>Marie-Cunégonde</td><td>F</td></tr>
<tr><td>Jacques</td><td>M</td></tr>
</table>
</li>
</ul>
</li>
<li><h1>Table des
notes</h1>
<ul>
<li>Meilleure note = 17</li>
<li>Moyenne = 14</li>
<li><em>Tableau</em>
<table border="5">
<tr><td>Pierre</td><td>12</td></tr>
<tr><td><h1>Pauline</h1></td><td>13</td></tr>
<tr><td>Jacques</td><td><strong>17</strong></td></tr>
</table>
</li>
</ul>
</li>
</ol>
</body>
</html>
http://www.rssboard.org/rss-specification
<?xml version="1.0"
encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
<title>Le Monde.fr : A la
une</title>
<link>http://www.lemonde.fr</link>
<description>Toute
l'actualité au moment de la connexion</description>
<copyright>Copyright Le
Monde.fr</copyright>
<image>
<url>http://medias.lemonde.fr/mmpub/img/lgo/lemondefr_rss.gif</url>
<title>Le Monde.fr</title>
<link>http://www.lemonde.fr</link>
</image>
<pubDate>Fri, 23 Feb 2007
14:38:06 GMT</pubDate>
<item>
<title>Pour le FN, l'immigration reste la cause principale
des problèmes de la France</title>
<link>http://www.lemonde.fr/web/article/0,1-0@2-823448,36-875546,0.html?xtor=RSS-3208</link>
<description>Dans son programme, rendu public ce week-end,
le parti
de M. Le Pen propose &#34;une inversion des
flux migratoires&#34; et veut diminuer
la durée des cartes de séjour de dix à trois ans.
</description>
<pubDate>Fri, 23 Feb 2007 13:51:01 GMT</pubDate>
<guid
isPermaLink="false">http://www.lemonde.fr/web/article/0,1-0@2-823448,36-875546,0.html?xtor=RSS-3208</guid>
<enclosure
url="http://medias.lemonde.fr/mmpub/edt/ill/2006/11/23/h_1_ill_837714_le_pen.jpg"
type="image/jpeg" length="1923"></enclosure>
</item>
<item>
<title>"L'hostilité des Français aux profits est récente", selon
David Thesmar</title>
<link>http://www.lemonde.fr/web/article/0,1-0@2-3234,36-875560,0.html?xtor=RSS-3208</link>
<description>Le professeur à HEC rappelle que
&#34;jusqu&#39;à la fin des années 1920,
la France était
l&#39;amie des marchés financiers&#34;.
</description>
<pubDate>Fri, 23 Feb 2007 14:06:50 GMT</pubDate>
<guid
isPermaLink="false">http://www.lemonde.fr/web/article/0,1-0@2-3234,36-875560,0.html?xtor=RSS-3208</guid>
<enclosure
url="http://medias.lemonde.fr/mmpub/edt/ill/2007/02/23/h_1_ill_812370_total.jpg"
type="image/jpeg" length="1968"></enclosure>
</item>
<!-- autres items -->
<item>
<title>Dépêche: Airbus: Chirac et Merkel
s'accordent sur un partage des efforts</title>
<link>http://www.lemonde.fr/web/depeches/0,14-0,39-29881330@7-37,0.html?xtor=RSS-3208</link>
<description>Retrouvez l'ensemble des dépêches
sur http://www.lemonde.fr</description>
<pubDate>Fri, 23 Feb 2007 12:22:10 GMT</pubDate>
<guid
isPermaLink="false">http://www.lemonde.fr/web/depeches/0,14-0,39-29881330@7-37,0.html?xtor=RSS-3208
</guid>
</item>
</channel>
</rss>
<?xml version="1.0" encoding="UTF-8"?>
<definitions
name="net.xmethods.services.stockquote.StockQuote"
targetNamespace="http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/"
xmlns:tns="http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/"
xmlns:electric="http://www.themindelectric.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="getQuoteResponse1">
<part name="Result" type="xsd:float"/>
</message>
<message name="getQuoteRequest1">
<part name="symbol" type="xsd:string"/>
</message>
<portType name="net.xmethods.services.stockquote.StockQuotePortType">
<operation name="getQuote" parameterOrder="symbol">
<input message="tns:getQuoteRequest1"/>
<output message="tns:getQuoteResponse1"/>
</operation>
</portType>
<binding
name="net.xmethods.services.stockquote.StockQuoteBinding"
type="tns:net.xmethods.services.stockquote.StockQuotePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getQuote">
<soap:operation
soapAction="urn:xmethods-delayed-quotes#getQuote"/>
<input>
<soap:body use="encoded"
namespace="urn:xmethods-delayed-quotes"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="urn:xmethods-delayed-quotes"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="net.xmethods.services.stockquote.StockQuoteService">
<documentation>net.xmethods.services.stockquote.StockQuote web service
</documentation>
<port name="net.xmethods.services.stockquote.StockQuotePort"
binding="tns:net.xmethods.services.stockquote.StockQuoteBinding">
<soap:address location="http://64.124.140.30:9090/soap"/>
</port>
</service>
</definitions>
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2994="urn:xmethods-delayed-quotes"
>
<SOAP-ENV:Body>
<ns2994:getQuote xmlns:ns2994="urn:xmethods-delayed-quotes">
<symbol xsi:type="xsd:string">IBM</symbol>
</ns2994:getQuote>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
>
<soap:Body>
<n:getQuoteResponse xmlns:n='urn:xmethods-delayed-quotes'>
<Result xsi:type='xsd:float'>80.85</Result>
</n:getQuoteResponse>
</soap:Body>
</soap:Envelope>