使用Java从Google日历服务读取XML响应

使用Java从Google日历服务读取XML响应,java,xml,google-calendar-api,gdata-api,Java,Xml,Google Calendar Api,Gdata Api,我想使用Google日历API中提供的新查询繁忙时间API检索用户的繁忙时间。结果是一个只读提要,其中包含用户的繁忙时间块,如下所示: <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

我想使用Google日历API中提供的新查询繁忙时间API检索用户的繁忙时间。结果是一个只读提要,其中包含用户的繁忙时间块,如下所示:

<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>
AppEngine支持(自1.2.8起)JAXB XML到对象数据绑定API。web上有许多示例和教程(尽管大多数侧重于从XML模式自动生成类-您不需要这些)。例如:


或者,您可以使用,完全放弃XML转换步骤。

谢谢,您的回答非常有用,但我意识到我问错了问题。我已经编辑并重新命名了我的文章。非常感谢你让我朝着正确的方向思考。
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);