Article View: fr.comp.text.xml
Article #10540[XPath] à propos des axes, question d'interprétation
From: (TOM)
Date: Fri, 22 Sep 2000 00:00
Date: Fri, 22 Sep 2000 00:00
75 lines
3634 bytes
3634 bytes
Bonjour,
j'aurai besoin de pr�cisions � propos des axes d'XPath.
Soit l'arbre suivant (en admettant que les noms donn�s soient des
identifiants, chaque noeud est un �l�ment) :
Root_Element
|- node_1
| |- node_1_1
| | '- node_1_1_1
| '- node_1_2
|- node_2
| |- node_2_1
| | |- node_2_1_1
| | | |- node_2_1_1_1
| | | '- node_2_1_1_2
| | '- node_2_1_2
| '- node_2_2
| '- node_2_2_1
'- node_3
|- node_3_1
'- node_3_2
et soit node_2_1 le noeud courant (context node).
Alors les expressions XPath suivantes s�lectionnent respectivement :
- self::* <=> node_2_1
- child::* <=> node_2_1_1 et node_2_1_2
- descendant::* <=> node_2_1_1, node_2_1_1_1, node_2_1_1_2 et
node_2_1_2
- descendant-or-self::* <=> node_2_1 plus les pr�c�dents
- parent::* <=> node_2
- ancestor::* <=> node_2 et Root_Element
- ancestor-or-self::* <=> node_2_1 plus les pr�c�dents
- following-sibling::* <=> node_2_2
- preceding-sibling::* <=> [rien]
- following::* <=> node_2_2, node_2_2_1, node_3, node_3_1 et
node_3_2
- preceding::* <=> node_1_2, node_1_1_1, node_1_1 et node_1
C'est ca ?
Je me pose des questions au niveau de following::* et preceding::*
J'ai reproduit cet arbre en image <http://ptittom.free.fr/xml.png> avec mise
en couleur :
- du noeud courant (en bleu encadr� de rouge) : self::*
- des anc�tres (en rose) : ancestor::*
- des descendants (en jaune) : descendant::*
- des suivants (en violet) : following::*
- des pr�c�dents (en vert) : preceding::*
La REC dit :
"the following axis contains all nodes in the same document as the context
node that are after the context node in document order, excluding any
descendants and excluding attribute nodes and namespace nodes
"the preceding axis contains all nodes in the same document as the context
node that are before the context node in document order, excluding any
ancestors and excluding attribute nodes and namespace nodes
Ca me semble donc bon.
Plus loin :
"NOTE: The ancestor, descendant, following, preceding and self axes
partition a document (ignoring attribute and namespace nodes): they do not
overlap and together they contain all the nodes in the document.
Ca me semble convenir aussi.
Question donc : est-ce que j'interpr�te bien ?
Question subsidiaire : � quoi peut donc bien servir l'axe self s'il ne
contient que le noeud courant ? Quels QName peut-on mettre apr�s ? Que donne
self::para si l'�l�ment courant n'est pas un �l�ment <para/> ?
Merci d'avance pour toute r�ponse.
Technical Details
Message-ID:
<3YPy5.2208$le.3776617@nnrp4.proxad.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII X-Google-Thread: 114f60,8cc937d6e08a7719,start X-Google-Attributes: gid114f60,public From: "(TOM)" <ptittom@free.fr> Subject: [XPath] à propos des axes, question d'interprétation Date: 2000/09/22 Message-ID: <3YPy5.2208$le.3776617@nnrp4.proxad.net> X-Deja-AN: 673010031 Content-Transfer-Encoding: 8bit X-Trace: nnrp4.proxad.net 969657215 164.138.144.186 (Fri, 22 Sep 2000 23:13:35 CEST) Organization: Guest of ProXad - France X-MSMail-Priority: Normal X-Priority: 3 Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 NNTP-Posting-Date: Fri, 22 Sep 2000 23:13:35 CEST X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Newsgroups: fr.comp.text.xml X-Complaints-To: abuse@proxad.net