« Programmation XML/XPath » : différence entre les versions
Contenu supprimé Contenu ajouté
Ligne 42 :
|soi, <code>.</code> signifie <code>self::node()</code>
|}
== Exemples ==
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<tronc nom="tronc1">
<branche nom="branche1" epaisseur="gros">
<brindille nom="brindille1">
<feuille nom="feuille1" couleur="marron" />
<feuille nom="feuille2" poids="50" />
<feuille nom="feuille3" />
</brindille>
<brindille nom="brindille2">
<feuille nom="feuille4" poids="90" />
<feuille nom="feuille5" couleur="violet" />
</brindille>
</branche>
<branche nom="branche2">
<brindille nom="brindille3">
<feuille nom="feuille6" />
</brindille>
<brindille nom="brindille4">
<feuille nom="feuille7" />
<feuille nom="feuille8" />
<feuille nom="feuille9" couleur="noir" />
<feuille nom="feuille10" poids="100" />
</brindille>
</branche>
</tronc>
</source>
=== Abréviations ===
* Sélection 1 : toutes les <feuille> d'une <brindille> contenue dans une <branche>, enfant du <tronc>, issu de la racine.
*# Abrégé : /tronc/branche/brindille/feuille
*# Non abrégé : /child::trunk/child::bigBranch/child::smallBranch/child::feuille
* Sélection 2 : The <bigBranch> elements with ‘name’ attribute equal to ‘bb3,’ that are children of the trunk element, which is a child of the root.
*# Abrégé : /trunk/bigBranch[@nom=’bb3’]
*# Non abrégé : /child::trunk/child::bigBranch[attribute::nom=’bb3’]
[[en:XML - Managing Data Exchange/XPath]]
|