Reading XML responses from Google Calendar service with Java -
i want retrieve user's busy times using new querying busy times api provided part of google calendar api. result read-only feed containing user's blocks of busy-times looks following:
<entry xmlns="http://www.w3.org/2005/atom" xmlns:gcal="http://schemas.google.com/gcal/2005" xmlns:gd="http://schemas.google.com/g/2005" gd:kind='calendar#freebusy' > <id>http://www.google.com/calendar/feeds/default/freebusy/busy-times/liz%40example.com</id> <updated>2010-03-13t00:00:00.000z</udpated> <link rel='self' href='https://www.google.com/calendar/feeds/default/freebusy/busy-times/liz%40example.com' /> <author> <name>liz@example.com</name> <email>liz@example.com</email> </author> <gcal:timerange> <gd:when starttime='2010-03-13t00:00:00z' endtime='2010-03-14t00:00:00z'/> <gcal:timerange> <gcal:busy> <gd:when starttime='2010-03-13t14:00z' endtime='2010-03-13t14:30z'/> </gcal:busy> <gcal:busy> <gd:when starttime='2010-03-13t16:00z' endtime='2010-03-13t16:30z'/> </gcal:busy> </entry>
based on above return feed, how can use calendar data api java each block of busy time can read , them printing terminal? type of feed returns, calendareventfeed, calendarfeed,...?
calendarservice service = new calendarservice("myapp-v1"); service.setoauthcredentials(oauthparameters, new oauthhmacsha1signer()); url feedurl = new url(metafeed_url_base+freebusy_feed_url_suffix+user.username()); calendareventfeed resultfeed = service.getfeed(feedurl, calendareventfeed.class);
appengine supports (since 1.2.8) jaxb xml-to-objects data binding api. there many examples , tutorials on web (although focus on automatic class generation xml schema - not need this). example: http://www.vogella.de/articles/jaxb/article.html
alternatively use calendar data api java, , forgo xml conversion step altogether.
Comments
Post a Comment