Deviland
Deviland

Reputation: 3374

Extracting XML data from a FileMaker Web Viewer using a Custom Function

I have a script in Filemaker that calls a Brian Dunning hosted custom function called extractData this function looks for a given instance of a given attribute within a given XML contents. this however is not working for me (this may be due to FileMaker's reliance upon the default browser which in most cases will be IE, but more on that later).

The problem is this, I have a number of campaigns hosted on MailChimp and I wish to use their API to bring back the details about my campaigns I have the URL working in browsers so know I have this part right the content is being returned as XML, as requested within the URL.

my problem lies within FileMaker I am trying to get FileMaker to parse the XML using a custom function that I found on Brian Dunning's very useful site. if I pass this custom function some simple XML it works fine but when using a web viewer to process the URL and then extract the XML from that to pass to the custom function the whole process seems to fail. I am at a loss as to how I can extract the contents of the XML attributes being clearly displayed within my XML content.

Any help would be greatly appreciated.

Upvotes: 0

Views: 1996

Answers (2)

andyknas
andyknas

Reputation: 1957

Before you try to extract data from the response, take a look at the response value thru script debugger/data viewer in filemaker advanced. If you have response data and it's not working, then maybe the XML syntax is a bit more verbose and the CF can't parse it out. It works with XML structured like this:

<Element>Data</Element> 

but not

<Element id="123">Data</Element>

For optimum performance, use a plugin like Troi URL to request the data.

Far better than calling the API and importing pipe data.

Upvotes: 0

Sam Barnum
Sam Barnum

Reputation: 10724

The web viewer might not be getting the complete XML document. You need to pause and wait for the web viewer to finish loading. Or, use a plugin to get the URL contents.

Set a break point and use the debugger to dump the XML contents you're getting before parsing.

Upvotes: 2

Related Questions