//create XPath from you DOM object:
$xpath = new DOMXPath($dom);
foreach($xpath->query("//span[@class='zg_hrsr_rank']") as $rank){
$rank = $rank->textContent;
$trail = array();
foreach($xpath->query('//a',$rank) as $step){
$trail[] = $step->textContent;
}
echo $rank.' '.implode(' > ',$trail)."\n";
}