repeating search function in xml file best practice


I’ve got a working solution, but I ask myself about its performances.

My application fetch dayly, using a soap service, some xml files. I keep them all the day long on the server’s hd.

In my db schema, I’ve got tables wich stores unique id’s (named code below) related to the id’s that are in these xml files.

For displaying a data from a xml file in a GridView I use functions like that one


public function getPilote($code)


		$pilotesListe = simplexml_load_file('xml/pilotes.xml');

		$search = "//pilote[code='$code']";

		$pilotes = $pilotesListe->xpath($search);

		foreach($pilotes as $pilote){echo $pilote->nomPrenom;}


So, this function (and some others) is called for each row of the grid.

As I said, it works, but it doesn’t really satisfy me. I’m sure there must be a better solution (especially loading the xml file only one time for the entire grid rows).

Any suggestion is welcome.