Jump to content

Namespace prefix problem parsing google calendar


bsyapril88

Recommended Posts

Hey everyone,

 

I'm attempting to parse through the google calendar feed.  The problem comes with parsing the "where" tag.  When an address is in the "where" it comes back blank; however, when it is just a word, it works fine.

 

It seems that with an address google adds a  <georss:where> tag on top of the normal <gd:where> tag making the php check the wrong tag.

 

I have been experimenting with getElementsByTagNameNS() but I keep getting errors.  What's the proper way to grab the "gd:where" and not the "georss:where".

 

The PHP:

$entries = $doc->getElementsByTagName( "entry" ); 
foreach ( $entries as $entry ) { 
...
$places = $entry->getElementsByTagName("where"); 			
$where = $places->item(1)->getAttributeNode("valueString")->value;

 

 

The XML:

 

<georss:where>
      <gml:Point>
        <gml:pos>46.46261 -109.39144</gml:pos>
      </gml:Point>
    </georss:where>
    <gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'/>
    <gd:transparency value='http://schemas.google.com/g/2005#event.transparent'/>
    <gCal:uid value='[email protected]'/>
    <gCal:sequence value='2'/>
    <gd:when startTime='2009-09-08T10:00:00.000-04:00' endTime='2009-09-08T11:00:00.000-04:00'/>
    <gd:who rel='http://schemas.google.com/g/2005#event.organizer' valueString='UF Theatre Department Dates of Interest' email='[email protected]'/>
    <gd:where valueString='1004 1st Dr. Orlando, FL 32809'/>

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.