Jump to content
Sign in to follow this  
Ben Feingold

Import XML data from web to field (EVE Online)

Recommended Posts

Greetings,

This is a non-work related question, but any help you can offer would be much appreciated. When not fulfilling my daily role as an IT Coordinator, I indulge in the MMO EVE Online. I've been building complex GoogleDocs to check market rates on items when it dawned on me that I could do all that and a lot more with FileMaker.

So here's my situation:

I currently have a button in my FileMaker database that opens this URL. I then copy the content of the page and paste it into a field ("XML_Data"). I then use the custom function ExtractData to pull out the data I need for my calculations.

What I would like:

Each time I open the database, I would like it to automatically retrieve the XML data from the web and put it in the field.

Any ideas? Thanks in advance,

Commander Ben Feingold

CEO of a virtual Corporation...in a virtual world of spaceships and laser guns... :tongue:

Here's the URL incase the link didn't work:

http://api.eve-centr...nlimit=10000002

Share this post


Link to post
Share on other sites

Filemaker can import XML data directly - provided you have a XSLT stylesheet to transform the XML to Filemaker's own grammar.

Each time I open the database, I would like it to automatically retrieve the XML data from the web and put it in the field.

Make it a part of your startup script.

Share this post


Link to post
Share on other sites

Thank you for the quick reply.

The XSLT is where I get stuck. After reading other people's posts about importing XML, I gather I'm not alone in this. Is there a good, "How to get started making your custom XSLT Stylesheet" forum or guide you can point me to? My friend Google helped me find the XSLT Tutorial at w3schools.com. I took a few minutes to play with the tutorial and I think I understand how it's supposed to work.

Below is an excerpt of XML code. I take this:


This XML file does not appear to have any style information associated with it. The document tree is shown below.

<evec_api method="marketstat_xml" version="2.0">

<marketstat>

	 <type id="9832">

		  <buy>

			   <volume>6365114</volume>

			   <avg>6481.53</avg>

			   <max>7505.05</max>

			   <min>1800.02</min>

			   <stddev>1207.86</stddev>

			   <median>6621.00</median>

			   <percentile>7502.91</percentile>

		  </buy>

		  <sell>

			   <volume>2679134</volume>

			   <avg>8911.18</avg>

			   <max>11300.00</max>

			   <min>7549.66</min>

			   <stddev>774.93</stddev>

			   <median>8500.00</median>

			   <percentile>7549.66</percentile>

		  </sell>

		  <all>

			   <volume>9044248</volume>

			   <avg>7201.25</avg>

			   <max>11300.00</max>

			   <min>1800.02</min>

			   <stddev>1299.05</stddev>

			   <median>7339.70</median>

			   <percentile>3976.32</percentile>

		  </all>

	 </type>

</marketstat>

</evec_api>





And apply something like this to it:









<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- Edited by Me -->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">



<xsl:template match="/">

  <html>

  <body>

  <h2>EVE-Central XML Import</h2>

    <table border="1">

      <tr bgcolor="#9acd32">

        <th>Volume</th>

        <th>Average</th>

        <th>Max</th>

        <th>Min</th>

        <th>Standard Deviation</th>

        <th>Median</th>

        <th>Percentile</th>

      </tr>

      <xsl:for-each select="marketstat/type id="?">

      <tr>

        <td><xsl:value-of select="volume"/></td>

        <td><xsl:value-of select="avg"/></td>

        <td><xsl:value-of select="max"/></td>

        <td><xsl:value-of select="min"/></td>

        <td><xsl:value-of select="stddev"/></td>

        <td><xsl:value-of select="median"/></td>

        <td><xsl:value-of select="percentile"/></td>

      </tr>

      </xsl:for-each>

    </table>

  </body>

  </html>

</xsl:template>

</xsl:stylesheet>





Assuming I'm on the right path, I have no idea what to do with this line, as it changes for each item type and this XML has 12 items listed one after another:





<xsl:for-each select="marketstat/type id="?">

As you can see in my XML example, the value is "<type id="9832">" but there could be any number in there.

Edited by Ben Feingold

Share this post


Link to post
Share on other sites

Just curious if you've had any success parsing the Eve-Central.com API.  Took a stab at it this morning and I think I figured it out.

