Chapter 4 : XPath
- M. Boughanem & G. Cabanac
Chapter 4 : XPath M. Boughanem & G. Cabanac Introduction - - PowerPoint PPT Presentation
Chapter 4 : XPath M. Boughanem & G. Cabanac Introduction Document XML = set of tags with a hierarchical organisation (tree-like structure) XPath Language that allows the selection of elements in any XML document thanks to path
2
3
/book/chapter /book/chapter/title /book/chapter[1]/section
book number=1 number=2 Introduction W i t h t h e advent… chapter author John Doe S e a r c h Engines publicationDate=2000 title section title para section chapter title Indexing Leaf = contents Node = tag
4
5
6
Step 1 Step 2
7
book number=1 number=2 Introduction W i t h t h e advent… chapter author John Doe S e a r c h Engines publicationDate=2000 title section title para section chapter title Indexing /
8
9
10
Current Node = context
11
12
13
14
15
16
17
18
19
20
21
22
23
24
– number last() – number position() – number count(nodes*) – nodes* id(object)
– string string(object?) – string concat(string, string, string*) – string starts-with(string, string) – boolean contains(string, string) – string substring-before(string, string) – string substring-after(string, string) – string substring(string, number, number?) – number string-length(string?)
25
– boolean boolean(object) – boolean not(boolean) – boolean true() – boolean false()
– number number(object?) – number sum(noeuds*) – number floor(number) – number ceiling(number) – number round(number)
26
27