有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

如何将google xml提要转换为java对象集合

我正在尝试将googlexml/atom提要转换为对象集合(即pojo)。但是我读了一些{}和{}的文档。但与此相比,它们有简单的XML文档:

<?xml version="1.0" encoding="UTF-8"?>
<feed gd:etag="&quot;Q3k8fDVSLyt7I2A9XRVaFUgKRgE.&quot;" xmlns="http://www.w3.org/2005/Atom" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gContact="http://schemas.google.com/contact/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">
 <id>yogeshseralia98@gmail.com</id>
 <updated>2015-08-14T11:02:32.774Z</updated>
 <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"/>
 <title>Yogesh Seralia's Contacts</title>
 <link rel="alternate" type="text/html" href="https://www.google.com/"/>
 <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/yogeshseralia98%40gmail.com/full"/>
 <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/yogeshseralia98%40gmail.com/full"/>
 <link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/yogeshseralia98%40gmail.com/full/batch"/>
 <link rel="self" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/yogeshseralia98%40gmail.com/full?max-results=25"/>
 <author>
  <name>Yogesh Seralia</name>
  <email>yogeshseralia98@gmail.com</email>
 </author>
 <generator version="1.0" uri="http://www.google.com/m8/feeds">Contacts</generator>
 <openSearch:totalResults>25</openSearch:totalResults>
 <openSearch:startIndex>1</openSearch:startIndex>
 <openSearch:itemsPerPage>25</openSearch:itemsPerPage>
 <entry gd:etag="&quot;SXk8fDVSLyt7I2A9XRRWFU4IRww.&quot;">
  <id>http://www.google.com/m8/feeds/contacts/yogeshseralia98%40gmail.com/base/14e49898ff5258e</id>
  <updated>2015-03-05T05:08:08.774Z</updated>
  <app:edited xmlns:app="http://www.w3.org/2007/app">2015-03-05T05:08:08.774Z</app:edited>
  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"/>
  <title>World of Level Design</title>
  <link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*" href="https://www.google.com/m8/feeds/photos/media/yogeshseralia98%40gmail.com/14e49898ff5258e" gd:etag="&quot;XR1hbn4UfCt7I2A0MFUmRAh8G3IzfnwscRo.&quot;"/>
  <link rel="self" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/yogeshseralia98%40gmail.com/full/14e49898ff5258e"/>
  <link rel="edit" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/yogeshseralia98%40gmail.com/full/14e49898ff5258e"/>
  <gd:name>
   <gd:fullName>World of Level Design</gd:fullName>
   <gd:givenName>World</gd:givenName>
   <gd:additionalName>of Level</gd:additionalName>
   <gd:familyName>Design</gd:familyName>
  </gd:name>
  <gd:email rel="http://schemas.google.com/g/2005#home" address="alex@worldofleveldesign.com" primary="true"/>
  <gContact:website href="http://www.google.com/profiles/118120233525415358578" rel="profile"/>
 </entry>
<feed>

此提要是使用Contacts API v3从google服务器生成的。但只使用RESTAPI,不使用GoogleSDK

在这里,我无法将变量名为gContact:website的POJO映射到<gContact:website>xml元素。如果我错了,请引导我


共 (0) 个答案