我正在尝试将google xml/atom
Feed转换为对象集合(即POJO)。但我读了一些JAXB
和Xstream
的文档。但这些文档包含简单的XML文档与此相比:
<?xml version="1.0" encoding="UTF-8"?>
<feed gd:etag=""Q3k8fDVSLyt7I2A9XRVaFUgKRgE."" 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=""SXk8fDVSLyt7I2A9XRRWFU4IRww."">
<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=""XR1hbn4UfCt7I2A0MFUmRAh8G3IzfnwscRo.""/>
<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>
此Feed是使用Contacts API v3
从Google服务器生成的。但是只使用点击REST API而不使用Google Sdks。
在这里,我无法使用变量名称gContact:website
创建一个POJO来映射<gContact:website>
xml元素。如果我弄错了,请指导我。