I am writing an iGoogle gadget, which calls the calendar API to add
and read events from its own calendar within a user's collection.  So
far, I've managed to get OAuth working, and retrieved a list of
calendars, now I'm trying to create the requested calendar name if it
doesn't exist.

I create an xml string, and send it to the url as documented in the
Calendar API, but no luck...  I get an error:
com.sun.syndication.io.ParsingFeedException: Invalid XML
every time.  I don't get any more detail than that.  Can anyone help
me with this?

Code snippets follow:

var newCal = '<?xml version="1.0" encoding="UTF-8"?>';
newCal = newCal + '<feed xmlns="http://www.w3.org/2005/Atom";';
newCal = newCal + 'xmlns:openSearch="http://a9.com/-/spec/
opensearchrss/1.0/"';
newCal = newCal + 'xmlns:gCal="http://schemas.google.com/gCal/2005";';
newCal = newCal + 'xmlns:gd="http://schemas.google.com/g/2005";>';
newCal = newCal + '<updated>2009-08-06T12:25:03.873Z</updated>';
newCal = newCal + '<category scheme="http://schemas.google.com/g/
2005#kind"';
newCal = newCal + 'term="http://schemas.google.com/gCal/
2005#calendarmeta"/>';
newCal = newCal + '<entry xmlns=\'http://www.w3.org/2005/Atom\'\n';
newCal = newCal + ' xmlns:gd=\'http://schemas.google.com/g/2005\'\n';
newCal = newCal + ' xmlns:gCal=\'http://schemas.google.com/gCal/
2005\'>';
newCal = newCal + ' <title type=\'text\'>P-Budget</title>';
newCal = newCal + ' <summary type=\'text\'>This calendar was created
for the Cal-Budget iGoogle gadget.</summary>';
newCal = newCal + ' <gCal:timezone value=\'Europe/London\'></
gCal:timezone>';
newCal = newCal + ' <gCal:hidden value=\'false\'></gCal:hidden>';
newCal = newCal + ' <gCal:color value=\'#2952A3\'></gCal:color>';
//newCal = newCal + ' <gCal:settingsProperty name=\'dateFieldOrder\'
value=\'YMD\'/>';
//newCal = newCal + ' <gCal:settingsProperty name=\'format24HourTime\'
value=\'true\'/>';
//newCal = newCal + ' <gCal:dateFieldOrder value=\'YMD\'></
gCal:dateFieldOrder>';
//newCal = newCal + ' <gCal:format24HourTime value=\'true\'></
gCal:format24HourTime>';
newCal = newCal + ' <gd:where rel=\'\' label=\'\' valueString=\'London
\'></gd:where>';
newCal = newCal + '</entry>';
newCal = newCal + '</feed>';

 var url = 'http://www.google.com/calendar/feeds/default/owncalendars/
full';
var headers = {
"Content-Type": "application/atom+xml"
};

fetchData(url,newCalResponse,newCal,"POST",headers);

then in fetchData, the following code:

 var params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] =
gadgets.io.ContentType.FEED;
params[gadgets.io.RequestParameters.AUTHORIZATION] =
gadgets.io.AuthorizationType.OAUTH;
params[gadgets.io.RequestParameters.OAUTH_SERVICE_NAME] = "google";
params[gadgets.io.RequestParameters.OAUTH_USE_TOKEN] = "always";
params[gadgets.io.RequestParameters.METHOD] = eval
("gadgets.io.MethodType."+pMethod);
params[gadgets.io.RequestParameters.NUM_ENTRIES] = 100;
params[gadgets.io.RequestParameters.GET_SUMMARIES] = true;
if (pData) {params[gadgets.io.RequestParameters.POST_DATA] = pData;}
if (pHeaders) {params[gadgets.io.RequestParameters.HEADERS] =
pHeaders;}

gadgets.io.makeRequest(url, function (response) {}, params);

(I've snipped the content of the response function for ease of
reading)

The XML looks fine to me, and passes validation.  I've tried it
without the feed tags, without any of the options for an entry, and
with all of them, and any other combination I thought made sense, and
none of it works.

Please help!

Thanks,
Rich

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to