I want to parse this xml file and use XPATH retrieve some fields (this is how I see xml file by the way, you can download it from here):
I try the following code to get the edition of the book:
$file_copac = "http://copac.ac.uk/search?isn=$isbn&rn=1&format=XML+-+MODS";
$xml = simplexml_load_file($file_copac) or die("cannot_get_data");
$temp = $xml->xpath('//edition');
var_dump($temp);
I also tried 'edition' but the result is empty array for both:
array(0) { }
I tried full path using '/mods/originInfo[1]/edition' which ended with an XPATH error. I solve problem with this notation:
$edition = (string)$xml->mods->originInfo[1]->edition;
However I wonder the problem with xpath.