4 Replies Latest reply on Jul 27, 2015 8:35 AM by GeoffreyMartin

    XML not importing...

    GeoffreyMartin

      Title

      XML not importing...

      Post

      I have an XML file (some day to be from a website) that won't import. I've built an .xslt file that I think reflects the XML file.  I've taken the for-each tag out to see if I can even get one record to import and I get nothing.  I do get to the field matching window, but upon import there are no records moved over.  I'm sure I'm missing something.  Here's my .xslt file and I've attached an image of the XML.  Any help you can provide would be greatly appreciated.

      <?xml version='1.0' encoding='UTF-8'?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:template match="/">
              <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
                  <METADATA>
                      <FIELD NAME="master_incident_number" TYPE="TEXT"/>                
                      <FIELD NAME="vehicle_id" TYPE="TEXT"/>
                      <FIELD NAME="date_time" TYPE="TIMESTAMP"/>
                      <FIELD NAME="latitude" TYPE="NUMBER"/>                
                      <FIELD NAME="longitude" TYPE="NUMBER"/>
                      <FIELD NAME="radio_name" TYPE="TEXT"/>
                      <FIELD NAME="location" TYPE="TEXT"/>
                      <FIELD NAME="master_incident_id" TYPE="NUMBER"/>
                      <FIELD NAME="speed" TYPE="NUMBER"/>
                  </METADATA>

                  <RESULTSET>
                      <xsl:for-each select="/avllist1PartnerModel">                
                      <ROW>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/master_incident_number"/></DATA>
                          </COL>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/vehicle_id"/></DATA>
                          </COL>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/date_time"/></DATA>
                          </COL>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/latitude"/></DATA>
                          </COL>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/longitude"/></DATA>
                          </COL>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/radio_name"/></DATA>
                          </COL>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/location"/></DATA>
                          </COL>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/master_incdient_id"/></DATA>
                          </COL>
                          <COL>
                              <DATA><xsl:value-of select="avllist1PartnerModel/speed"/></DATA>
                          </COL>
                      </ROW>
                      </xsl:for-each>
                  </RESULTSET>
              </FMPXMLRESULT>
          </xsl:template>
      </xsl:stylesheet>

      avlXML.jpg

        • 1. Re: XML not importing...
          GeoffreyMartin

          I've tried that too.  I'm not getting any records to import.  I've included a couple of records of the XML file as text here:

           

          <avllist1PartnerModel>
          <master_incident_number>15-0046859</master_incident_number>
          <vehicle_id>180</vehicle_id>
          <date_time>7/16/2015 12:13:34 AM</date_time>
          <latitude>34215121</latitude>
          <longitude>119038340</longitude>
          <radio_name>MED451</radio_name>
          <location>W CHAPEL DR\S GLENN DR</location>
          <master_incident_id>666081</master_incident_id>
          <speed>0</speed>
          </avllist1PartnerModel>
          <avllist1PartnerModel>
          <master_incident_number>15-0046859</master_incident_number>
          <vehicle_id>180</vehicle_id>
          <date_time>7/16/2015 12:14:13 AM</date_time>
          <latitude>34215111</latitude>
          <longitude>119038350</longitude>
          <radio_name>MED451</radio_name>
          <location>W CHAPEL DR\S GLENN DR</location>
          <master_incident_id>666081</master_incident_id>
          <speed>0</speed>
          </avllist1PartnerModel>
          <avllist1PartnerModel>
          <master_incident_number>15-0046859</master_incident_number>
          <vehicle_id>180</vehicle_id>
          <date_time>7/16/2015 12:14:13 AM</date_time>
          <latitude>34215112</latitude>
          <longitude>119038348</longitude>
          <radio_name>MED451</radio_name>
          <location>W CHAPEL DR\S GLENN DR</location>
          <master_incident_id>666081</master_incident_id>
          <speed>0</speed>
          </avllist1PartnerModel>
          • 2. Re: XML not importing...
            GeoffreyMartin

            I tried changing template tag as you suggested and got a invalid document structure error which I didn't get with the "/"

            • 3. Re: XML not importing...
              fentonjones

              I'm not doing so well with this either. The problem I'm having is this, near the top of the XML: 
              xmlns="http://schemas.datacontract.org/2004/07/FMServiceXML"  xmlns:i="http://www.w3.org/2001/XMLSchema-instance"

              If I remove it, the XSL works. If I do not, then I can get either the FileMaker names (but not the data), or just the raw data (but not the FileMaker names); I cannot get both. Likely someone smarter than I could solve this. Anyway, here's a lightly better XSL (a couple for mistyped names):

              <?xml version='1.0' encoding='UTF-8'?>
              <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
              <xsl:output method="xml" encoding="utf-8" indent="yes" />    
                  <xsl:template match="/">
                      <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
                          <METADATA>
                              <FIELD NAME="master_incident_number" TYPE="TEXT"/>                
                              <FIELD NAME="vehicle_id" TYPE="TEXT"/>
                              <FIELD NAME="date_time" TYPE="TIMESTAMP"/>
                              <FIELD NAME="latitude" TYPE="NUMBER"/>                
                              <FIELD NAME="longitude" TYPE="NUMBER"/>
                              <FIELD NAME="radio_name" TYPE="TEXT"/>
                              <FIELD NAME="location" TYPE="TEXT"/>
                              <FIELD NAME="master_incident_id" TYPE="NUMBER"/>
                              <FIELD NAME="speed" TYPE="NUMBER"/>
                          </METADATA>

                          <RESULTSET>
                              <xsl:for-each select="ArrayOfavllist1PartnerModel/avllist1PartnerModel">                
                              <ROW>
                                  <COL>
                                      <DATA><xsl:value-of select="master_incident_number"/></DATA>
                                  </COL>
                                  <COL>
                                      <DATA><xsl:value-of select="vehicle_id"/></DATA>
                                  </COL>
                                  <COL>
                                      <DATA><xsl:value-of select="date_time"/></DATA>
                                  </COL>
                                  <COL>
                                      <DATA><xsl:value-of select="latitude"/></DATA>
                                  </COL>
                                  <COL>
                                      <DATA><xsl:value-of select="longitude"/></DATA>
                                  </COL>
                                  <COL>
                                      <DATA><xsl:value-of select="radio_name"/></DATA>
                                  </COL>
                                  <COL>
                                      <DATA><xsl:value-of select="location"/></DATA>
                                  </COL>
                                  <COL>
                                      <DATA><xsl:value-of select="master_incident_id"/></DATA>
                                  </COL>
                                  <COL>
                                      <DATA><xsl:value-of select="speed"/></DATA>
                                  </COL>
                              </ROW>
                              </xsl:for-each>
                          </RESULTSET>
                      </FMPXMLRESULT>
                  </xsl:template>
              </xsl:stylesheet>

              • 4. Re: XML not importing...
                GeoffreyMartin

                I removed xmlns="http://schemas.datacontract.org/2004/07/FMServiceXML" from the first line and the transfer worked.  I'm not sure what that is for, but it was blocking the transfer and maybe that is the point.  I have asked the data provider to see if they can remove it from the output they are providing.  If so I'm all good.  If not, my next hurdle will be to figure out how to either ignore it or build it into a script to delete it.  Either option sounds daunting.  

                Great detective work.  Thanks for the assistance.  I didn't even think to modify the incoming xml.