Share this post


Link to post
Share on other sites

As a matter of fact, I had a lot of success. I used the example provided by "comment" (Thank you so much!) and built a solution to automatically generate a build schedule based on profit margins.

Share this post


Link to post
Share on other sites

This is a continuation of a question I had back in August about importing XML generated via an API. I listed the rest of the question in that thread, but then realized that people might not see it as that initial question was successfully answered. I hope you don't mind my reposting it as a new topic.

 

My latest endeavor is getting my inventory to import. I modified the XSL for the EVE API, added a table with the corresponding names, and modified the script, but I get the following error from FileMaker when I run it and tell FM to retrieve the XML from "https://":

 


XML parsing error:

unable to open primary document entity "

Line Number:0

Column Number: 0

 

If I tell it to get it from "http://..." I get:

 

XML parsing error:


internal error in NetAccessor

Line Number:0

Column Number: 0

 

However, if I use an XML coding program to apply my new stylesheet to the the raw XML provided by EVE's API, and then save the result to it's own XML file, I can easily import the records from the menu File>Import Records>XML Data Source...

 

Any idea what might return this error? Is FileMaker able to retrieve XML from https?

 

I attached three files:

1. The XML from EVE

http://fmforums.com/files/file/34-eve-api-asset-list/

 

2. My XSL

 

3. The XML with the stylesheet applied

Share this post


Link to post
Share on other sites

I merged your two topics.

 

