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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.