Here I am trying to read a few elements which contain <xCal:x-calconnect>
in them.
Here is the structure of item node inside an xml file(irrelevant nodes omitted):
<item>
<xCal:location>http://www.eventbrite.com/e/11610813255?aff=es2</xCal:location>
<xCal:x-calconnect-venue>
<xCal:adr>
<xCal:x-calconnect-venue-name>Colony Bar</xCal:x-calconnect-venue-name>
<xCal:x-calconnect-street>24 Hertford Street</xCal:x-calconnect-street>
<xCal:x-calconnect-region>Gt Lon</xCal:x-calconnect-region>
<xCal:x-calconnect-city>London</xCal:x-calconnect-city>
<xCal:x-calconnect-country>GB</xCal:x-calconnect-country>
</xCal:adr>
</xCal:x-calconnect-venue>
<xCal:url type="Event Website">http://www.eventbrite.com/e/11610813255?aff=es2</xCal:url>
<xCal:x-calconnect-organizer>
<xCal:x-calconnect-organizer-name>Young Professionals London</xCal:x-calconnect-organizer-name>
</xCal:x-calconnect-organizer>
</item>
And here is my best try to read them:
$rawFeed = file_get_contents($url);
$xml = simplexml_load_string($rawFeed);
foreach($xml->channel->item as $item)
{
$itemxcal=$item->children('xCal', true)->location;
$itemx=$item->children('xCal:x-calconnect', true)->organizer->children('xCal:x-calconnect-organizer', true)->name;
$itemvenue=$item->children('xCal:x-calconnect', true)->venue->children('xCal', true)->adr->children('xCal:x-calconnect', true)->street;
echo $itemx, $itemxcal"<br />";
}
I can read the location node without a problem, but things start getting interesting when I try to read either organizer name or any information about the venue. I get errors like "Warning: main(): Node no longer exists" OR I get totally nothing when removing the part after "->organizer". As I mentioned there's no problem with reading location. Works perfectly. All help is appreciated!