Please do no start a sprinter topic when asking followup questions.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Similar Content

    • By eyepro
      I'm very very very newbie on xml.
      What I need to understand is if it's possibile export in this way.
      I use a xsl stylesheet to export from FM.
       
      I was able to use the <xsl:for-each to export details in the way I want:
      <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">
              <Details>
                  <Code><xsl:value-of select="fmp:COL[2]/fmp:DATA"/></Code>
                  <WTN><xsl:value-of select="fmp:COL[3]/fmp:DATA"/></WTN>
                  <Date><xsl:value-of select="fmp:COL[4]/fmp:DATA"/></Date>
                  
      result:
      <Details>
      <Code>0280c1</Code>
      <WTN>1</WTN>
      <Date>10/04/2018</Date>
      </Details>
      <Details>
      <Code>0280c2</Code>
      <WTN>2</WTN>
      <Date>10/04/2018</Date>
      </Details>
      <Details>
      <Code>0280c3</Code>
      <WTN>3</WTN>
      <Date>10/04/2018</Date>
      </Details>
      what i need to know is how put the fmp:COL[1] above the <xsl:for-each to get this:
      <CUSTOMER>ABC</CUSTOMER>
      <INVOICE>01</INVOICE>
      <Details>
      <PrimaryKey>0280c1</PrimaryKey>
      <WTN>1</WTN>
      <Date>10/04/2018</Date>
      <Colours/>
      </Details>
      <Details>
      <PrimaryKey>0280c2</PrimaryKey>
      <WTN>2</WTN>
      <Date>10/04/2018</Date>
      <Colours/>
      </Details>
      <Details>
      <PrimaryKey>0280c3</PrimaryKey>
      <WTN>3</WTN>
      <Date>10/04/2018</Date>
      <Colours/>
      </Details>
       
      Thanks in advance.
    • By Richard Carlton
      We have a new fix for Google Maps in FMSP & the FMI Contacts Starter Solution
      Vid 1 - Getting your API Key:

      Vid 2 - FMI Contacts Starter Solution Fix

      Vid 3 - FMSP Fix

      Get up to speed with the FileMaker Video Training Course!
      FileMaker is a cross-platform relational database application from FileMaker Inc. https://en.wikipedia.org/wiki/FileMaker
      Top Rated Course by FileMaker Expert, Richard Carlton.
      http://learningfilemaker.com/fmpro17.php
      Customer relationship management, processes implemented to manage a company's interactions with customers and prospects
      https://en.wikipedia.org/wiki/CRM
      Experience Richard's dynamic and exciting teaching format, while learning both basic, intermediate, and advanced FileMaker development skills. With 26 years of FileMaker experience and a long time speaker at FileMaker's Developer Conference, Richard will teach you all the ins and outs of building FileMaker Solutions.
      The course is 50 hours of video content!
      Richard has been involved with the FileMaker platform since 1990 and has grown RCC into one of the largest top tier FileMaker consultancies worldwide.
      Richard works closely with RCC's staff: a team of 28 FileMaker developers and supporting web designers.
      He has offices in California, Nevada, and Texas.
      Richard has been a frequent speaker at the FileMaker Developers Conference on a variety of topics involving FileMaker for Startups and Entrepreneurs, and client-server integration.
      Richard is the Product Manager for FM Starting Point, the popular and most downloaded free FileMaker CRM Starter Solution.
      Looking for FM Starting Point free software download: http://www.fmstartingpoint.com
      Richard won 2015 Excellence Award from FileMaker Inc (Apple Inc) for outstanding video and product creation, leading to business development.
      RCC, Filemaker Videos, and LearningFileMaker.com are headquartered in Santa Clara, CA.
      http://www.rcconsulting.com/
      Contact us at support@rcconsulting.com
      FileMaker Pro is simply a powerful software used to create custom apps that work seamlessly across iPad, iPhone, Windows, Mac, and the web
      Transform your business with the FileMaker Platform
      https://sites.google.com/site/filemakerprotrainingd2n/home/filemaker-training
      Free FileMaker Training Videos Channel https://www.youtube.com/user/FileMakerVideos
      FileMaker Training -FileMaker Video Training Course-FileMaker News-FileMaker Experts
      https://www.youtube.com/watch?v=RO3Do8QIQOE
      https://www.youtube.com/watch?v=RO3Do8QIQOE&index=2&list=PLjTvUZtwtgBTWVT38kPvgjCfkZmMmvCOk&t=25s
      FileMaker What's New-Top Ten Things To Know About FileMaker -FileMaker News
      https://youtu.be/6ZcnQEOF9XE
      https://www.youtube.com/watch?v=6ZcnQEOF9XE&index=1&list=PLjTvUZtwtgBTWVT38kPvgjCfkZmMmvCOk&t=25s
      Sharing a FileMaker Solution-The Basics-Sharing FileMaker Database-FileMaker Experts
      https://youtu.be/a5o5Mt8DnFI
      https://www.youtube.com/watch?v=a5o5Mt8DnFI&index=9&list=PLjTvUZtwtgBQukMafXx60CF5rcXwNmGWl&t=0s
      A database management system (DBMS) is a computer software application that interacts with the user, other applications, and the database itself to capture and analyze data
      Official site SDK, Developer's Guide, Reference, and Android Market for the open source project
      http://learningfilemaker.com/FIAS.html
      Video introduction to iOS App Training https://www.youtube.com/watch?v=cVxQe_yAshw
      Free FileMaker videos check out ...http://www.filemakervideos.com
      Download the FileMaker Pro & FileMaker GO for mobile devices training videos at http://www.learningfilemaker.com
      Download FileMaker Go video training at http://learningfilemaker.com/FMGO-17/index.php
      Download FileMaker Full Video Training Bundle at http://learningfilemaker.com/subscription.php
      Learn how to use FileMaker to create an app with the FileMaker Training Series
      Comment, Like & Share All of Our Videos.
      Feel Free to Embed any of Our Videos on Your Blog or Website.
      Follow Us on Your Favorite Social Media
      Facebook
      Twitter
      Google+
      #FileMakerGoogleMaps
      #FileMakerAPI
      #FileMakerGoogleMapsAPI
      #FileMakerFreeVideoTraining
      #FileMakerTrainingVideos
      #FilemakerProTraining
      #FileMakerVideoTutorial
      #FileMakerProVideos
    • By DarioDN
      Dear all, I've just create a script to export my records in multiple xml file (one xml for each record) applying also an XSL stylesheet.
      So, if I use the style.xsl taking from my computer ("source" button when filemaker ask me to select the file) it works. If I put the same file online, it doesn't work giving me a SAXParseException error: internal error in NetAccess (occurred in an unknown entity, at line 0, column 0).
      In the same folder where I have the style.xsl there are other xsl files that works, but they are used to "import" process (from XML to FILEMAKER, while in this case I'm working to an export process, from FILEMAKER to XML, I don't know if this could be the problem)
      Someone could help me to understand the error? Thank you
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp" > <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="fmp:FMPXMLRESULT"> <xsl:for-each select="fmp:RESULTSET/fmp:ROW"> <xsl:text>&#xA;</xsl:text> <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text> <xsl:value-of select="fmp:COL[1]/fmp:DATA"/>.<xsl:value-of select="fmp:COL[2]/fmp:DATA"/>.<xsl:value-of select="fmp:COL[3]/fmp:DATA"/><xsl:text disable-output-escaping="yes">--&gt;</xsl:text> <problem display_name="Checkboxes" > <choiceresponse> <label><xsl:value-of select="fmp:COL[4]/fmp:DATA"/></label> <checkboxgroup> <choice correct="{fmp:COL[6]/fmp:DATA}"> <xsl:value-of select="fmp:COL[5]/fmp:DATA"/> <choicehint selected="true"><xsl:value-of select="fmp:COL[7]/fmp:DATA"/> </choicehint> </choice> <choice correct="{fmp:COL[9]/fmp:DATA}"> <xsl:value-of select="fmp:COL[8]/fmp:DATA"/> <choicehint selected="true"><xsl:value-of select="fmp:COL[10]/fmp:DATA"/></choicehint> </choice> <choice correct="{fmp:COL[12]/fmp:DATA}"> <xsl:value-of select="fmp:COL[11]/fmp:DATA"/> <choicehint selected="true"><xsl:value-of select="fmp:COL[13]/fmp:DATA"/></choicehint> </choice> </checkboxgroup> </choiceresponse> </problem> <xsl:text>&#xA;</xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet>  
    • By jayivan
      I am working on an API integration from FileMaker 17 to Emma. Generally when I work on a new API, I get the curl working on the command line and then translate that into FM. But I've hit a roadblock with one particular API call while my other API calls to Emma are successful. (In the example below, I substituted out sensitive data with all caps.)
      From the command line, the code is:
      curl -u USER:PASS -H "Accept:application/json" -H "Content-type: application/json" -X POST -d '{"fields": {"name_first": "TESTFIRST","name_last": "TESTLAST","eligible": "false","expiration": "@D:2019-06-30"},"group_ids": ["GROUPIDNUMBER"],"email": "EMAIL@EMAIL.COM","opt_in_confirmation": "false"}' "https://api.e2ma.net/ACCOUNTNUMBER/members/signup"
      This command is successful.  The server responds with the individuals' emma id and group confirmation. 
      This fails using Insert from URL within FM though. While eventually I'll use FileMaker fields for an individual record's names, email, and expiration dates, I did not use fields in my testing in order to duplicate the command line exactly. In Insert from URL:
      The URL is "https://api.e2ma.net/ACCOUNTNUMBER/members/signup"
      The curl option is "-u USER:PASS -H \"Accept:application/json\" -H \"Content-type: application/json\" -X POST -d '{\"fields\": {\"name_first\": \"TESTFIRST\",\"name_last\": \"TESTLAST\",\"eligible\": \"false\",\"expiration\": \"@D:2101-06-30\"},\"group_ids\": [\"GROUPIDNUMBER\"],\"email\": \"EMAIL@EMAIL.COM\",\"opt_in_confirmation\": \"false\"}'"
       
      Can anyone identify the problem or suggest a workaround? My experience with API integration with FM is limited, but anything I could get working via the command line, I've been able to get working within FM until this.
    • By Pavlk
      I've attached two files. The first one is INVOICE, that is generated by every establishment when you purchase, and is in xml format.
      The second one is XSLT file, that is provided by government fiscal institution and is used to "translate" xml.
      PROBLEM DESCRIPTION: when I try to decode xml using attached xslt scheme on any online xml-converter website the output looks fine. BUT when importing to Filemaker, I receive an error: "XML parsing error: invalid document structure".
       
      I would appreciate any help with the issue. Thanks.
      XML input.xml
      XSLT scheme.xslt
  • Who Viewed the Topic

    9 members have viewed this topic:
    albert  Rich  normanicus  Eaams Ewan  laguna92651  OlderAndDumber  johnnyrocknyc  Matthew Bloomfield  jayivan 
×

Important Information

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