Thread View: fr.comp.text.xml
1 messages
1 total messages
Started by (TOM)
Fri, 22 Sep 2000 00:00
[XPath] à propos des axes, question d'interprétation
Author: (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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads