--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ viewBox="-10 -10 934.30447 1320.5428"
+ id="svg2"
+ inkscape:version="0.48.5 r10040"
+ sodipodi:docname="tree.svg"
+ width="1044cm"
+ height="1330cm">
+ <metadata
+ id="metadata40">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1317"
+ inkscape:window-height="744"
+ id="namedview38"
+ showgrid="true"
+ inkscape:zoom="0.70710678"
+ inkscape:cx="475.31215"
+ inkscape:cy="445.37894"
+ inkscape:window-x="49"
+ inkscape:window-y="24"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ units="cm">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3052"
+ empspacing="5"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true"
+ originx="-15.123041px"
+ originy="1285.6658px" />
+ </sodipodi:namedview>
+ <defs
+ id="defs4" />
+ <g
+ id="g3054"
+ transform="matrix(3.776905,0,0,3.776905,27.769048,27.769503)">
+ <path
+ sodipodi:nodetypes="cc"
+ d="m 129.87695,39.876949 -80,15"
+ id="p1"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ sodipodi:nodetypes="cc"
+ d="m 129.87695,39.876949 75,15"
+ id="p2"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ d="M -0.12304184,94.876944 49.876959,54.876952 l -30,39.999992"
+ id="path3007"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 39.876959,94.876944 10,-39.999992 10,39.999992"
+ id="path3009"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 79.876959,94.876944 -30,-39.999992 49.999998,39.999992"
+ id="path3011"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 174.87695,94.876944 30,-39.999995 -10,39.999995"
+ id="path3013"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 214.87695,94.876944 -10,-39.999995 30,39.999995"
+ id="path3015"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <text
+ class="bibliography"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="166.55959"
+ y="34.876949"
+ id="text3017"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="129.87697"
+ y="34.876949"
+ id="tspan3019">bibliography</tspan></text>
+ <text
+ class="book"
+ style="font-size:12px;text-align:end;text-anchor:end"
+ x="72.990227"
+ y="54.876957"
+ id="text3017-6"
+ xml:space="preserve"><tspan
+ style="text-align:end;text-anchor:end"
+ x="44.876949"
+ y="54.876957"
+ id="tspan3019-6">book</tspan></text>
+ <text
+ style="font-size:12px"
+ class="book"
+ x="204.87695"
+ y="54.876957"
+ id="text3017-7"
+ xml:space="preserve"><tspan
+ x="204.87695"
+ y="54.876957"
+ id="tspan3019-8">book</tspan></text>
+ <text
+ class="title"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-98.626953"
+ y="-0.12304688"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3017-6-5"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-109.87695"
+ y="-0.12304688"
+ id="tspan3019-6-2">title</tspan></text>
+ <text
+ class="author"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-95.450188"
+ y="19.876953"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3072"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-114.87695"
+ y="19.876953"
+ id="tspan3074">author</tspan></text>
+ <text
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-95.450188"
+ y="59.876949"
+ transform="matrix(0,-1,1,0,0,0)"
+ class="author"
+ id="text3072-2"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-114.87695"
+ y="59.876949"
+ id="tspan3074-8">author</tspan></text>
+ <text
+ class="year"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-96.667"
+ y="99.876945"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3072-2-8"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-109.87695"
+ y="99.876945"
+ id="tspan3074-8-2">year</tspan></text>
+ <text
+ class="publisher"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-92.572273"
+ y="79.876945"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3072-2-5"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-119.87695"
+ y="79.876945"
+ id="tspan3074-8-5">publisher</tspan></text>
+ <text
+ class="title"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-98.626953"
+ y="174.87695"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3017-6-5-6"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-109.87695"
+ y="174.87695"
+ id="tspan3019-6-2-2">title</tspan></text>
+ <text
+ class="author"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-95.450188"
+ y="194.87695"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3072-1"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-114.87695"
+ y="194.87695"
+ id="tspan3074-61">author</tspan></text>
+ <text
+ class="year"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-96.667"
+ y="234.87695"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3072-2-8-1"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-109.87695"
+ y="234.87695"
+ id="tspan3074-8-2-6">year</tspan></text>
+ <text
+ class="publisher"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-97.572273"
+ y="214.87695"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3072-2-5-9"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-124.87695"
+ y="214.87695"
+ id="tspan3074-8-5-9">publisher</tspan></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3018"
+ y="-0.12304688"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="-0.12304688"
+ x="-159.87695"
+ id="tspan3020"
+ sodipodi:role="line">"Foundations of Databases"</tspan><tspan
+ id="tspan3022"
+ y="16.126953"
+ x="-159.87695"
+ sodipodi:role="line" /></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3024"
+ y="19.876953"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="19.876953"
+ x="-159.87695"
+ id="tspan3026"
+ sodipodi:role="line">"Abiteboul"</tspan></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3028"
+ y="39.876949"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="39.876949"
+ x="-159.87695"
+ id="tspan3030"
+ sodipodi:role="line">"Hull"</tspan></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3032"
+ y="59.876949"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="59.876949"
+ x="-159.87695"
+ id="tspan3034"
+ sodipodi:role="line">"Vianu"</tspan></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3036"
+ y="79.876945"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="79.876945"
+ x="-159.87695"
+ id="tspan3038"
+ sodipodi:role="line">"Addison Wesley"</tspan></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3040"
+ y="99.876945"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="99.876945"
+ x="-159.87695"
+ id="tspan3042"
+ sodipodi:role="line">"1995"</tspan></text>
+ <flowRoot
+ transform="translate(-7.7098237,-16.029665)"
+ style="font-size:13px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ id="flowRoot3044"
+ xml:space="preserve"><flowRegion
+ id="flowRegion3046"><rect
+ y="198.9726"
+ x="-96.57534"
+ height="293.8356"
+ width="365.75342"
+ id="rect3048" /></flowRegion><flowPara
+ id="flowPara3050" /></flowRoot> <path
+ inkscape:connector-curvature="0"
+ id="path3054"
+ d="m -2.7098242,128.97032 0,30"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path3056"
+ d="m 17.290177,138.97032 0,20"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path3058"
+ d="m 37.290177,138.97032 0,20"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ id="path3060"
+ d="m 57.290177,138.97032 0,20"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path3062"
+ d="m 77.290177,153.97032 0,5"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path3064"
+ d="m 97.290177,128.97032 0,30"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3018-7"
+ y="174.87695"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="174.87695"
+ x="-159.87695"
+ id="tspan3020-5"
+ sodipodi:role="line">"The Lord of the Rings"</tspan><tspan
+ id="tspan3022-7"
+ y="191.12695"
+ x="-159.87695"
+ sodipodi:role="line" /></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3024-9"
+ y="194.87695"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="194.87695"
+ x="-159.87695"
+ id="tspan3026-6"
+ sodipodi:role="line">"J. R. R. Tolkien"</tspan></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3036-4"
+ y="214.87695"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="214.87695"
+ x="-159.87695"
+ id="tspan3038-0"
+ sodipodi:role="line">"Houghton Mifflin"</tspan></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ sodipodi:linespacing="125%"
+ id="text3040-1"
+ y="234.87695"
+ x="-159.87695"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="234.87695"
+ x="-159.87695"
+ id="tspan3042-2"
+ sodipodi:role="line">"2001"</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ id="path3054-9"
+ d="m 172.29017,128.97032 0,30"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path3056-2"
+ d="m 192.29017,138.97032 0,20"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path3062-6"
+ d="m 212.29017,153.97032 0,5"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path3064-8"
+ d="m 232.29017,128.97032 0,30"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <text
+ class="document"
+ sodipodi:linespacing="125%"
+ id="text3199"
+ y="-0.1230491"
+ x="129.87697"
+ style="font-size:13px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ xml:space="preserve"><tspan
+ y="-0.1230491"
+ x="129.87697"
+ id="tspan3201"
+ sodipodi:role="line">#document</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ id="path3203"
+ d="m 129.87695,4.8769496 0,20.0000004"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <text
+ class="author"
+ style="font-size:12px;text-align:center;text-anchor:middle"
+ x="-95.450188"
+ y="39.876949"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text3072-2-0"
+ xml:space="preserve"><tspan
+ style="text-align:center;text-anchor:middle"
+ x="-114.87695"
+ y="39.876949"
+ id="tspan3074-8-4">author</tspan></text>
+ </g>
+</svg>
--- /dev/null
+<?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>XPath</title>
+
+ <meta http-equiv="Content-Type"
+ content="text/html; charset=utf-8" />
+ <meta name="copyright"
+ content="Copyright © 2013 Kim Nguyễn" />
+
+ <!-- Load jQuery -->
+ <script src="../jquery-1.9.1.min.js" type="text/javascript" ></script>
+ <!-- Load the library -->
+ <script src="../simpleWebSlides.js" type="text/javascript" ></script>
+
+ <link rel="stylesheet" href="../simpleWebSlides.css" type="text/css" media="all" />
+ <!-- Load a custom Theme, the class-element marks this style-sheet
+ a "theme" that can be swtiched dynamicaly -->
+ <link class="sws-theme" rel="stylesheet" title="U-Psud style" href="../themes/uPsud.css" type="text/css" />
+
+ <!-- Customize some templates and initialize -->
+ <style type="text/css">
+ .xml-tag { color: #00486c; }
+
+ </style>
+ <script type="text/javascript">
+ <![CDATA[
+ SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeFadeOutIn;
+ SWS.Config['sws-object-deactivate'] = SWS.Effects.objectDeactivateFadeOut;
+ SWS.Config['sws-object-activate'] = SWS.Effects.objectActivateFadeIn;
+
+ //Ensures that we load SWS at the very end, after MathJax has
+ //been initialized
+
+ $(window).load(function () {
+ $(".inline-xml").each(function(i, elem)
+ {
+ var jelem = $(elem);
+ var code = jelem.html();
+ code = code.replace ("<![CDATA" + "[", "").replace ("]" + "]>", "");
+ code = code.replace (/>/g, ">>>");
+ code = code.replace (/</g, "<span class='xml-tag'><");
+ code = code.replace (/>>>/g,"></span>");
+
+ jelem.html(code);
+ });
+ });
+
+ var checkSVG = function (o, i)
+ {
+ if (i >= 10 || SWS.Utils.isUndefined(o) || o == null) return;
+ var svg = o.getSVGDocument();
+ if (svg == null) {
+ setTimeout(function() { checkSVG(o, i+1); }, 200);
+ } else {
+ var alltext = $(svg).find("text");
+ alltext.css("font-family", "DIN");
+ alltext.css("font-size", "70%");
+
+ };
+ };
+ $(window).load(function() {
+ $("embed").ready(function() {
+ setTimeout(function() {
+ $("embed").each(function(i, o) { checkSVG(this,0); });
+}, 1000);
+ });
+ });
+ $(window).load(SWS.Presentation.init);
+
+ ]]>
+
+ </script>
+
+ </head>
+ <body>
+ <a href="xpi_01.xhtml" class="sws-previous"/>
+ <div class="sws-slide sws-cover sws-option-nofooter">
+ <h1>XML et Programmation Internet</h1>
+ <h1>Cours 2</h1>
+ <a href="mailto:kn@lri.fr">kn@lri.fr</a>
+ </div>
+
+ <h1>Modèle d'arbre</h1>
+<div class="sws-slide">
+
+<h1>XML vu comme un arbre (1/2)</h1>
+<ul>
+<li>Tout ce qui apparait dans le document correspond à un nœud de
+ l'arbre (texte, balises, commentaires, blanc, …)</li>
+<li>Il existe en plus, un nœud fictif se trouvant au dessus de
+ l'élément racine, le <a>nœud document</a></li>
+<li>Un couple balise ouvrante/balise fermante correspond à <a>un seul
+ nœud</a>
+<li>Les principaux types de nœuds sont: élément, attribut, texte,
+ commentaire, document</li>
+</li>
+</ul>
+
+</div>
+ <div class="sws-slide">
+ <h1>XML vu comme un arbre (2/2)</h1>
+ <p>Un document XML peut être vu comme un arbre:</p>
+ <code class="inline-xml" style="font-size:80%;width:50%;position:relative;float:left;"><![CDATA[<bibliography>
+
+ <book>
+ <title>Foundations of Databases</title>
+ <author>Abiteboul</author>
+ <author>Hull</author>
+ <author>Vianu</author>
+ <publisher>Addison Wesley</publisher>
+ <year>1995</year>
+ </book>
+
+ <book>
+ <title>The Lord of the Rings</title>
+ <author>J. R. R. Tolkien</author>
+ <publisher>Houghton Mifflin</publisher>
+ <year>2001</year>
+ </book>
+
+</bibliography>]]></code>
+ <embed src="tree.svg" style="width: 10cm; height: 13cm;" />
+ </div>
+<div class="sws-slide">
+ <h1>Sérialisation d'un arbre sous forme de document</h1>
+ <p class="sws-pause">Étant donné un arbre, comment peut ont produire
+ le document XML correspondant ?</p>
+ <code> //pseudo-code
+ void print(Node n)
+ {
+ if (n is text or comment) { output_text(n) }
+ else {
+ output_text ("<" + tag(n) + ">");
+ for k in children(n)
+ print(k);
+ output_text ("</" + tag(n) + ">");
+ }
+ </code>
+ <ul style="background:white;">
+ <li>On effectue un parcours en profondeur d'abord </li>
+ <li>Si le nœud courant est une feuille, on l'affiche</li>
+ <li>Sinon on affiche la balise ouvrante, puis récursivement tous
+ les fils, puis la balise fermante</li>
+ </ul>
+</div>
+<div class="sws-slide">
+<h1>Ordre du document, parcours préfixe</h1>
+<p>On appelle <a>ordre du document</a> un ordre <a>total</a> sur les
+ nœuds d'un document qui correspond à leur ordre dans un fichier
+ sérialisé. Il correspond aussi à la numérotation lors du parcours
+ préfixe</p>
+<ol style="float:left; width:50%">
+<li>#document</li>
+<li>bibliography</li>
+<li>book</li>
+<li>title</li>
+<li>"Foundations of Databases"</li>
+<li>author</li>
+<li>"Abiteboul"</li>
+<li>author</li>
+<li>"Hull"</li>
+<li>author</li>
+<li>"Vianu"</li>
+</ol>
+ <embed src="tree.svg" style="width: 10cm; height: 13cm;" />
+
+</div>
+<div class="sws-slide">
+<h1>Construction d'un arbre à partir d'un fichier XML ?</h1>
+<p class="sws-slide">Pour simplifier on suppose un fichier sans texte, uniquement avec
+ des balises ouvrantes/fermantes</p>
+<code>
+ type Node = { label : string; children : List<Node> }
+ Stack<Node> stack;
+ stack.push (new Node("#document"), []));
+ while (true) {
+
+ tag = read ();
+ if end_of_file () break;
+ if tag is opening {
+ parent = stack.peek();
+ node = new Node(tag, []);
+ parent.addChild(node);
+ stack.push(node);
+ }
+ if tag is closing {
+ stack.pop();
+ }
+ }
+</code>
+<p class="sws-pause">En pratique, on utilise des bibliothèques toutes faites pour
+ lire/écrire des fichiers!</p>
+</div>
+<h1>XPath, introduction</h1>
+<div class="sws-slide">
+<h1>Intérogation de documents XML</h1>
+<p>Les documents représentant des données (semi-) structurées, on
+ souhaite en extraire de l'information</p>
+<p>On va pouvoir écrire des requêtes sur des <a>critères scalaires</a>
+ (
+« renvoyer tous les livres publiés après 2000 »), mais aussi sur des
+ critères de <a>structure</a> (« renvoyer tous les éléments qui ont
+ un fils <tt>author</tt> »)</p>
+</div>
+<div class="sws-slide">
+<h1>XPath</h1>
+<p>XPath est un langage de <a>selection de nœud</a> dans un document
+ XML. Il ne permet <a>que</a> de sélectionner des nœuds, pas d'en
+ construire de nouveaux. C'est un langage restreint qui ne contient
+ pas de fonctions, variables, … On peut le voir comme un équivalent
+ du <tt>SELECT</tt> de SQL</p>
+</div>
+
+<div class="sws-slide">
+<h1>XPath (exemple)</h1>
+<p>Sélectionner tous les titres du document (de manière compliquée)</p>
+<code> <span style="color:#00f">/</span>descendant::<s>author</s>/parent::<a>book</a>/child::<span style="color:#880088">title</span></code>
+<embed src="tree.svg" style="position:relative;left:20%;width: 10cm; height: 13cm;"/>
+<script type="text/javascript">
+var color = function (o,e, c) {
+ $(o).find("*[class='" + e + "']").css("fill", c);
+}
+SWS.Presentation.registerCallback(0, function (canvas) {
+ var svg = canvas.find("embed")[0].getSVGDocument();
+ $(svg).find("text").css({ "font-family":"DIN", "font-size":"70%"});
+ color(svg, "author", "#ff0000");
+ color(svg, "document", "#0000ff");
+ color(svg, "book", "#92b938");
+ color(svg, "title", "#880088");
+});
+</script>
+</div>
+<div class="sws-slide">
+<h1>XPath : syntaxe</h1>
+<p>La syntaxe d'une requête XPath est:</p>
+<code> /axe<sub>1</sub>::test<sub>1</sub>[ pred<sub>1</sub> ]/ … /axe<sub>n</sub>::test<sub>n</sub>[ pred<sub>n</sub> ]</code>
+<ul>
+<li><a>axe</a>
+ : <tt>self</tt>, <tt>child</tt>, <tt>descendant</tt>, <tt>parent</tt>,
+ …
+</li>
+<li><a>test</a> : <tt>node()</tt>, <tt>text()</tt>, <tt>*</tt>, ou un
+ nom d'élément </li>
+<li> <a>pred(icat)</a> : chemin XPath, expression arithmétique,
+ comparaison, …
+</li>
+<p>exemple:</p>
+<code> /descendant::book[ child::year > 2000] / child::title </code>
+</ul>
+
+</div>
+<div class="sws-slide">
+<h1>XPath : sémantique</h1>
+<p>Étant donné la requête: </p>
+<code> /axe<sub>1</sub>::test<sub>1</sub>[ pred<sub>1</sub> ]/ … /axe<sub>n</sub>::test<sub>n</sub>[ pred<sub>n</sub> ]</code>
+<ol>
+ <li>le <a>nœud contexte</a> au nœud <a>document</a></li>
+ <li>on sélectionne l'ensemble A<sub>1</sub> <a>tous les nœuds</a> qui sont dans
+ l'<tt>axe<sub>1</sub></tt> par rapport au nœud contexte</li>
+ <li>on sélectionne l'ensemble T<sub>1</sub> des nœud de
+ A<sub>1</sub> qui vérifient le test <tt>test<sub>1</sub></tt></li>
+ <li>on sélectionne l'ensemble P<sub>1</sub> des nœud de
+ T<sub>1</sub> qui vérifient <tt>pred<sub>1</sub></tt></li>
+ <li>On réapplique le pas 2 sur <tt>P<sub>1</sub></tt></li>
+ <li> … </li>
+</ol>
+</div>
+<div class="sws-slide">
+<h1>XPath : sémantique (exemple)</h1>
+<div style="width:50%;float:left;">
+<code> <span style="color:#00f">/</span>descendant::<s>author</s>/parent::<a>book</a>/child::<span style="color:#880088">title</span></code>
+<ol><li >On séléctionne le nœud document</li>
+<li >On séléctionne tous les descendants</li>
+<li>On filtre en ne gardant que les nœuds <s>author</s>
+ (T<sub>1</sub> ≡ P<sub>1</sub>)</li>
+<li>Sur chacun des <s>author</s> on prend le parent (on n'obtient que
+ 2 parents car on garde des ensembles de noeuds)</li>
+<li>On filtre les parents pour ne garder que ceux qui
+ sont <a>book</a></li>
+<li>On sélectionne tous les fils de chacun des <a>book</a></li>
+<li>On ne garde que les fils qui ont le
+ tag <span style="color:#880088">title</span></li>
+</ol>
+</div>
+<embed src="tree.svg" style="width: 10cm; height: 13cm;"/>
+<script type="text/javascript">
+SWS.Presentation.registerCallback(0, function (canvas) {
+ var svg = canvas.find("embed")[0].getSVGDocument();
+ $(svg).find("text").css({ "font-family":"DIN", "font-size":"70%"});
+ color(svg, "author", "#ff0000");
+ color(svg, "document", "#0000ff");
+ color(svg, "book", "#92b938");
+ color(svg, "title", "#880088");
+});
+</script>
+</div>
+<div class="sws-slide">
+<h1>XPath : axes</h1>
+<p>Le standard XPath définit un grand nombre d'axes</p>
+<ul>
+<li><a>self</a> : on reste sur le nœud courant</li>
+<li><a>child</a> : tous les fils du nœud courant</li>
+<li><a>parent</a> : le parent du nœud courant. Seul le nœud document
+ n'a pas de parent</li>
+<li><a>descendant</a> : les fils, les fils des fils, etc. du nœud courant</li>
+<li><a>ancestor</a> : le parent, et le parent du parent, etc. du nœud
+ courant</li>
+<li> <a>descendant-or-self</a>, <a>ancestor-or-seld</a> : comme les
+ précédents mais inclus le nœud courant</li>
+<li><a>following-sibling</a>: le frères se trouvant après</li>
+<li><a>preceding-sibling</a>: les frères se trouvant avant</li>
+<li><a>following, preceding, attributes </a> : usage avancé</li>
+</ul>
+</div>
+<div class="sws-slide">
+<h1>XPath : les tests</h1>
+<p>On peut sélectionner des nœuds selon les critères suivants</p>
+<ul>
+ <li> <a>node()</a> : n'importe quel nœud</li>
+ <li> <a>text()</a> : un nœud texte (<tt>"The Lord of the
+ Rings"</tt>)</li>
+ <li> <a>*</a> : n'importe quel élément
+ (<tt>author</tt>, <tt>title</tt>, …)</li>
+ <li> <a><i>nom_d_element</i></a> tous les éléments ayant ce nom</li>
+</ul>
+</div>
+<div class="sws-slide">
+<h1>XPath : prédicats (syntaxe)</h1>
+<code>
+ p ::= p or p
+ | p and p
+ | not (p)
+ | count(…), contains(…), position(), …
+ | chemin XPath
+ | e<sub>1</sub> op e<sub>2</sub>
+</code>
+<p><tt>e<sub>1</sub></tt> et <tt>e<sub>2</sub></tt> sont des
+ expressions arithmétiques, <tt>op</tt> peut être <tt><</tt>, <tt>></tt>, =, !=,
+ +, -, *, /, mod, …</p>
+</div>
+<div class="sws-slide">
+<h1>XPath : prédicats (sémantique)</h1>
+<p>On évalue le prédicat et on converti son résultat en valeur de
+ vérité. Si la valeur vaut vrai, on garde le nœud courant, si elle
+ vaut faux, on ne le garde pas
+</p>
+<p>XPath connait <a>4 types de données</a> pour les prédicats : </p>
+<ul>
+<li>Les booléens, valeur de vérité : vrai ou faux</li>
+<li>Les nombres (flottants), valeur de vérité compliquée… </li>
+<li>Les chaînes de caractères, chaîne vide = faux, sinon vrai</li>
+<li>Les ensembles de nœuds, ensemble vide = faux, sinon vrai </li>
+</ul>
+
+</div>
+<div class="sws-slide">
+<h1>XPath : prédicats (exemples)</h1>
+
+<ul><li> <tt>/descendant::book [ child::title ]</tt> : sélectionne chaque
+ élément book pour lequel l'ensemble des fils de nom title n'est
+ pas vide </li>
+<li> <tt>/descendant::book [ count(child::author) > 2 ]</tt> : séléctionne
+ chaque book qui a plus de deux fils author</li>
+<li> <tt>/descendant::book [ contains(child::title, "Ring") ]</tt></li>
+<li> <code>/descendant::book [ count(child::author) > 2
+ or contains(child::author, "Tolk")
+ ]/child::title</code></li>
+</ul>
+</div>
+<div class="sws-slide">
+<h1>Caractéristiques d'XPath</h1>
+<ul>
+ <li>XPath est un langage standardisé par le W3C</li>
+ <li>Assez verbeux</li>
+ <li>Langage de requêtes <a>monadique</a> (on ne peut renvoyer que
+ des ensembles de nœuds. Par exemple il est impossible de renvoyer
+ des ensembles de paires auteur/titre de livre)</li>
+ <li>Il est assez compliqué à implémenter efficacement</li>
+</ul>
+</div>
+ </body>
+</html>