有Google Task的地方,一般都会有Google Calendar,我在上个章节给大家分享了,如何用Google APIs和Google的应用系统进行集成(5)----如何把Google Tasks的JSON Schema转换成XML的Schema(XSD)?(http://blog.csdn.net/chancein007/article/details/29645055),那么Google Calendar的JSON Schema转换成XML的Schema将会是什么样子的呢?首先我们先列出Google Calendar的JSON的Schema(https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest)
那么,如何把Google Calendar的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="Acl">
<xs:sequence>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="items" form="unqualified" type="AclRule" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="nextPageToken" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="nextSyncToken" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AclRule">
<xs:sequence>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="role" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="scope" form="unqualified" type="scope" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Calendar">
<xs:sequence>
<xs:element name="description" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="location" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="summary" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="timeZone" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CalendarList">
<xs:sequence>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="items" form="unqualified" type="CalendarListEntry" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="nextPageToken" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="nextSyncToken" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CalendarListEntry">
<xs:sequence>
<xs:element name="accessRole" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="backgroundColor" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="colorId" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="defaultReminders" form="unqualified" type="EventReminder" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="deleted" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="description" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="foregroundColor" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="hidden" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="location" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="notificationSettings" form="unqualified" type="notificationSettings" minOccurs="0"/>
<xs:element name="primary" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="selected" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="summary" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="summaryOverride" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="timeZone" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CalendarNotification">
<xs:sequence>
<xs:element name="method" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="type" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Channel">
<xs:sequence>
<xs:element name="address" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="expiration" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="params" form="unqualified" type="params" minOccurs="0"/>
<xs:element name="payload" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="resourceId" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="resourceUri" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="token" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="type" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ColorDefinition">
<xs:sequence>
<xs:element name="background" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="foreground" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Colors">
<xs:sequence>
<xs:element name="calendar" form="unqualified" type="calendar" minOccurs="0"/>
<xs:element name="event" form="unqualified" type="event" minOccurs="0"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="updated" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Error">
<xs:sequence>
<xs:element name="domain" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="reason" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Event">
<xs:sequence>
<xs:element name="anyoneCanAddSelf" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="attendees" form="unqualified" type="EventAttendee" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="attendeesOmitted" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="colorId" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="created" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="creator" form="unqualified" type="creator" minOccurs="0"/>
<xs:element name="description" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="end" form="unqualified" type="EventDateTime" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="endTimeUnspecified" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="extendedProperties" form="unqualified" type="extendedProperties" minOccurs="0"/>
<xs:element name="gadget" form="unqualified" type="gadget" minOccurs="0"/>
<xs:element name="guestsCanInviteOthers" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="guestsCanModify" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="guestsCanSeeOtherGuests" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="hangoutLink" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="htmlLink" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="iCalUID" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="location" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="locked" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="organizer" form="unqualified" type="organizer" minOccurs="0"/>
<xs:element name="originalStartTime" form="unqualified" type="EventDateTime" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="privateCopy" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="recurringEventId" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="reminders" form="unqualified" type="reminders" minOccurs="0"/>
<xs:element name="sequence" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="source" form="unqualified" type="source" minOccurs="0"/>
<xs:element name="start" form="unqualified" type="EventDateTime" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="status" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="summary" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="transparency" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="updated" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="visibility" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EventAttendee">
<xs:sequence>
<xs:element name="additionalGuests" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="comment" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="displayName" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="email" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="optional" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="organizer" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="resource" form="unqualified" type="xs:boolean" minOccurs="0"/>
<xs:element name="responseStatus" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="self" form="unqualified" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EventDateTime">
<xs:sequence>
<xs:element name="date" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="dateTime" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="timeZone" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EventReminder">
<xs:sequence>
<xs:element name="method" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="minutes" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Events">
<xs:sequence>
<xs:element name="accessRole" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="defaultReminders" form="unqualified" type="EventReminder" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="description" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="items" form="unqualified" type="Event" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="nextPageToken" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="nextSyncToken" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="summary" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="timeZone" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="updated" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FreeBusyCalendar">
<xs:sequence>
<xs:element name="busy" form="unqualified" type="TimePeriod" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="errors" form="unqualified" type="Error" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FreeBusyGroup">
<xs:sequence>
<xs:element name="errors" form="unqualified" type="Error" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FreeBusyRequest">
<xs:sequence>
<xs:element name="calendarExpansionMax" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="groupExpansionMax" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="items" form="unqualified" type="FreeBusyRequestItem" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="timeMax" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="timeMin" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="timeZone" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FreeBusyRequestItem">
<xs:sequence>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FreeBusyResponse">
<xs:sequence>
<xs:element name="calendars" form="unqualified" type="calendars" minOccurs="0"/>
<xs:element name="groups" form="unqualified" type="groups" minOccurs="0"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="timeMax" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="timeMin" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Setting">
<xs:sequence>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="value" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Settings">
<xs:sequence>
<xs:element name="etag" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="items" form="unqualified" type="Setting" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="kind" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="nextPageToken" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="nextSyncToken" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TimePeriod">
<xs:sequence>
<xs:element name="end" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="start" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="calendar">
<xs:sequence>
<xs:element name="additionalProperties" form="unqualified" type="ColorDefinition" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="calendars">
<xs:sequence>
<xs:element name="additionalProperties" form="unqualified" type="FreeBusyCalendar" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="creator">
<xs:sequence>
<xs:element name="displayName" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="email" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="self" form="unqualified" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="event">
<xs:sequence>
<xs:element name="additionalProperties" form="unqualified" type="ColorDefinition" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="extendedProperties">
<xs:sequence>
<xs:element name="private" form="unqualified" type="private" minOccurs="0"/>
<xs:element name="shared" form="unqualified" type="shared" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="gadget">
<xs:sequence>
<xs:element name="display" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="height" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="iconLink" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="link" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="preferences" form="unqualified" type="preferences" minOccurs="0"/>
<xs:element name="title" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="type" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="width" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="groups">
<xs:sequence>
<xs:element name="additionalProperties" form="unqualified" type="FreeBusyGroup" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="notificationSettings">
<xs:sequence>
<xs:element name="notifications" form="unqualified" type="CalendarNotification" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="organizer">
<xs:sequence>
<xs:element name="displayName" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="email" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="id" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="self" form="unqualified" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="params">
<xs:sequence>
<xs:element name="additionalProperties" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="preferences">
<xs:sequence>
<xs:element name="additionalProperties" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="private">
<xs:sequence>
<xs:element name="additionalProperties" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="reminders">
<xs:sequence>
<xs:element name="overrides" form="unqualified" type="EventReminder" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="useDefault" form="unqualified" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="scope">
<xs:sequence>
<xs:element name="type" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="value" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="shared">
<xs:sequence>
<xs:element name="additionalProperties" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="source">
<xs:sequence>
<xs:element name="title" form="unqualified" type="xs:string" minOccurs="0"/>
<xs:element name="url" form="unqualified" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Acl" type="Acl"/>
<xs:element name="AclRule" type="AclRule"/>
<xs:element name="Calendar" type="Calendar"/>
<xs:element name="CalendarList" type="CalendarList"/>
<xs:element name="CalendarListEntry" type="CalendarListEntry"/>
<xs:element name="CalendarNotification" type="CalendarNotification"/>
<xs:element name="Channel" type="Channel"/>
<xs:element name="ColorDefinition" type="ColorDefinition"/>
<xs:element name="Colors" type="Colors"/>
<xs:element name="Error" type="Error"/>
<xs:element name="Event" type="Event"/>
<xs:element name="EventAttendee" type="EventAttendee"/>
<xs:element name="EventDateTime" type="EventDateTime"/>
<xs:element name="EventReminder" type="EventReminder"/>
<xs:element name="Events" type="Events"/>
<xs:element name="FreeBusyCalendar" type="FreeBusyCalendar"/>
<xs:element name="FreeBusyGroup" type="FreeBusyGroup"/>
<xs:element name="FreeBusyRequest" type="FreeBusyRequest"/>
<xs:element name="FreeBusyRequestItem" type="FreeBusyRequestItem"/>
<xs:element name="FreeBusyResponse" type="FreeBusyResponse"/>
<xs:element name="Setting" type="Setting"/>
<xs:element name="Settings" type="Settings"/>
<xs:element name="TimePeriod" type="TimePeriod"/>
</xs:schema>