bonjour à tous,
j'ai u nfichier xml comme ceci :
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 <?xml version="1.0" encoding="ISO-8859-1" ?> <mobibase> <song id_song="5089"> <title>Let_It_Be</title> <artist>The_Beatles</artist> <date_added>2006-01-04</date_added> <date_update>2006-01-09</date_update> <file id_file="134"> <nom>000134-The_Beatles-Let_It_Be.mp3</nom> <track_type>Instrumental</track_type> <crc32>435948014</crc32> <size>5514057</size> </file> </song </mobibase>
si je fait cette requête Xpath, il me retourne aucuns résultat, et je ne vois pas pk :
par contre si je recherche tt les song ("//mobibase/son")
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 $xmlObject = new DomDocument(); $xmlObject->load($fichierXML); $xmlPath = new DomXpath($xmlObject); $songXpath = "//mobibase/song[id_song=\"5089\"]"; $result = $xmlPath->query($songXpath); echo $result->length."<br>";
cela fonctionne.
seriez-vous pourquoi ?
Partager