如何用Google APIs和Google的应用系统进行集成(8)----如何把Google Blogger(博客)的JSON Schema转换成XML的Schema(XSD)?
来源:互联网 发布:淘宝捡漏是什么意思 编辑:程序博客网 时间:2024/06/05 04:31
在Google RESTFul API中,Google Blogger API(Google博客API)应该和我们的生活离得最近;因为几乎很多人每天都在看博客,都在写博客,都听说过博客。在前面的Google的应用系统进行集成(5)和Google的应用系统进行集成(6)的系列文章中,我们提到了如何把Google Calendar和Google Tasks的JSON Schema转换成XML的XSD的Schema;从博客的访问量来看,还是有很多志同道合的朋友们对这个比较感兴趣,因此,这个章节,我继续给大家奉献和分享一下如何把Google Blogger的JSON Schema转换成XML的Schema(XSD)。首先我们先列出Google Blogger的JSON的Schema(https://www.googleapis.com/discovery/v1/apis/blogger/v3/rest)
那么,如何把Google Blogger的JSON Schema转换成XML的XSD Schema?XML的Schema将会是什么样子的呢?请参考下面转换实现。
<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:complexType name="Blog"><xs:sequence><xs:element name="customMetaData" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="description" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="locale" type="locale" form="unqualified" minOccurs="0"/><xs:element name="name" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="pages" type="pages" form="unqualified" minOccurs="0"/><xs:element name="posts" type="posts" form="unqualified" minOccurs="0"/><xs:element name="published" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="updated" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="url" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="BlogList"><xs:sequence><xs:element name="blogUserInfos" type="BlogUserInfo" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="items" type="Blog" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="BlogPerUserInfo"><xs:sequence><xs:element name="blogId" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="hasAdminAccess" type="xs:boolean" form="unqualified" minOccurs="0"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="photosAlbumKey" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="role" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="userId" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="BlogUserInfo"><xs:sequence><xs:element name="blog" type="Blog" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="blog_user_info" type="BlogPerUserInfo" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="Blogimages"><xs:sequence><xs:element name="items" type="Blogitems" form="unqualified" minOccurs="0" maxOccurs="unbounded"/></xs:sequence></xs:complexType><xs:complexType name="Blogitems"><xs:sequence><xs:element name="url" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="Comment"><xs:sequence><xs:element name="author" type="author" form="unqualified" minOccurs="0"/><xs:element name="blog" type="blog" form="unqualified" minOccurs="0"/><xs:element name="content" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="inReplyTo" type="inReplyTo" form="unqualified" minOccurs="0"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="post" type="post" form="unqualified" minOccurs="0"/><xs:element name="published" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="status" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="updated" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="CommentList"><xs:sequence><xs:element name="items" type="Comment" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="nextPageToken" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="prevPageToken" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="Page"><xs:sequence><xs:element name="author" type="author" form="unqualified" minOccurs="0"/><xs:element name="blog" type="blog" form="unqualified" minOccurs="0"/><xs:element name="content" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="published" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="status" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="title" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="updated" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="url" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="PageList"><xs:sequence><xs:element name="items" type="Page" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="Pageviews"><xs:sequence><xs:element name="blogId" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="counts" type="Pageviewsitems" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="Pageviewscounts"><xs:sequence><xs:element name="items" type="Pageviewsitems" form="unqualified" minOccurs="0" maxOccurs="unbounded"/></xs:sequence></xs:complexType><xs:complexType name="Pageviewsitems"><xs:sequence><xs:element name="count" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="timeRange" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="Post"><xs:sequence><xs:element name="author" type="author" form="unqualified" minOccurs="0"/><xs:element name="blog" type="blog" form="unqualified" minOccurs="0"/><xs:element name="content" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="customMetaData" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="images" type="Blogimages" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/> <xs:element name="labels" form="unqualified" type="xs:string" minOccurs="0" maxOccurs="unbounded"/><xs:element name="location" type="location" form="unqualified" minOccurs="0"/><xs:element name="published" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="replies" type="replies" form="unqualified" minOccurs="0"/><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="status" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="title" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="titleLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="updated" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="url" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="PostList"><xs:sequence><xs:element name="items" type="Post" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="nextPageToken" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="PostPerUserInfo"><xs:sequence><xs:element name="blogId" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="hasEditAccess" type="xs:boolean" form="unqualified" minOccurs="0"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="postId" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="userId" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="PostUserInfo"><xs:sequence><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="post" type="Post" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="post_user_info" type="PostPerUserInfo" form="unqualified" minOccurs="0" maxOccurs="unbounded"/></xs:sequence></xs:complexType><xs:complexType name="PostUserInfosList"><xs:sequence><xs:element name="items" type="PostUserInfo" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="nextPageToken" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="User"><xs:sequence><xs:element name="about" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="blogs" type="blogs" form="unqualified" minOccurs="0"/><xs:element name="created" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="displayName" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="kind" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="locale" type="locale" form="unqualified" minOccurs="0"/><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="url" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="author"><xs:sequence><xs:element name="displayName" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="image" type="image" form="unqualified" minOccurs="0"/><xs:element name="url" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="blog"><xs:sequence><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="blogs"><xs:sequence><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="image"><xs:sequence><xs:element name="url" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="inReplyTo"><xs:sequence><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="locale"><xs:sequence><xs:element name="country" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="language" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="variant" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="location"><xs:sequence><xs:element name="lat" type="xs:double" form="unqualified" minOccurs="0"/><xs:element name="lng" type="xs:double" form="unqualified" minOccurs="0"/><xs:element name="name" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="span" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="pages"><xs:sequence><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="totalItems" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="post"><xs:sequence><xs:element name="id" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="posts"><xs:sequence><xs:element name="items" type="Post" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="totalItems" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:complexType name="replies"><xs:sequence><xs:element name="items" type="Comment" form="unqualified" minOccurs="0" maxOccurs="unbounded"/><xs:element name="selfLink" type="xs:string" form="unqualified" minOccurs="0"/><xs:element name="totalItems" type="xs:string" form="unqualified" minOccurs="0"/></xs:sequence></xs:complexType><xs:element name="Blog" type="Blog"/><xs:element name="BlogList" type="BlogList"/><xs:element name="BlogPerUserInfo" type="BlogPerUserInfo"/><xs:element name="BlogUserInfo" type="BlogUserInfo"/><xs:element name="Comment" type="Comment"/><xs:element name="CommentList" type="CommentList"/><xs:element name="Page" type="Page"/><xs:element name="PageList" type="PageList"/><xs:element name="Pageviews" type="Pageviews"/><xs:element name="Post" type="Post"/><xs:element name="PostList" type="PostList"/><xs:element name="PostPerUserInfo" type="PostPerUserInfo"/><xs:element name="PostUserInfo" type="PostUserInfo"/><xs:element name="PostUserInfosList" type="PostUserInfosList"/><xs:element name="User" type="User"/></xs:schema>
2 0
- 如何用Google APIs和Google的应用系统进行集成(8)----如何把Google Blogger(博客)的JSON Schema转换成XML的Schema(XSD)?
- 如何用Google APIs和Google的应用系统进行集成(5)----如何把Google Tasks的JSON Schema转换成XML的Schema(XSD)?
- 如何用Google APIs和Google的应用系统进行集成(6)----如何把Google Calendar的JSON Schema转换成XML的Schema(XSD)?
- 如何用Google APIs和Google的应用系统进行集成(1)----Google APIs简单介绍
- 如何用Google APIs和Google的应用系统进行集成(7)----在把JSON转换成XML数据过程中,JSON数据中包含违背XML数据规范:XML节点名不支持数字的Java解决方案
- 如何用Google APIs和Google的应用系统进行集成(2)----Google APIs的所有的RESTFul服务一览
- 如何用Google APIs和Google的应用系统进行集成(3)----调用Google 发现(Discovery)API的RESTful服务
- 如何用Google APIs和Google的应用系统进行集成(4)----获得Access Token以通过一些Google APIs的OAuth2认证
- Google送给中国博客的礼物,中文版Blogger.com
- 如何将XML转换成XSD(XML Schema)文件
- 如何用Qt实现对Google API的应用(2)-- OAuth的各步骤实现
- 通过google的gson把xml转成json
- google/yahoo部分员工的blogger
- Google的blogger可以访问了
- google/yahoo部分员工的blogger
- XML文件和XSD(xml schema definition)文件的完整例子
- 如何用Qt实现对Google API的应用(1)-- OAuth认证详述
- XML Schema (XSD)
- 用1,2,3,4,5,6,7,8,9这9个数字组成一个九位数。
- 上海传智播客05期Java就业班学员薪资更新
- sql case when then 行转换成列
- Linux命令 之 sed(一)
- servlet 过滤器
- 如何用Google APIs和Google的应用系统进行集成(8)----如何把Google Blogger(博客)的JSON Schema转换成XML的Schema(XSD)?
- 函数指针
- 分享45个android实例源码,很好很强大.收藏吧!!!
- 2014/6/19
- JAVA Applet小程序-运用Math类画圆
- 单链表的创建--带头结点
- Cocos2d-x win下环境搭建及其介绍
- Cocos2d-x 3.0beta与windows&…
- Effective C++:条款31:将文件间的编译依存关系将至最低