I have the following XML file :
-
[...]
This solution includes reference to the Wordpress XML namespace:
$doc = new SimpleXmlElement($xml);
$doc->registerXPathNamespace ('wp', 'http://wordpress.org/export/1.0/');
$wp_meta_title = $doc->xpath("//wp:postmeta[wp:meta_key = '_yoast_wpseo_title']/wp:meta_value");
foreach ($wp_meta_title as $title) {
echo (string)$title . "\n";
}
result:
item-1-title
item-2-title
See http://ideone.com/qjOfIW
The path //wp:postmeta[wp:meta_key = '_yoast_wpseo_title']/wp:meta_value
is pretty straight-forward, I don't think it needs special explanation.