I do have the following SimpleXMLElement:
SimpleXMLElement {#812 ▼
+"title": "Telas x Metro"
+"link": SimpleXMLElement {#876 ▶}
+"updated": "2020-09-16T15:36:53Z"
+"author": SimpleXMLElement {#883 ▶}
+"id": "/googleshopping.xml"
+"entry": array:4 [▼
0 => SimpleXMLElement {#881 ▶}
1 => SimpleXMLElement {#895 ▶}
2 => SimpleXMLElement {#893 ▶}
3 => SimpleXMLElement {#873 ▶}
]
}
And I would like to access to the entry element and the do a foreach on it. but when I do this:
var_dump($xml->entry)
I only get first element
and if i do this:
var_dump($xml->xpath('//entry'))
I get a empty array.
this is the xml file: http://www.telasxmetro.com/XMLData/googleshopping.xml
This is my code:
xml = simplexml_load_file(
's3://'.env('AWS_BUCKET').'/'.$path,//this is the same xml.
'SimpleXMLElement',
LIBXML_NOCDATA
);
foreach ($xml->xpath('//entry') as $item) {
//empty array, so dont enter the loop.
}