Jump to content
Server Maintenance This Week. ×

Importing Google Calendar Data


TRF

This topic is 5867 days old. Please don't post here. Open a new topic instead.

Recommended Posts

So close...

I'm able to create and update google calendar items. I'm now attempting to import calendar events from a date range. I can actually get the data in xml format but I'm now having difficulty with my xsl. Filemaker keeps choking on the google tags with "

Error:

"Unable to resolve prefix 'gd'.

patter = 'gd:comments'(G_Cal_to_FM.xsl, 56,52)

Remaining tokens: ()

xsl=G_Cal_to_FM.xsl

<?xml version="1.0" encoding="utf-8" ?>

0

Sample Node:

http://www.google.com/calendar/feeds/default/private/full/x

2007-07-09T20:00:07.000Z

2007-07-09T20:00:10.000Z

Title

Me

[email protected]

Link to comment
Share on other sites

It would be better if you zipped the xml and xsl files and uploaded them. They get fairly messed up if you load the text directly here; OK for small stuff, but a pain for this. Also, the fragment of xml is missing its namespaces, which are at the top. So I can only guess what they are. Fortunately, they are really only placeholders in xml/xsl. It does not really try to resolve them. So I just used what was in the file; more or less made them up.

So there were missing namespaces in the xml posted, which were likely in the full xml file. However there were NO namespaces declared to match those in the xsl. That's why the errors for "gd:"; and you would have gotten one for "gCal:" also (if you got that far).

So I declared them in the xsl; then I excluded them from the FileMaker result. FileMaker has no use for "gd:" and "gCal:" namespaces, so you declare them to "get" the data, then exclude them from the result. It makes sense if you think of it as a 2-step process.

A lot of your "fields" were referencing elements with no real content of their own. The data was further in, in an attribute. Yet you have fields for the element and the attribute; ie., too many fields. So I deleted a few.

[moved attachment down a couple posts]

Edited by Guest
moved file to later post
Link to comment
Share on other sites

Beautiful! Thanks. One thing - I munged my original xsl by not including "Found" in

I'm using curl (this is an os x only solution) to work with googles API - this was the last step to completing my solution.

Link to comment
Share on other sites

OK so I didn't do adequate testing either. I tweaked your xsl a bit and got the import dialog to come up quickly and easily - but it imported 0 records. I figured this was likely because the real root of the xml document is - which I had not accounted for. So I applied the template match to /feed instead of /. Now I'm getting an error for improperly formatted xml. I checked my syntax and the document looks good. Is this a name space issue?

Sample3.txt

G_Cal._xsl.txt

Link to comment
Share on other sites

Yep, you'se got some namespaces there. I guess the bigger the company, the more namespaces they use. Fortunately, you can just copy/paste them into the tag of your xsl. Whether you need them all depends on a couple things.

First, look to see if they actually assigned them to the root element, is the root element followed by namespaces. If it is, it means they are effectively prefixing every element within, other than those that have a specific namespace prefix themselves. In other words, it's an implicit namespace; it is not explicitly shown in the xml.

FileMaker does this themselves (so we can't complain).

Your job, as xsl stylesheet creator, is to make up an explicit prefix tag, declare it in the element, assigning it to that implicit namespace. Example:

xmlns:fm="http://www.filemaker.com/fmpxmlresult"

Then, if you wanted to extract a FileMaker element, you'd have to do it like this:

It may seem weird, but it is fundamental to the "extensible" meaning of xml/xsl. It allows people to tag their terms, so they don't collide with others; if say someone else has a of theater seats. You have to write your xsl respecting their namespaces.

In this case we've got several namespaces from Google. The 1st one in the list is implicit in the data, ie., it has no explicit prefix:

This means that every element below can only be selected via that namespace.

But it has no prefix. So, in the xsl, I made one up.

xmlns:ggl='http://www.w3.org/2005/Atom'

The ROW selector then looks like this:

You do not have to prefix attributes (@something), because they are referenced by their element.

For FileMaker import, you include all the prefixes declared in:

exclude-result-prefixes="ggl gd gCal openSearch">

Though I didn't even use gCal or openSearch; but you might.

Clear as mud?

G_Cal.xsl.zip

Link to comment
Share on other sites

  • 9 months later...

Back again! importing google data into my filemaker solution now - but having difficulty importing multiple lines. Each tag has a attribute which distinguishes it (example below). Do I need to create an attribute for this? Original xsl at the bottom.

XSL-

<?xml version="1.0" encoding="utf-8" ?>

xmlns:ggl='http://www.w3.org/2005/Atom'

xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'

xmlns:gCal='http://schemas.google.com/gCal/2005'

xmlns:gd='http://schemas.google.com/g/2005'

exclude-result-prefixes="ggl gd gCal openSearch">

0

Link to comment
Share on other sites

This topic is 5867 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.