Xpath Flashcards
1
Q
comment sélectionner la racine ?
<? xml version = " 1.0 " encoding = " UTF8 " ? > < addressBook > < address > < firstName > John </ firstName > < surname > Smith </ surname > < email > smithj@world . org </ email > < tel type = " work " > 234 -123 -222 </ tel > </ address > < address > < firstName > Alice </ firstName > < surname > Brown </ surname > < email > Alice . Brown@europe . com </ email > < tel type = " home " > 22 -33 -444 </ tel > < tel type = " work " > 11 -43 -222 </ tel > </ address > < address > < firstName > George </ firstName > < surname > White </ surname > < email > gw@rock . com </ email > </ address > </ addressBook >
A
/adressBook
2
Q
donner 2 expressions pour sélectionner les noeud adresse
<? xml version = " 1.0 " encoding = " UTF8 " ? > < addressBook > < address > < firstName > John </ firstName > < surname > Smith </ surname > < email > smithj@world . org </ email > < tel type = " work " > 234 -123 -222 </ tel > </ address > < address > < firstName > Alice </ firstName > < surname > Brown </ surname > < email > Alice . Brown@europe . com </ email > < tel type = " home " > 22 -33 -444 </ tel > < tel type = " work " > 11 -43 -222 </ tel > </ address > < address > < firstName > George </ firstName > < surname > White </ surname > < email > gw@rock . com </ email > </ address > </ addressBook >
A
//address
/adressBook/address
/child::address
3
Q
3 qui permettent de sélectionner le noeud <firstName>Alice<firstName></firstName></firstName>
<? xml version = " 1.0 " encoding = " UTF8 " ? > < addressBook > < address > < firstName > John </ firstName > < surname > Smith </ surname > < email > smithj@world . org </ email > < tel type = " work " > 234 -123 -222 </ tel > </ address > < address > < firstName > Alice </ firstName > < surname > Brown </ surname > < email > Alice . Brown@europe . com </ email > < tel type = " home " > 22 -33 -444 </ tel > < tel type = " work " > 11 -43 -222 </ tel > </ address > < address > < firstName > George </ firstName > < surname > White </ surname > < email > gw@rock . com </ email > </ address > </ addressBook >
A
/adressBook/address/firstName[text()=’Alice’]
//firstName[text()=’Alice’]
//adress[2]/firstName
/adressBook/[2]/firstName
/adressBook/[1]/following-sibling::node()/firstName[text()=’Alice’]
4
Q
//email[text()=’gw@rock.com’]/../firstName/following-sibling::node() ?
<? xml version = " 1.0 " encoding = " UTF8 " ? > < addressBook > < address > < firstName > John </ firstName > < surname > Smith </ surname > < email > smithj@world . org </ email > < tel type = " work " > 234 -123 -222 </ tel > </ address > < address > < firstName > Alice </ firstName > < surname > Brown </ surname > < email > Alice . Brown@europe . com </ email > < tel type = " home " > 22 -33 -444 </ tel > < tel type = " work " > 11 -43 -222 </ tel > </ address > < address > < firstName > George </ firstName > < surname > White </ surname > < email > gw@rock . com </ email > </ address > </ addressBook >
que sélectionne le Xpath fournis ?
A