xPath query not working as expected. Nodelist is empty

DeadShot80

New Member
I have following HTML segment,
QqN2R.png
I am using xPath in PHP with DOM to fetch all the anchor tags inside the DIV using following xPath query:\[code\]//div[@id="breadcrumbs"]/a\[/code\]I expect that the above query should return NodeList of all the anchor tags, which should be 3 in the case of above HTML. I am not getting anything and my following PHP code is skipping\[code\] $breadCrumb = $xpath->query('//div[@id="breadcrumbs"]/a'); if($breadCrumb->length){ $ctr = 0; $sections = ""; foreach($breadCrumb as $section){ //$productBreadCrumb['section_'.$ctr] = $section->nodeValue; $sections .= $section->nodeValue."|"; $ctr++; } $productData['sections'] = $sections; }\[/code\]I need guidance here. Very much appreciated.EDIT: Added the page which I am trying to fetch from DOM based on xPath query on the above mentioned segment of Div id="breadcumbs"> a a ahttp://www.5starhookah.com/Apex-Black-NEW-A342.htmthanksthanks
 
Back
Top