Jump to content

Parsing XML, unusual XML tags


ILMV

Recommended Posts

Hello all, I am trying to parse a Google Calendar feed into an object, but for some reason it is omitting certain tags:

 

<gd:when startTime='2009-08-27T07:00:00.000Z' endTime='2009-08-27T14:00:00.000Z' />

 

The gd:when tag is pretty important in my application, and I am assuming it is being ignored because it doesn't follow the <tag></tag> format.

 

I using simplexml.

 

Can anyone help?

 

Many thanks,

ILMV[/code]

Link to comment
https://forums.phpfreaks.com/topic/171616-parsing-xml-unusual-xml-tags/
Share on other sites

Oh dear... it seems as if I forgot to slap a closing code tag in there, sorry.

 

$url="http://www.google.com/calendar/feeds/".$calendar_id."/".$magicCookie."/full?".$query_string;
$sxe = new SimpleXMLElement($url, LIBXML_NOEMPTYTAG, TRUE);
echo($sxe->asXML());

 

This is my current code, the 'LIBXML_NOEMPTYTAG' parameter specifies that any empty tags such as <gd:when /> will be converted to <gd:when></gd:when>

 

Even with this code I still cannot access the gd:when tag (or any other tag formatted similarly), I have been trawling the net like crazy, and some people are suggesting it's because the tag contains a semi colon, a namespace?

 

I have probably cheated slightly by replacing the gd:when tag with gd_when tag, this has solved the problem.

 

Cheers, ILMV

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.