On Aug 28, 7:18=A0pm, _why <w... / ruby-lang.org> wrote:
> On Thu, Aug 28, 2008 at 11:40:33PM +0900, Mark wrote:
> > I'm trying to parse an XML document (a google calendar feed), but I
> > have problems when I try to get attributes of a tag with a namespace
> > (ie: a colon).
>
> > Here's my code for this: date =3D
> > entry.at('gd:when').attributes['startTime']
>
> Your query is good. =A0I think it must be something else.
>
> =A0 require 'rubygems'
> =A0 require 'open-uri'
> =A0 require 'hpricot'
>
> =A0 url =3D "http://www.google.com/calendar/feeds/developer-calen...@goog=
le.com/public/full"
> =A0 xml =3D Hpricot.XML(open(url).read)
> =A0 puts xml.at('gd:when').attributes['startTime']
>
> _why

Aha, putting the .XML in the Hpricot call seems to have done the
trick, thanks!

And thanks for creating such a useful tool!