7 Replies Latest reply on Sep 4, 2014 10:37 AM by ChrisJohnston

    Parse XML

    ChrisJohnston

      Title

      Parse XML

      Your post

                I am not using FileMaker Server I am using FileMaker Advanced 13, I ask my question here because I know the sever users may some good experience with web calls. Related to a solution I am building I want to send a call to the web something like

      http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=test-8816-0040a0642500&siteid=0&version=825&ItemID=231280001995&IncludeSelector=ItemSpecifics

                So the returned XML (pic) is what I want to extract the data from. I have some way to interact with PHP so I can do this, and have the data as I need it. I would then need to also send it to FileMaker. My question is does FileMaker have a way to parse XML returned from a web call? Or is there any other knowledge that I am missing about the way FileMaker can work with this whole process. I realize that what I am asking may be very specific to what I am doing, but just wanted to check the knowledge and experience of other users to see if there are already known ways of doing what I want. Thanks

            

      xmlreturn.png

        • 1. Re: Parse XML
          bigtom

               I believe you can store the entire XML result to a field and then parse the data from there using the tags to find the data you need. The tags make it fairly easy actually.

               AngellEye Consulting has a Paypal plugin for FM that returns similar XML to a field when doing an API search and I had to parse that by script to get a TransactionID when all I had in FM was the InvoiceID from an imported and parsed email.

               You may take a look at Andews plugin as most of the returns are pretty slick already for some ideas. There are also a number of people that have been connecting FM to eBay for a while and they might have something commercially available you can use.

               Maybe one day someone will offer an ebay plugin as I do not know of anyone having a solid solution yet. Some people use ebay fileexchange to get data, but I am not sure if that is any different or will work for you.

               Hope some of this may help.

                

          • 2. Re: Parse XML
            bigtom

                 If you are asking about how to get the data into FM in the first place you can import the text to a field or check out SmartPill or Scriptmaster as I think both offer some sort of PHP functionality to execute the calls directly through FM scripts. SmartPill has issues with FM13.

                 PHP is not something I am very good at.

            • 3. Re: Parse XML
              nilsw

                   Have you tried out the free BaseElements plug-in yet? Is has all the http and XML functions you need to retrieve the data and extract any information.

                   Nils

              • 4. Re: Parse XML
                ChrisJohnston

                     Nice! Just starting to read about it, looks like it does some really cool stuff. Looks like this could be just what I was looking for related to this post plus other stuff. Thanks a bunch!

                • 5. Re: Parse XML
                  ChrisJohnston

                       After checking it out I tried to install it. Tell me, does that have other files that work with it. I could not get the functions listed here to show up in FileMaker. I am using advanced 13 on Windows. It shows activated in the plugins area of FileMaker but don’t see any other signs it is there. I also see a 64bit version of the download, did not know if that has to be drop somewhere. Thanks

                  • 6. Re: Parse XML
                    User29172

                    Try using a custom function for parsing the XML. 

                    http://www.briandunning.com/cf/1/

                    If the XML response is in a variable called $XML you could use

                    ExtractData ( $XML ; "ItemID" ; 1 ) 

                    to get the first ItemID value.

                    • 7. Re: Parse XML
                      ChrisJohnston

                      Thanks, I saw that a while ago and got some use out of it. It is a great function! Thanks