0

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.

Deviland
  • 3,324
  • 7
  • 32
  • 53

2 Answers2

2

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.

Sam Barnum
  • 10,559
  • 3
  • 54
  • 60
  • Thanks Sam I am pausing for 10 seconds and the contents appears to be loading the problem occurs when trying to parse the content within the web content holder that I have utilised to place the XML within the web viewer. I cannot get the contents of a pre specified attribute out into a variable. I have been using a Custom Function from Brian Dunning's site called extract data. – Deviland May 31 '11 at 15:41
  • Can you post the XML you are receiving, and the code you're using to parse it? – Sam Barnum May 31 '11 at 17:46
  • Hi Sam thanks for the response but I have used another method I am using an externally hosted PHP file to sort the results from MailChimp for me using the MCAPI which is very good if you ever need it. and then using this to display the results in a piped format and using that piped format to insert into FileMaker a long way round i grant you but then again isn't everything with FileMaker – Deviland Jun 01 '11 at 11:05
0

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.

andyknas
  • 1,939
  • 2
  • 15
  • 29